#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 coinChange(int *, int, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int coins1[] = {1, 2, 5};
  int coins2[] = {2};
  int coins3[] = {2, 5, 10, 1};
  int coins4[] = {186, 419, 83, 408};
  printf("case 1 : %d\n", coinChange(coins1, 3, 11));
  printf("case 2 : %d\n", coinChange(coins2, 1, 3));
  printf("case 3 : %d\n", coinChange(coins3, 4, 27));
  printf("case 4 : %d\n", coinChange(coins4, 4, 6249));
  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,-0x10(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0xec3(%rip),%eax
mov    %eax,-0x14(%rbp)
mov    0xebd(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xeb4(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0x3,%esi
mov    $0xb,%edx
call   1030 <coinChange@plt>
mov    %eax,%esi
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
lea    -0x14(%rbp),%rdi
mov    $0x1,%esi
mov    $0x3,%edx
call   1030 <coinChange@plt>
mov    %eax,%esi
lea    0xe88(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1b,%edx
call   1030 <coinChange@plt>
mov    %eax,%esi
lea    0xe74(%rip),%rdi
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1869,%edx
call   1030 <coinChange@plt>
mov    %eax,%esi
lea    0xe60(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
mov    0xede(%rip),%eax
mov    %eax,0x18(%rsp)
mov    0xecb(%rip),%rax
mov    %rax,0x10(%rsp)
movl   $0x2,0xc(%rsp)
movaps 0xec7(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xecb(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0x10(%rsp),%rdi
mov    $0x3,%esi
mov    $0xb,%edx
call   1030 <coinChange@plt>
lea    0xebb(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
lea    0xc(%rsp),%rdi
mov    $0x1,%esi
mov    $0x3,%edx
call   1030 <coinChange@plt>
lea    0xea6(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
lea    0x30(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1b,%edx
call   1030 <coinChange@plt>
lea    0xe91(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
lea    0x20(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1869,%edx
call   1030 <coinChange@plt>
lea    0xe7c(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
@__const.main.coins1 = [3 x i32] [i32 1, i32 2, i32 5]
@__const.main.coins2 = [1 x i32] [i32 2]
@__const.main.coins3 = [4 x i32] [i32 2, i32 5, i32 10, i32 1]
@__const.main.coins4 = [4 x i32] [i32 186, i32 419, i32 83, i32 408]
@.str = [13 x i8] c"case 1 : %d\0A\00"
@.str.1 = [13 x i8] c"case 2 : %d\0A\00"
@.str.2 = [13 x i8] c"case 3 : %d\0A\00"
@.str.3 = [13 x i8] c"case 4 : %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = alloca [1 x i32]
%4 = alloca [4 x i32]
%5 = alloca [4 x i32]
store i32 0, i32* %1
%6 = bitcast [3 x i32]* %2 to i8*
%7 = bitcast [1 x i32]* %3 to i8*
%8 = bitcast [4 x i32]* %4 to i8*
%9 = bitcast [4 x i32]* %5 to i8*
%10 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%11 = call i32 @coinChange(i32* %10, i32 3, i32 11)
%12 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = getelementptr inbounds [1 x i32], [1 x i32]* %3, i64 0, i64 0
%14 = call i32 @coinChange(i32* %13, i32 1, i32 3)
%15 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
%17 = call i32 @coinChange(i32* %16, i32 4, i32 27)
%18 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%20 = call i32 @coinChange(i32* %19, i32 4, i32 6249)
%21 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %20)
ret i32 0
}

LLVM IR (-O2):
@__const.main.coins1 = [3 x i32] [i32 1, i32 2, i32 5]
@__const.main.coins3 = [4 x i32] [i32 2, i32 5, i32 10, i32 1]
@__const.main.coins4 = [4 x i32] [i32 186, i32 419, i32 83, i32 408]
@.str = [13 x i8] c"case 1 : %d\0A\00"
@.str.1 = [13 x i8] c"case 2 : %d\0A\00"
@.str.2 = [13 x i8] c"case 3 : %d\0A\00"
@.str.3 = [13 x i8] c"case 4 : %d\0A\00"
define i32 @main() {
%1 = alloca [3 x i32]
%2 = alloca [1 x i32]
%3 = alloca [4 x i32]
%4 = alloca [4 x i32]
%5 = bitcast [3 x i32]* %1 to i8*
%6 = bitcast [1 x i32]* %2 to i8*
%7 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
store i32 2, i32* %7
%8 = bitcast [4 x i32]* %3 to i8*
%9 = bitcast [4 x i32]* %4 to i8*
%10 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%11 = call i32 @coinChange(i32* %10, i32 3, i32 11)
%12 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call i32 @coinChange(i32* %7, i32 1, i32 3)
%14 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%16 = call i32 @coinChange(i32* %15, i32 4, i32 27)
%17 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
%19 = call i32 @coinChange(i32* %18, i32 4, i32 6249)
%20 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %19)
ret i32 0
}