#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
void *atoi(char *);
int /*<<< orphan*/ bubble_sort(int *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ insertion_sort(int *, int);
int *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ selection_sort(int *, int);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  int *test;
  int i;
  time_t dida;
  int number, method;
  unsigned char display;
  if (argc != 4) {
    printf("Usage: %s <sort method> <element number> <show result or not>\n",
           argv[0]);
    printf("method:\n1 bubble\n2 insertion\n3 selection\n\n");
    exit(1);
  }
  method = atoi(argv[1]);
  number = atoi(argv[2]);
  display = atoi(argv[3]);
  test = malloc(number * sizeof(int));
  dida = time(NULL);
  srand(dida);
  for (i = 0; i < number; ++i) {
    test[i] = rand() % (number * 10);
  }
  printf("%d elements has random generated!\n", number);
  if (display) {
    for (i = 0; i < number; i++) {
      if (i % 10 == 0)
        printf("\n");
      printf("%8d", test[i]);
    }
    printf("\n");
  }
  printf("Begin sorting...\n");
  switch (method) {
  case 1:
    bubble_sort(test, number);
    break;
  case 2:
    insertion_sort(test, number);
    break;
  case 3:
    selection_sort(test, number);
    break;
  default:
    printf("not a valid method!\n");
    exit(1);
  }
  printf("%d elements has been sorted\n", number);
  if (display) {
    for (i = 0; i < number; i++) {
      if (i % 10 == 0)
        printf("\n");
      printf("%8d", test[i]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     11ed <main+0x4d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1080 <atoi@plt>
mov    %al,-0x29(%rbp)
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%edi
call   1050 <srand@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    127e <main+0xde>
mov    $0x0,%al
call   10b0 <rand@plt>
imul   $0xa,-0x24(%rbp),%ecx
cltd
idiv   %ecx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    124b <main+0xab>
mov    -0x24(%rbp),%esi
lea    0xde2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpb   $0x0,-0x29(%rbp)
je     1303 <main+0x163>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    12f5 <main+0x155>
mov    -0x1c(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    12ce <main+0x12e>
lea    0xda1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdad(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    12a0 <main+0x100>
lea    0xd6c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd87(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x30(%rbp)
sub    $0x1,%eax
je     1347 <main+0x1a7>
jmp    1325 <main+0x185>
mov    -0x30(%rbp),%eax
sub    $0x2,%eax
je     1358 <main+0x1b8>
jmp    1336 <main+0x196>
mov    -0x30(%rbp),%eax
sub    $0x3,%eax
je     1369 <main+0x1c9>
jmp    137a <main+0x1da>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   10c0 <bubble_sort@plt>
jmp    1392 <main+0x1f2>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   10a0 <insertion_sort@plt>
jmp    1392 <main+0x1f2>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1030 <selection_sort@plt>
jmp    1392 <main+0x1f2>
lea    0xd22(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x24(%rbp),%esi
lea    0xd1c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpb   $0x0,-0x29(%rbp)
je     1417 <main+0x277>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1409 <main+0x269>
mov    -0x1c(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    13e2 <main+0x242>
lea    0xc8d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xc99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    13b4 <main+0x214>
lea    0xc58(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
cmp    $0x4,%edi
jne    13ed <main+0x22d>
mov    0x8(%rbx),%rdi
call   10a0 <atoi@plt>
mov    %rax,0x10(%rsp)
mov    0x10(%rbx),%rdi
call   10a0 <atoi@plt>
mov    %rax,%r15
mov    0x18(%rbx),%rdi
call   10a0 <atoi@plt>
mov    %rax,%r12
lea    0x0(,%r15,4),%edi
call   1090 <malloc@plt>
mov    %rax,%r13
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
test   %r15d,%r15d
jle    12dd <main+0x11d>
lea    (%r15,%r15,1),%eax
lea    (%rax,%rax,4),%r14d
mov    %r15d,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   10d0 <rand@plt>
cltd
idiv   %r14d
mov    %edx,0x0(%r13,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1240 <main+0x80>
lea    0xddf(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
test   %r12b,%r12b
je     130f <main+0x14f>
mov    %r15,0x8(%rsp)
test   %r15d,%r15d
jle    12fc <main+0x13c>
mov    0x8(%rsp),%ebp
mov    $0xcccccccd,%ebx
lea    0xdd5(%rip),%r12
xor    %r15d,%r15d
xor    %r14d,%r14d
jmp    12bc <main+0xfc>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x0(%r13,%r14,4),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%r14
add    $0xffffffff,%r15d
cmp    %r14,%rbp
je     12fc <main+0x13c>
mov    %r14d,%eax
imul   %rbx,%rax
shr    $0x23,%rax
lea    (%rax,%rax,4),%eax
add    %eax,%eax
add    %r15d,%eax
jne    12a0 <main+0xe0>
mov    $0xa,%edi
call   1040 <putchar@plt>
jmp    12a0 <main+0xe0>
lea    0xd5b(%rip),%rdi
mov    %r15,0x8(%rsp)
mov    %r15d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
test   %r12b,%r12b
je     13e5 <main+0x225>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %ebp,%ebp
mov    0x8(%rsp),%r15
jmp    1312 <main+0x152>
mov    $0x1,%bpl
lea    0xd6a(%rip),%rdi
call   1050 <puts@plt>
mov    0x10(%rsp),%rax
cmp    $0x3,%eax
je     1343 <main+0x183>
cmp    $0x2,%eax
je     1350 <main+0x190>
cmp    $0x1,%eax
jne    1407 <main+0x247>
mov    %r13,%rdi
mov    %r15d,%esi
call   10e0 <bubble_sort@plt>
jmp    135b <main+0x19b>
mov    %r13,%rdi
mov    %r15d,%esi
call   1030 <selection_sort@plt>
jmp    135b <main+0x19b>
mov    %r13,%rdi
mov    %r15d,%esi
call   10c0 <insertion_sort@plt>
lea    0xd04(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
test   %bpl,%bpl
jne    13d4 <main+0x214>
test   %r15d,%r15d
jle    13ca <main+0x20a>
mov    %r15d,%r12d
mov    $0xcccccccd,%r15d
lea    0xcdc(%rip),%r14
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    13ab <main+0x1eb>
nopl   0x0(%rax)
mov    0x0(%r13,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbx
add    $0xffffffff,%ebp
cmp    %rbx,%r12
je     13ca <main+0x20a>
mov    %ebx,%eax
imul   %r15,%rax
shr    $0x23,%rax
lea    (%rax,%rax,4),%eax
add    %eax,%eax
add    %ebp,%eax
jne    1390 <main+0x1d0>
mov    $0xa,%edi
call   1040 <putchar@plt>
jmp    1390 <main+0x1d0>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%bpl
jmp    1308 <main+0x148>
mov    (%rbx),%rsi
lea    0xc09(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xca3(%rip),%rdi
jmp    140e <main+0x24e>
lea    0xc86(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [63 x i8] c"Usage: %s <sort method> <element number> <show result or not>\0A\00"
@.str.1 = [43 x i8] c"method:\0A1 bubble\0A2 insertion\0A3 selection\0A\0A\00"
@.str.2 = [35 x i8] c"%d elements has random generated!\0A\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [4 x i8] c"%8d\00"
@.str.5 = [18 x i8] c"Begin sorting...\0A\00"
@.str.6 = [21 x i8] c"not a valid method!\0A\00"
@.str.7 = [29 x i8] c"%d elements has been sorted\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 4
br i1 %13, label %14, label %21
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i8* @atoi(i8* %24)
%26 = ptrtoint i8* %25 to i32
store i32 %26, i32* %10
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 2
%29 = load i8*, i8** %28
%30 = call i8* @atoi(i8* %29)
%31 = ptrtoint i8* %30 to i32
store i32 %31, i32* %9
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 3
%34 = load i8*, i8** %33
%35 = call i8* @atoi(i8* %34)
%36 = ptrtoint i8* %35 to i8
store i8 %36, i8* %11
%37 = load i32, i32* %9
%38 = sext i32 %37 to i64
%39 = mul i64 %38, 4
%40 = trunc i64 %39 to i32
%41 = call i32* @malloc(i32 %40)
store i32* %41, i32** %6
%42 = call i32 @time(i32* null)
store i32 %42, i32* %8
%43 = load i32, i32* %8
%44 = call i32 @srand(i32 %43)
store i32 0, i32* %7
br label %45
45: ; preds = %58, %21
%46 = load i32, i32* %7
%47 = load i32, i32* %9
%48 = icmp slt i32 %46, %47
br i1 %48, label %49, label %61
49: ; preds = %45
%50 = call i32 (...) @rand()
%51 = load i32, i32* %9
%52 = mul nsw i32 %51, 10
%53 = srem i32 %50, %52
%54 = load i32*, i32** %6
%55 = load i32, i32* %7
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i32, i32* %54, i64 %56
store i32 %53, i32* %57
br label %58
58: ; preds = %49
%59 = load i32, i32* %7
%60 = add nsw i32 %59, 1
store i32 %60, i32* %7
br label %45
61: ; preds = %45
%62 = load i32, i32* %9
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %62)
%64 = load i8, i8* %11
%65 = icmp ne i8 %64, 0
br i1 %65, label %66, label %89
66: ; preds = %61
store i32 0, i32* %7
br label %67
67: ; preds = %84, %66
%68 = load i32, i32* %7
%69 = load i32, i32* %9
%70 = icmp slt i32 %68, %69
br i1 %70, label %71, label %87
71: ; preds = %67
%72 = load i32, i32* %7
%73 = srem i32 %72, 10
%74 = icmp eq i32 %73, 0
br i1 %74, label %75, label %77
75: ; preds = %71
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %77
77: ; preds = %75, %71
%78 = load i32*, i32** %6
%79 = load i32, i32* %7
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds i32, i32* %78, i64 %80
%82 = load i32, i32* %81
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %82)
br label %84
84: ; preds = %77
%85 = load i32, i32* %7
%86 = add nsw i32 %85, 1
store i32 %86, i32* %7
br label %67
87: ; preds = %67
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %89
89: ; preds = %87, %61
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%91 = load i32, i32* %10
switch i32 %91, label %104 [
i32 1, label %92
i32 2, label %96
i32 3, label %100
]
92: ; preds = %89
%93 = load i32*, i32** %6
%94 = load i32, i32* %9
%95 = call i32 @bubble_sort(i32* %93, i32 %94)
br label %107
96: ; preds = %89
%97 = load i32*, i32** %6
%98 = load i32, i32* %9
%99 = call i32 @insertion_sort(i32* %97, i32 %98)
br label %107
100: ; preds = %89
%101 = load i32*, i32** %6
%102 = load i32, i32* %9
%103 = call i32 @selection_sort(i32* %101, i32 %102)
br label %107
104: ; preds = %89
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
%106 = call i32 @exit(i32 1)
unreachable
107: ; preds = %100, %96, %92
%108 = load i32, i32* %9
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0), i32 %108)
%110 = load i8, i8* %11
%111 = icmp ne i8 %110, 0
br i1 %111, label %112, label %135
112: ; preds = %107
store i32 0, i32* %7
br label %113
113: ; preds = %130, %112
%114 = load i32, i32* %7
%115 = load i32, i32* %9
%116 = icmp slt i32 %114, %115
br i1 %116, label %117, label %133
117: ; preds = %113
%118 = load i32, i32* %7
%119 = srem i32 %118, 10
%120 = icmp eq i32 %119, 0
br i1 %120, label %121, label %123
121: ; preds = %117
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %123
123: ; preds = %121, %117
%124 = load i32*, i32** %6
%125 = load i32, i32* %7
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds i32, i32* %124, i64 %126
%128 = load i32, i32* %127
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %128)
br label %130
130: ; preds = %123
%131 = load i32, i32* %7
%132 = add nsw i32 %131, 1
store i32 %132, i32* %7
br label %113
133: ; preds = %113
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %135
135: ; preds = %133, %107
%136 = load i32, i32* %3
ret i32 %136
}

LLVM IR (-O2):
@.str = [63 x i8] c"Usage: %s <sort method> <element number> <show result or not>\0A\00"
@.str.2 = [35 x i8] c"%d elements has random generated!\0A\00"
@.str.4 = [4 x i8] c"%8d\00"
@.str.7 = [29 x i8] c"%d elements has been sorted\0A\00"
@str = [17 x i8] c"Begin sorting...\00"
@str.8 = [20 x i8] c"not a valid method!\00"
@str.9 = [42 x i8] c"method:\0A1 bubble\0A2 insertion\0A3 selection\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.9, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i8* @atoi(i8* %11)
%13 = ptrtoint i8* %12 to i64
%14 = trunc i64 %13 to i32
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = tail call i8* @atoi(i8* %16)
%18 = ptrtoint i8* %17 to i64
%19 = trunc i64 %18 to i32
%20 = getelementptr inbounds i8*, i8** %1, i64 3
%21 = load i8*, i8** %20
%22 = tail call i8* @atoi(i8* %21)
%23 = ptrtoint i8* %22 to i64
%24 = trunc i64 %23 to i8
%25 = shl i32 %19, 2
%26 = tail call i32* @malloc(i32 %25)
%27 = tail call i32 @time(i32* null)
%28 = tail call i32 @srand(i32 %27)
%29 = icmp sgt i32 %19, 0
br i1 %29, label %30, label %43
30: ; preds = %9
%31 = mul nsw i32 %19, 10
%32 = and i64 %18, 4294967295
br label %33
33: ; preds = %30, %33
%34 = phi i64 [ 0, %30 ], [ %38, %33 ]
%35 = tail call i32 (...) @rand()
%36 = srem i32 %35, %31
%37 = getelementptr inbounds i32, i32* %26, i64 %34
store i32 %36, i32* %37
%38 = add nuw nsw i64 %34, 1
%39 = icmp eq i64 %38, %32
br i1 %39, label %40, label %33
40: ; preds = %33
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%42 = icmp eq i8 %24, 0
br i1 %42, label %64, label %46
43: ; preds = %9
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%45 = icmp eq i8 %24, 0
br i1 %45, label %64, label %62
46: ; preds = %40
br i1 %29, label %47, label %62
47: ; preds = %46
%48 = and i64 %18, 4294967295
br label %49
49: ; preds = %47, %56
%50 = phi i64 [ 0, %47 ], [ %60, %56 ]
%51 = trunc i64 %50 to i32
%52 = urem i32 %51, 10
%53 = icmp eq i32 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %49
%55 = tail call i32 @putchar(i32 10)
br label %56
56: ; preds = %54, %49
%57 = getelementptr inbounds i32, i32* %26, i64 %50
%58 = load i32, i32* %57
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %58)
%60 = add nuw nsw i64 %50, 1
%61 = icmp eq i64 %60, %48
br i1 %61, label %62, label %49
62: ; preds = %56, %43, %46
%63 = tail call i32 @putchar(i32 10)
br label %64
64: ; preds = %43, %62, %40
%65 = phi i1 [ true, %43 ], [ false, %62 ], [ true, %40 ]
%66 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
switch i32 %14, label %73 [
i32 1, label %67
i32 2, label %69
i32 3, label %71
]
67: ; preds = %64
%68 = tail call i32 @bubble_sort(i32* %26, i32 %19)
br label %76
69: ; preds = %64
%70 = tail call i32 @insertion_sort(i32* %26, i32 %19)
br label %76
71: ; preds = %64
%72 = tail call i32 @selection_sort(i32* %26, i32 %19)
br label %76
73: ; preds = %64
%74 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.8, i64 0, i64 0))
%75 = tail call i32 @exit(i32 1)
unreachable
76: ; preds = %71, %69, %67
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0), i32 %19)
br i1 %65, label %96, label %78
78: ; preds = %76
br i1 %29, label %79, label %94
79: ; preds = %78
%80 = and i64 %18, 4294967295
br label %81
81: ; preds = %79, %88
%82 = phi i64 [ 0, %79 ], [ %92, %88 ]
%83 = trunc i64 %82 to i32
%84 = urem i32 %83, 10
%85 = icmp eq i32 %84, 0
br i1 %85, label %86, label %88
86: ; preds = %81
%87 = tail call i32 @putchar(i32 10)
br label %88
88: ; preds = %86, %81
%89 = getelementptr inbounds i32, i32* %26, i64 %82
%90 = load i32, i32* %89
%91 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %90)
%92 = add nuw nsw i64 %82, 1
%93 = icmp eq i64 %92, %80
br i1 %93, label %94, label %81
94: ; preds = %88, %78
%95 = tail call i32 @putchar(i32 10)
br label %96
96: ; preds = %94, %76
ret i32 0
}