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

/* Variables and functions */
int atoi(char *);
int count_representation_combinations_(int *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (argc != 2) {
    fprintf(stderr, "usage: %s <N>\n", argv[0]);
    return 1;
  }
  int N = atoi(argv[1]);
  if (N <= 0)
    return 1;
  int coin_values[] = {1, 2, 5, 10, 20, 50, 100, 200};
  printf("%d\n",
         count_representation_combinations_(
             coin_values, (sizeof(coin_values) / sizeof((coin_values)[0])) - 1,
             N, NULL));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1188 <main+0x48>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe89(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1204 <main+0xc4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jg     11ae <main+0x6e>
movl   $0x1,-0x4(%rbp)
jmp    1204 <main+0xc4>
mov    0xe6b(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xe68(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe65(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe62(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    $0x7,%esi
xor    %eax,%eax
mov    %eax,%ecx
call   1050 <count_representation_combinations_@plt>
mov    %eax,%esi
lea    0xe17(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
cmp    $0x2,%edi
jne    1191 <main+0x51>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
test   %eax,%eax
jle    11a9 <main+0x69>
movaps 0xed2(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb6(%rip),%xmm0
movaps %xmm0,(%rsp)
xor    %ebx,%ebx
mov    %rsp,%rdi
mov    $0x7,%esi
mov    %eax,%edx
xor    %ecx,%ecx
call   1050 <count_representation_combinations_@plt>
lea    0xe87(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
jmp    11ae <main+0x6e>
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe5c(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [15 x i8] c"usage: %s <N>\0A\00"
@__const.main.coin_values = [8 x i32] [i32 1, i32 2, i32 5, i32 10, i32 20, i32 50, i32 100, i32 200]
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [8 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %14)
store i32 1, i32* %3
br label %30
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @atoi(i8* %19)
store i32 %20, i32* %6
%21 = load i32, i32* %6
%22 = icmp sle i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %16
store i32 1, i32* %3
br label %30
24: ; preds = %16
%25 = bitcast [8 x i32]* %7 to i8*
%26 = getelementptr inbounds [8 x i32], [8 x i32]* %7, i64 0, i64 0
%27 = load i32, i32* %6
%28 = call i32 @count_representation_combinations_(i32* %26, i32 7, i32 %27, i32* null)
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %28)
store i32 0, i32* %3
br label %30
30: ; preds = %24, %23, %10
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [15 x i8] c"usage: %s <N>\0A\00"
@__const.main.coin_values = [8 x i32] [i32 1, i32 2, i32 5, i32 10, i32 20, i32 50, i32 100, i32 200]
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [8 x i32]
%4 = icmp eq i32 %0, 2
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %1
%8 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %19
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = icmp slt i32 %12, 1
br i1 %13, label %19, label %14
14: ; preds = %9
%15 = bitcast [8 x i32]* %3 to i8*
%16 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
%17 = call i32 @count_representation_combinations_(i32* %16, i32 7, i32 %12, i32* null)
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %14, %9, %5
%20 = phi i32 [ 1, %5 ], [ 0, %14 ], [ 1, %9 ]
ret i32 %20
}