github.com/goplus/llgo@v0.8.3/cl/_testrt/qsort/out.ll (about)

     1  ; ModuleID = 'main'
     2  source_filename = "main"
     3  
     4  @"main.init$guard" = global ptr null
     5  @__llgo_argc = global ptr null
     6  @__llgo_argv = global ptr null
     7  @0 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
     8  
     9  define void @main.init() {
    10  _llgo_0:
    11    %0 = load i1, ptr @"main.init$guard", align 1
    12    br i1 %0, label %_llgo_2, label %_llgo_1
    13  
    14  _llgo_1:                                          ; preds = %_llgo_0
    15    store i1 true, ptr @"main.init$guard", align 1
    16    br label %_llgo_2
    17  
    18  _llgo_2:                                          ; preds = %_llgo_1, %_llgo_0
    19    ret void
    20  }
    21  
    22  define i32 @main(i32 %0, ptr %1) {
    23  _llgo_0:
    24    store i32 %0, ptr @__llgo_argc, align 4
    25    store ptr %1, ptr @__llgo_argv, align 8
    26    call void @"github.com/goplus/llgo/internal/runtime.init"()
    27    call void @main.init()
    28    %2 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 40)
    29    %3 = getelementptr inbounds i64, ptr %2, i64 0
    30    %4 = getelementptr inbounds i64, ptr %2, i64 1
    31    %5 = getelementptr inbounds i64, ptr %2, i64 2
    32    %6 = getelementptr inbounds i64, ptr %2, i64 3
    33    %7 = getelementptr inbounds i64, ptr %2, i64 4
    34    store i64 100, ptr %3, align 4
    35    store i64 8, ptr %4, align 4
    36    store i64 23, ptr %5, align 4
    37    store i64 2, ptr %6, align 4
    38    store i64 7, ptr %7, align 4
    39    %8 = getelementptr inbounds i64, ptr %2, i64 0
    40    call void @qsort(ptr %8, i64 5, i64 8, ptr @"main.main$1")
    41    %9 = load [5 x i64], ptr %2, align 4
    42    br label %_llgo_1
    43  
    44  _llgo_1:                                          ; preds = %_llgo_2, %_llgo_0
    45    %10 = phi i64 [ -1, %_llgo_0 ], [ %11, %_llgo_2 ]
    46    %11 = add i64 %10, 1
    47    %12 = icmp slt i64 %11, 5
    48    br i1 %12, label %_llgo_2, label %_llgo_3
    49  
    50  _llgo_2:                                          ; preds = %_llgo_1
    51    %13 = icmp slt i64 %11, 0
    52    call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %13)
    53    %14 = getelementptr inbounds i64, ptr %2, i64 %11
    54    %15 = load i64, ptr %14, align 4
    55    %16 = call i32 (ptr, ...) @printf(ptr @0, i64 %15)
    56    br label %_llgo_1
    57  
    58  _llgo_3:                                          ; preds = %_llgo_1
    59    ret i32 0
    60  }
    61  
    62  declare void @"github.com/goplus/llgo/internal/runtime.init"()
    63  
    64  declare ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64)
    65  
    66  declare void @qsort(ptr, i64, i64, ptr)
    67  
    68  define i32 @"main.main$1"(ptr %0, ptr %1) {
    69  _llgo_0:
    70    %2 = load i64, ptr %0, align 4
    71    %3 = load i64, ptr %1, align 4
    72    %4 = sub i64 %2, %3
    73    %5 = trunc i64 %4 to i32
    74    ret i32 %5
    75  }
    76  
    77  declare void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1)
    78  
    79  declare i32 @printf(ptr, ...)