#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 /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ test_arbitrary_two();
int /*<<< orphan*/ test_canonical_many();
int /*<<< orphan*/ test_canonical_one();
int /*<<< orphan*/ test_canonical_three();
int /*<<< orphan*/ test_canonical_two();
int /*<<< orphan*/ test_negative();
int /*<<< orphan*/ test_none();
int /*<<< orphan*/ test_zero();
int main() {
  int counter = 0;
  if (!test_negative()) {
    printf("Negative amount test failed!\n");
    counter++;
  }
  if (!test_zero()) {
    printf("Zero amount test failed!\n");
    counter++;
  }
  if (!test_canonical_one()) {
    printf("One coin canonical test failed!\n");
    counter++;
  }
  if (!test_canonical_two()) {
    printf("Two coins canonical test failed!\n");
    counter++;
  }
  if (!test_canonical_three()) {
    printf("Three coins canonical test failed!\n");
    counter++;
  }
  if (!test_canonical_many()) {
    printf("Many coins canonical test failed!\n");
    counter++;
  }
  if (!test_arbitrary_two()) {
    printf("Two coins arbitrary test failed!\n");
    counter++;
  }
  if (!test_none()) {
    printf("No coin test failed!\n");
    counter++;
  }
  printf("%d tests failed.\n", counter);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <test_negative@plt>
cmp    $0x0,%eax
jne    11cd <main+0x3d>
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   10b0 <test_zero@plt>
cmp    $0x0,%eax
jne    11f4 <main+0x64>
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   10a0 <test_canonical_one@plt>
cmp    $0x0,%eax
jne    121b <main+0x8b>
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1070 <test_canonical_two@plt>
cmp    $0x0,%eax
jne    1242 <main+0xb2>
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1090 <test_canonical_three@plt>
cmp    $0x0,%eax
jne    1269 <main+0xd9>
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <test_canonical_many@plt>
cmp    $0x0,%eax
jne    1290 <main+0x100>
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1060 <test_arbitrary_two@plt>
cmp    $0x0,%eax
jne    12b7 <main+0x127>
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1080 <test_none@plt>
cmp    $0x0,%eax
jne    12de <main+0x14e>
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <test_negative@plt>
test   %eax,%eax
jne    11bf <main+0x1f>
lea    0xe5d(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%ebx
xor    %eax,%eax
call   10c0 <test_zero@plt>
test   %eax,%eax
jne    11d9 <main+0x39>
lea    0xe5e(%rip),%rdi
call   1050 <puts@plt>
add    $0x1,%ebx
xor    %eax,%eax
call   10b0 <test_canonical_one@plt>
test   %eax,%eax
jne    11f3 <main+0x53>
lea    0xe5d(%rip),%rdi
call   1050 <puts@plt>
add    $0x1,%ebx
xor    %eax,%eax
call   1080 <test_canonical_two@plt>
test   %eax,%eax
jne    120d <main+0x6d>
lea    0xe63(%rip),%rdi
call   1050 <puts@plt>
add    $0x1,%ebx
xor    %eax,%eax
call   10a0 <test_canonical_three@plt>
test   %eax,%eax
jne    1227 <main+0x87>
lea    0xe6a(%rip),%rdi
call   1050 <puts@plt>
add    $0x1,%ebx
xor    %eax,%eax
call   1030 <test_canonical_many@plt>
test   %eax,%eax
jne    1241 <main+0xa1>
lea    0xe73(%rip),%rdi
call   1050 <puts@plt>
add    $0x1,%ebx
xor    %eax,%eax
call   1070 <test_arbitrary_two@plt>
test   %eax,%eax
jne    125b <main+0xbb>
lea    0xe7b(%rip),%rdi
call   1050 <puts@plt>
add    $0x1,%ebx
xor    %eax,%eax
call   1090 <test_none@plt>
test   %eax,%eax
jne    1275 <main+0xd5>
lea    0xe82(%rip),%rdi
call   1050 <puts@plt>
add    $0x1,%ebx
lea    0xd84(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Negative amount test failed!\0A\00"
@.str.1 = [26 x i8] c"Zero amount test failed!\0A\00"
@.str.2 = [33 x i8] c"One coin canonical test failed!\0A\00"
@.str.3 = [34 x i8] c"Two coins canonical test failed!\0A\00"
@.str.4 = [36 x i8] c"Three coins canonical test failed!\0A\00"
@.str.5 = [35 x i8] c"Many coins canonical test failed!\0A\00"
@.str.6 = [34 x i8] c"Two coins arbitrary test failed!\0A\00"
@.str.7 = [22 x i8] c"No coin test failed!\0A\00"
@.str.8 = [18 x i8] c"%d tests failed.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 (...) @test_negative()
%4 = icmp ne i32 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %0
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 1
store i32 %8, i32* %2
br label %9
9: ; preds = %5, %0
%10 = call i32 (...) @test_zero()
%11 = icmp ne i32 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %9
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %16
16: ; preds = %12, %9
%17 = call i32 (...) @test_canonical_one()
%18 = icmp ne i32 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %16
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 1
store i32 %22, i32* %2
br label %23
23: ; preds = %19, %16
%24 = call i32 (...) @test_canonical_two()
%25 = icmp ne i32 %24, 0
br i1 %25, label %30, label %26
26: ; preds = %23
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%28 = load i32, i32* %2
%29 = add nsw i32 %28, 1
store i32 %29, i32* %2
br label %30
30: ; preds = %26, %23
%31 = call i32 (...) @test_canonical_three()
%32 = icmp ne i32 %31, 0
br i1 %32, label %37, label %33
33: ; preds = %30
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%35 = load i32, i32* %2
%36 = add nsw i32 %35, 1
store i32 %36, i32* %2
br label %37
37: ; preds = %33, %30
%38 = call i32 (...) @test_canonical_many()
%39 = icmp ne i32 %38, 0
br i1 %39, label %44, label %40
40: ; preds = %37
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
%42 = load i32, i32* %2
%43 = add nsw i32 %42, 1
store i32 %43, i32* %2
br label %44
44: ; preds = %40, %37
%45 = call i32 (...) @test_arbitrary_two()
%46 = icmp ne i32 %45, 0
br i1 %46, label %51, label %47
47: ; preds = %44
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
%49 = load i32, i32* %2
%50 = add nsw i32 %49, 1
store i32 %50, i32* %2
br label %51
51: ; preds = %47, %44
%52 = call i32 (...) @test_none()
%53 = icmp ne i32 %52, 0
br i1 %53, label %58, label %54
54: ; preds = %51
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0))
%56 = load i32, i32* %2
%57 = add nsw i32 %56, 1
store i32 %57, i32* %2
br label %58
58: ; preds = %54, %51
%59 = load i32, i32* %2
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), i32 %59)
%61 = load i32, i32* %1
ret i32 %61
}

