#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 findMin(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int arr[] = {4, 5, 6, 7, 1, 2, 3};
  int len = sizeof arr / sizeof arr[0];
  printf("%d\n", findMin(arr, len));
  int arr2[0];
  printf("%d\n", findMin(arr2, 0));
  int arr3[] = {2, 3, 1};
  int len3 = sizeof arr3 / sizeof arr3[0];
  printf("%d\n", findMin(arr3, len3));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec2(%rip),%eax
mov    %eax,-0x8(%rbp)
movl   $0x7,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1040 <findMin@plt>
mov    %eax,%esi
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
call   1040 <findMin@plt>
mov    %eax,%esi
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
mov    0xe82(%rip),%rax
mov    %rax,-0x34(%rbp)
mov    0xe80(%rip),%eax
mov    %eax,-0x2c(%rbp)
movl   $0x3,-0x38(%rbp)
lea    -0x34(%rbp),%rdi
mov    -0x38(%rbp),%esi
call   1040 <findMin@plt>
mov    %eax,%esi
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
movups 0xee0(%rip),%xmm0
movups %xmm0,0x2c(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0x20(%rsp),%rdi
mov    $0x7,%esi
call   1040 <findMin@plt>
lea    0xed5(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
lea    0xc(%rsp),%rdi
xor    %esi,%esi
call   1040 <findMin@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    0xeab(%rip),%eax
mov    %eax,0x18(%rsp)
mov    0xe98(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0x10(%rsp),%rdi
mov    $0x3,%esi
call   1040 <findMin@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.arr = [7 x i32] [i32 4, i32 5, i32 6, i32 7, i32 1, i32 2, i32 3]
@.str = [4 x i8] c"%d\0A\00"
@__const.main.arr3 = [3 x i32] [i32 2, i32 3, i32 1]
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i32]
%3 = alloca i32
%4 = alloca [0 x i32]
%5 = alloca [3 x i32]
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [7 x i32]* %2 to i8*
store i32 7, i32* %3
%8 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%9 = load i32, i32* %3
%10 = call i32 @findMin(i32* %8, i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds [0 x i32], [0 x i32]* %4, i64 0, i64 0
%13 = call i32 @findMin(i32* %12, i32 0)
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = bitcast [3 x i32]* %5 to i8*
store i32 3, i32* %6
%16 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 0
%17 = load i32, i32* %6
%18 = call i32 @findMin(i32* %16, i32 %17)
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [7 x i32] [i32 4, i32 5, i32 6, i32 7, i32 1, i32 2, i32 3]
@.str = [4 x i8] c"%d\0A\00"
@__const.main.arr3 = [3 x i32] [i32 2, i32 3, i32 1]
define i32 @main() {
%1 = alloca [0 x i32]
%2 = alloca [7 x i32]
%3 = alloca [3 x i32]
%4 = bitcast [7 x i32]* %2 to i8*
%5 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%6 = call i32 @findMin(i32* %5, i32 7)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = bitcast [0 x i32]* %1 to i8*
%9 = getelementptr inbounds [0 x i32], [0 x i32]* %1, i64 0, i64 0
%10 = call i32 @findMin(i32* %9, i32 0)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = bitcast [3 x i32]* %3 to i8*
%13 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%14 = call i32 @findMin(i32* %13, i32 3)
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
}