#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 imin(int, int);
int /*<<< orphan*/ printf(char *, int, int, int, int);
void imin_test() {
  int a[] = {0, 1, -1, 2532, -2147483648, 2147483647};
  int b[] = {1, -1, 0, 223, 2147483647, -2147483647};
  int e[] = {0, -1, -1, 223, -2147483648, -2147483647};
  for (int i = 0; i < 6; i++) {
    if (imin(a[i], b[i]) != e[i]) {
      printf("Error!\n a: %d\t b: %d\n expected: %d\t actual: %d\n", a[i], b[i],
             e[i], imin(a[i], b[i]));
    }
  }
}


x86 assembly (clang, -O0):
<imin_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed0(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xecd(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xecf(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xecc(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xec9(%rip),%rax
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x64(%rbp)
cmpl   $0x6,-0x64(%rbp)
jge    1220 <imin_test+0x100>
movslq -0x64(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edi
movslq -0x64(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
call   1030 <imin@plt>
movslq -0x64(%rbp),%rcx
cmp    -0x60(%rbp,%rcx,4),%eax
je     120d <imin_test+0xed>
movslq -0x64(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
mov    %eax,-0x70(%rbp)
movslq -0x64(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
mov    %eax,-0x6c(%rbp)
movslq -0x64(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%eax
mov    %eax,-0x68(%rbp)
movslq -0x64(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edi
movslq -0x64(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
call   1030 <imin@plt>
mov    -0x70(%rbp),%esi
mov    -0x6c(%rbp),%edx
mov    -0x68(%rbp),%ecx
mov    %eax,%r8d
lea    0xe50(%rip),%rdi
call   1040 <printf@plt>
jmp    1212 <imin_test+0xf2>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1192 <imin_test+0x72>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imin_test>:
push   %rax
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <imin@plt>
test   %eax,%eax
je     1155 <imin_test+0x35>
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <imin@plt>
lea    0xebc(%rip),%rdi
xor    %esi,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1030 <imin@plt>
cmp    $0xffffffff,%eax
je     1196 <imin_test+0x76>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1030 <imin@plt>
lea    0xe81(%rip),%rdi
mov    $0x1,%esi
mov    $0xffffffff,%edx
mov    $0xffffffff,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
mov    $0xffffffff,%edi
xor    %esi,%esi
call   1030 <imin@plt>
cmp    $0xffffffff,%eax
je     11ce <imin_test+0xae>
mov    $0xffffffff,%edi
xor    %esi,%esi
call   1030 <imin@plt>
lea    0xe46(%rip),%rdi
mov    $0xffffffff,%esi
xor    %edx,%edx
mov    $0xffffffff,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
mov    $0x9e4,%edi
mov    $0xdf,%esi
call   1030 <imin@plt>
cmp    $0xdf,%eax
je     1211 <imin_test+0xf1>
mov    $0x9e4,%edi
mov    $0xdf,%esi
call   1030 <imin@plt>
lea    0xe06(%rip),%rdi
mov    $0x9e4,%esi
mov    $0xdf,%edx
mov    $0xdf,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
mov    $0x80000000,%edi
mov    $0x7fffffff,%esi
call   1030 <imin@plt>
cmp    $0x80000000,%eax
je     1254 <imin_test+0x134>
mov    $0x80000000,%edi
mov    $0x7fffffff,%esi
call   1030 <imin@plt>
lea    0xdc3(%rip),%rdi
mov    $0x80000000,%esi
mov    $0x7fffffff,%edx
mov    $0x80000000,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
mov    $0x7fffffff,%edi
mov    $0x80000001,%esi
call   1030 <imin@plt>
cmp    $0x80000001,%eax
jne    126c <imin_test+0x14c>
pop    %rax
ret
mov    $0x7fffffff,%edi
mov    $0x80000001,%esi
call   1030 <imin@plt>
lea    0xd7e(%rip),%rdi
mov    $0x7fffffff,%esi
mov    $0x80000001,%edx
mov    $0x80000001,%ecx
mov    %eax,%r8d
pop    %rax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@__const.imin_test.a = [6 x i32] [i32 0, i32 1, i32 -1, i32 2532, i32 -2147483648, i32 2147483647]
@__const.imin_test.b = [6 x i32] [i32 1, i32 -1, i32 0, i32 223, i32 2147483647, i32 -2147483647]
@__const.imin_test.e = [6 x i32] [i32 0, i32 -1, i32 -1, i32 223, i32 -2147483648, i32 -2147483647]
@.str = [48 x i8] c"Error!\0A a: %d\09 b: %d\0A expected: %d\09 actual: %d\0A\00"
define void @imin_test() {
%1 = alloca [6 x i32]
%2 = alloca [6 x i32]
%3 = alloca [6 x i32]
%4 = alloca i32
%5 = bitcast [6 x i32]* %1 to i8*
%6 = bitcast [6 x i32]* %2 to i8*
%7 = bitcast [6 x i32]* %3 to i8*
store i32 0, i32* %4
br label %8
8: ; preds = %50, %0
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 6
br i1 %10, label %11, label %53
11: ; preds = %8
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = call i32 @imin(i32 %15, i32 %19)
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = icmp ne i32 %20, %24
br i1 %25, label %26, label %49
26: ; preds = %11
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = load i32, i32* %4
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = load i32, i32* %4
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = load i32, i32* %4
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 %44
%46 = load i32, i32* %45
%47 = call i32 @imin(i32 %42, i32 %46)
%48 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %30, i32 %34, i32 %38, i32 %47)
br label %49
49: ; preds = %26, %11
br label %50
50: ; preds = %49
%51 = load i32, i32* %4
%52 = add nsw i32 %51, 1
store i32 %52, i32* %4
br label %8
53: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [48 x i8] c"Error!\0A a: %d\09 b: %d\0A expected: %d\09 actual: %d\0A\00"
define void @imin_test() {
%1 = tail call i32 @imin(i32 0, i32 1)
%2 = icmp eq i32 %1, 0
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = tail call i32 @imin(i32 0, i32 1)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 0, i32 1, i32 0, i32 %4)
br label %6
6: ; preds = %0, %3
%7 = tail call i32 @imin(i32 1, i32 -1)
%8 = icmp eq i32 %7, -1
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = tail call i32 @imin(i32 1, i32 -1)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 1, i32 -1, i32 -1, i32 %10)
br label %12
12: ; preds = %9, %6
%13 = tail call i32 @imin(i32 -1, i32 0)
%14 = icmp eq i32 %13, -1
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = tail call i32 @imin(i32 -1, i32 0)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 -1, i32 0, i32 -1, i32 %16)
br label %18
18: ; preds = %15, %12
%19 = tail call i32 @imin(i32 2532, i32 223)
%20 = icmp eq i32 %19, 223
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = tail call i32 @imin(i32 2532, i32 223)
%23 = tail call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 2532, i32 223, i32 223, i32 %22)
br label %24
24: ; preds = %21, %18
%25 = tail call i32 @imin(i32 -2147483648, i32 2147483647)
%26 = icmp eq i32 %25, -2147483648
br i1 %26, label %30, label %27
27: ; preds = %24
%28 = tail call i32 @imin(i32 -2147483648, i32 2147483647)
%29 = tail call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 -2147483648, i32 2147483647, i32 -2147483648, i32 %28)
br label %30
30: ; preds = %27, %24
%31 = tail call i32 @imin(i32 2147483647, i32 -2147483647)
%32 = icmp eq i32 %31, -2147483647
br i1 %32, label %36, label %33
33: ; preds = %30
%34 = tail call i32 @imin(i32 2147483647, i32 -2147483647)
%35 = tail call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 2147483647, i32 -2147483647, i32 -2147483647, i32 %34)
br label %36
36: ; preds = %33, %30
ret void
}