#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*/ arr3;
typedef int /*<<< orphan*/ arr2;
typedef int /*<<< orphan*/ arr;

/* Variables and functions */
int find_min(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int arr[] = {5, 6, 7, 8, 9, 10, 1, 2, 3, 4};
  int size = sizeof(arr) / sizeof(arr[0]);
  printf("min index = %d\n", find_min(arr, size));
  int arr2[] = {1, 2, 3, 4};
  int size2 = sizeof(arr2) / sizeof(arr2[0]);
  printf("min index = %d\n", find_min(arr2, size2));
  int arr3[] = {2, 1};
  int size3 = sizeof(arr3) / sizeof(arr3[0]);
  printf("min index = %d\n", find_min(arr3, size3));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x30(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
movl   $0xa,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1050 <find_min@plt>
mov    %eax,%esi
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
mov    0xecb(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xec8(%rip),%rax
mov    %rax,-0x48(%rbp)
movl   $0x4,-0x54(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x54(%rbp),%esi
call   1050 <find_min@plt>
mov    %eax,%esi
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
mov    0xea4(%rip),%rax
mov    %rax,-0x5c(%rbp)
movl   $0x2,-0x60(%rbp)
lea    -0x5c(%rbp),%rdi
mov    -0x60(%rbp),%esi
call   1050 <find_min@plt>
mov    %eax,%esi
lea    0xe5c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
mov    0xef4(%rip),%rax
mov    %rax,0x40(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xebc(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0x20(%rsp),%rdi
mov    $0xa,%esi
call   1040 <find_min@plt>
lea    0xec9(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
movaps 0xed0(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x10(%rsp),%rdi
mov    $0x4,%esi
call   1040 <find_min@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
movabs $0x100000002,%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
mov    $0x2,%esi
call   1040 <find_min@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

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

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