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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int *ref_min(int *, int);
void main() {
  int i = 0;
  int *min = NULL;
  int b[5] = {4, 8, 2, 6, 4};
  min = ref_min(b, 5);
  for (i = 0; i < 5; i++) {
    printf("%d; ", b[i]);
  }
  printf("sizeof { b } = %d;\n", sizeof(b));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    0xec2(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xebf(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xebd(%rip),%eax
mov    %eax,-0x20(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   1040 <ref_min@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0x5,-0x4(%rbp)
jge    119b <main+0x7b>
movslq -0x4(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    116f <main+0x4f>
lea    0xe77(%rip),%rdi
mov    $0x14,%esi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    0xee5(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xeca(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x5,%esi
call   1040 <ref_min@plt>
mov    (%rsp),%esi
lea    0xec3(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xe89(%rip),%rdi
mov    $0x14,%esi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.b = [5 x i32] [i32 4, i32 8, i32 2, i32 6, i32 4]
@.str = [5 x i8] c"%d; \00"
@.str.1 = [20 x i8] c"sizeof { b } = %d;\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [5 x i32]
store i32 0, i32* %1
store i32* null, i32** %2
%4 = bitcast [5 x i32]* %3 to i8*
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%6 = call i32* @ref_min(i32* %5, i32 5)
store i32* %6, i32** %2
store i32 0, i32* %1
br label %7
7: ; preds = %16, %0
%8 = load i32, i32* %1
%9 = icmp slt i32 %8, 5
br i1 %9, label %10, label %19
10: ; preds = %7
%11 = load i32, i32* %1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 %12
%14 = load i32, i32* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %10
%17 = load i32, i32* %1
%18 = add nsw i32 %17, 1
store i32 %18, i32* %1
br label %7
19: ; preds = %7
%20 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 20)
ret void
}

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