#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int selection_sort(int *, int);
char *test_normal_ops() {
  int array[] = {10, 34, 23, 9, -5, -7, 0};
  do {
    if (!(selection_sort(array, 0) == -2)) {
      printf("Line number is: %d\n", 13);
      return "error, sorted array with 0 elements";
    }
  } while (0);
  do {
    if (!(selection_sort(array, 7) == 0)) {
      printf("Line number is: %d\n", 14);
      return "error, did not return 0";
    }
  } while (0);
  int i;
  for (i = 0; i < 7; i++) {
    printf("%d\t", array[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<test_normal_ops>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec9(%rip),%eax
mov    %eax,-0x18(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
call   1030 <selection_sort@plt>
cmp    $0xfffffffe,%eax
je     1189 <test_normal_ops+0x69>
lea    0xeaf(%rip),%rdi
mov    $0xd,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    121d <test_normal_ops+0xfd>
jmp    118e <test_normal_ops+0x6e>
jmp    1193 <test_normal_ops+0x73>
lea    -0x30(%rbp),%rdi
mov    $0x7,%esi
call   1030 <selection_sort@plt>
cmp    $0x0,%eax
je     11cd <test_normal_ops+0xad>
lea    0xe6b(%rip),%rdi
mov    $0xe,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe90(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    121d <test_normal_ops+0xfd>
jmp    11d2 <test_normal_ops+0xb2>
movl   $0x0,-0x34(%rbp)
cmpl   $0x7,-0x34(%rbp)
jge    1207 <test_normal_ops+0xe7>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11d9 <test_normal_ops+0xb9>
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_normal_ops>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movups 0xece(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movaps 0xeb6(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <selection_sort@plt>
cmp    $0xfffffffe,%eax
jne    118d <test_normal_ops+0x5d>
mov    %rsp,%rdi
mov    $0x7,%esi
call   1030 <selection_sort@plt>
test   %eax,%eax
je     11a9 <test_normal_ops+0x79>
lea    0xea7(%rip),%rdi
mov    $0xe,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xecc(%rip),%rbx
jmp    121d <test_normal_ops+0xed>
lea    0xe88(%rip),%rdi
mov    $0xd,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe89(%rip),%rbx
jmp    121d <test_normal_ops+0xed>
mov    (%rsp),%esi
lea    0xeb9(%rip),%r14
xor    %ebx,%ebx
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %rbx,%rax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.test_normal_ops.array = [7 x i32] [i32 10, i32 34, i32 23, i32 9, i32 -5, i32 -7, i32 0]
@.str = [20 x i8] c"Line number is: %d\0A\00"
@.str.1 = [36 x i8] c"error, sorted array with 0 elements\00"
@.str.2 = [24 x i8] c"error, did not return 0\00"
@.str.3 = [4 x i8] c"%d\09\00"
@.str.4 = [2 x i8] c"\0A\00"
define i8* @test_normal_ops() {
%1 = alloca i8*
%2 = alloca [7 x i32]
%3 = alloca i32
%4 = bitcast [7 x i32]* %2 to i8*
br label %5
5: ; preds = %0
%6 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%7 = call i32 @selection_sort(i32* %6, i32 0)
%8 = icmp eq i32 %7, -2
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 13)
store i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %35
11: ; preds = %5
br label %12
12: ; preds = %11
br label %13
13: ; preds = %12
%14 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%15 = call i32 @selection_sort(i32* %14, i32 7)
%16 = icmp eq i32 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %13
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 14)
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8** %1
br label %35
19: ; preds = %13
br label %20
20: ; preds = %19
store i32 0, i32* %3
br label %21
21: ; preds = %30, %20
%22 = load i32, i32* %3
%23 = icmp slt i32 %22, 7
br i1 %23, label %24, label %33
24: ; preds = %21
%25 = load i32, i32* %3
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %24
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %21
33: ; preds = %21
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i8* null, i8** %1
br label %35
35: ; preds = %33, %17, %9
%36 = load i8*, i8** %1
ret i8* %36
}

LLVM IR (-O2):
@__const.test_normal_ops.array = [7 x i32] [i32 10, i32 34, i32 23, i32 9, i32 -5, i32 -7, i32 0]
@.str = [20 x i8] c"Line number is: %d\0A\00"
@.str.1 = [36 x i8] c"error, sorted array with 0 elements\00"
@.str.2 = [24 x i8] c"error, did not return 0\00"
@.str.3 = [4 x i8] c"%d\09\00"
define i8* @test_normal_ops() {
%1 = alloca [7 x i32]
%2 = bitcast [7 x i32]* %1 to i8*
%3 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%4 = call i32 @selection_sort(i32* %3, i32 0)
%5 = icmp eq i32 %4, -2
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 13)
br label %35
8: ; preds = %0
%9 = call i32 @selection_sort(i32* %3, i32 7)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %33
11: ; preds = %8
%12 = load i32, i32* %3
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 1
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 2
%18 = load i32, i32* %17
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 3
%21 = load i32, i32* %20
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%23 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 4
%24 = load i32, i32* %23
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %24)
%26 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 5
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 6
%30 = load i32, i32* %29
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %30)
%32 = call i32 @putchar(i32 10)
br label %35
33: ; preds = %8
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 14)
br label %35
35: ; preds = %11, %33, %6
%36 = phi i8* [ null, %11 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), %33 ], [ getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), %6 ]
ret i8* %36
}