#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*/ pay_amount(int, int *, int *, int *, int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int dollar_amount = -1;
  int a = 0, b = 0, c = 0, d = 0, e = 0;
  int *twenties = &a, *tens = &b, *fives = &c, *toonies = &d, *loonie = &e;
  while (dollar_amount < 0) {
    printf("Please enter a positive integer for the dollar amount:");
    scanf("%d", &dollar_amount);
  }
  pay_amount(dollar_amount, twenties, tens, fives, toonies, loonie);
  printf("Number of...\n Twenties: %d \n Tens: %d \n Fives: %d \n Toonies: %d "
         "\n Loonies: %d\n",
         a, b, c, d, e);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0x1c(%rbp),%rax
mov    %rax,-0x48(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    11be <main+0x8e>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe87(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
jmp    1191 <main+0x61>
mov    -0x8(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    -0x40(%rbp),%r8
mov    -0x48(%rbp),%r9
call   1030 <pay_amount@plt>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movl   $0xffffffff,0x1c(%rsp)
ff
movl   $0x0,0x18(%rsp)
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0xe90(%rip),%r14
lea    0xec0(%rip),%r15
lea    0x1c(%rsp),%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0x1c(%rsp),%edi
test   %edi,%edi
js     1180 <main+0x50>
lea    0x18(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
lea    0x8(%rsp),%r9
call   1030 <pay_amount@plt>
mov    0x18(%rsp),%esi
mov    0x14(%rsp),%edx
mov    0x10(%rsp),%ecx
mov    0xc(%rsp),%r8d
mov    0x8(%rsp),%r9d
lea    0xe62(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [55 x i8] c"Please enter a positive integer for the dollar amount:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [79 x i8] c"Number of...\0A Twenties: %d \0A Tens: %d \0A Fives: %d \0A Toonies: %d \0A Loonies: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
store i32 0, i32* %1
store i32 -1, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32* %3, i32** %8
store i32* %4, i32** %9
store i32* %5, i32** %10
store i32* %6, i32** %11
store i32* %7, i32** %12
br label %13
13: ; preds = %16, %0
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %13
19: ; preds = %13
%20 = load i32, i32* %2
%21 = load i32*, i32** %8
%22 = load i32*, i32** %9
%23 = load i32*, i32** %10
%24 = load i32*, i32** %11
%25 = load i32*, i32** %12
%26 = call i32 @pay_amount(i32 %20, i32* %21, i32* %22, i32* %23, i32* %24, i32* %25)
%27 = load i32, i32* %3
%28 = load i32, i32* %4
%29 = load i32, i32* %5
%30 = load i32, i32* %6
%31 = load i32, i32* %7
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.2, i64 0, i64 0), i32 %27, i32 %28, i32 %29, i32 %30, i32 %31)
ret i32 0
}

LLVM IR (-O2):
@.str = [55 x i8] c"Please enter a positive integer for the dollar amount:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [79 x i8] c"Number of...\0A Twenties: %d \0A Tens: %d \0A Fives: %d \0A Toonies: %d \0A Loonies: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %1 to i8*
store i32 -1, i32* %1
%8 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%9 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%10 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%11 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%12 = bitcast i32* %6 to i8*
store i32 0, i32* %6
br label %13
13: ; preds = %0, %13
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%16 = load i32, i32* %1
%17 = icmp slt i32 %16, 0
br i1 %17, label %13, label %18
18: ; preds = %13
%19 = call i32 @pay_amount(i32 %16, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6)
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = load i32, i32* %6
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([79 x i8], [79 x i8]* @.str.2, i64 0, i64 0), i32 %20, i32 %21, i32 %22, i32 %23, i32 %24)
ret i32 0
}