LLVM IR (-O2):
@.str.8 = [18 x i8] c"%d tests failed.\0A\00"
@str = [29 x i8] c"Negative amount test failed!\00"
@str.9 = [25 x i8] c"Zero amount test failed!\00"
@str.10 = [32 x i8] c"One coin canonical test failed!\00"
@str.11 = [33 x i8] c"Two coins canonical test failed!\00"
@str.12 = [35 x i8] c"Three coins canonical test failed!\00"
@str.13 = [34 x i8] c"Many coins canonical test failed!\00"
@str.14 = [33 x i8] c"Two coins arbitrary test failed!\00"
@str.15 = [21 x i8] c"No coin test failed!\00"
define i32 @main() {
%1 = tail call i32 (...) @test_negative()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = phi i32 [ 0, %0 ], [ 1, %3 ]
%7 = tail call i32 (...) @test_zero()
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.9, i64 0, i64 0))
%11 = add nuw nsw i32 %6, 1
br label %12
12: ; preds = %9, %5
%13 = phi i32 [ %6, %5 ], [ %11, %9 ]
%14 = tail call i32 (...) @test_canonical_one()
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.10, i64 0, i64 0))
%18 = add nuw nsw i32 %13, 1
br label %19
19: ; preds = %16, %12
%20 = phi i32 [ %13, %12 ], [ %18, %16 ]
%21 = tail call i32 (...) @test_canonical_two()
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.11, i64 0, i64 0))
%25 = add nuw nsw i32 %20, 1
br label %26
26: ; preds = %23, %19
%27 = phi i32 [ %20, %19 ], [ %25, %23 ]
%28 = tail call i32 (...) @test_canonical_three()
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %26
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.12, i64 0, i64 0))
%32 = add nuw nsw i32 %27, 1
br label %33
33: ; preds = %30, %26
%34 = phi i32 [ %27, %26 ], [ %32, %30 ]
%35 = tail call i32 (...) @test_canonical_many()
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %40
37: ; preds = %33
%38 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.13, i64 0, i64 0))
%39 = add nuw nsw i32 %34, 1
br label %40
40: ; preds = %37, %33
%41 = phi i32 [ %34, %33 ], [ %39, %37 ]
%42 = tail call i32 (...) @test_arbitrary_two()
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %40
%45 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.14, i64 0, i64 0))
%46 = add nuw nsw i32 %41, 1
br label %47
47: ; preds = %44, %40
%48 = phi i32 [ %41, %40 ], [ %46, %44 ]
%49 = tail call i32 (...) @test_none()
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %47
%52 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.15, i64 0, i64 0))
%53 = add nuw nsw i32 %48, 1
br label %54
54: ; preds = %51, %47
%55 = phi i32 [ %48, %47 ], [ %53, %51 ]
%56 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), i32 %55)
ret i32 0
}