#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 EXIT_SUCCESS;
int /*<<< orphan*/ calculateBillAmount(int, int *, int *, int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ separator(int *);
int main(void) {
  int requestWithdraw, withdrawnBills, billsHundred, billsFifty, billsTwenty,
      billsTen;
  do {
    printf("Input non-negative amount divisible with 10, please: ");
    scanf(" %d", &requestWithdraw);
  } while (requestWithdraw < 0 || requestWithdraw % 10);
  calculateBillAmount(requestWithdraw, &billsHundred, &billsFifty, &billsTwenty,
                      &billsTen);
  withdrawnBills = !!billsHundred + !!billsFifty + !!billsTwenty + !!billsTen;
  printf("You've requested a withdrawal of $%d, we'll give you: ",
         requestWithdraw);
  if (billsHundred) {
    printf("%d hundred dollar %s", billsHundred,
           billsHundred > 1 ? "bills" : "bill");
    separator(&withdrawnBills);
  }
  if (billsFifty) {
    printf("%d fifty dollar %s", billsFifty, billsFifty > 1 ? "bills" : "bill");
    separator(&withdrawnBills);
  }
  if (billsTwenty) {
    printf("%d twenty dollar %s", billsTwenty,
           billsTwenty > 1 ? "bills" : "bill");
    separator(&withdrawnBills);
  }
  if (billsTen) {
    printf("%d ten dollar %s", billsTen, billsTen > 1 ? "bills" : "bill");
    separator(&withdrawnBills);
  } else {
    printf("No dolla dolla bills y'all!\n");
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x1d(%rbp)
jl     1190 <main+0x50>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    114f <main+0xf>
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
call   1040 <calculateBillAmount@plt>
cmpl   $0x0,-0x10(%rbp)
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
cmpl   $0x0,-0x14(%rbp)
setne  %cl
xor    $0xff,%cl
xor    $0xff,%cl
and    $0x1,%cl
movzbl %cl,%ecx
add    %ecx,%eax
cmpl   $0x0,-0x18(%rbp)
setne  %cl
xor    $0xff,%cl
xor    $0xff,%cl
and    $0x1,%cl
movzbl %cl,%ecx
add    %ecx,%eax
cmpl   $0x0,-0x1c(%rbp)
setne  %cl
xor    $0xff,%cl
xor    $0xff,%cl
and    $0x1,%cl
movzbl %cl,%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x10(%rbp)
je     1252 <main+0x112>
mov    -0x10(%rbp),%esi
mov    -0x10(%rbp),%ecx
lea    0xe5f(%rip),%rdx
lea    0xe52(%rip),%rax
cmp    $0x1,%ecx
cmovg  %rax,%rdx
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xc(%rbp),%rdi
call   1060 <separator@plt>
cmpl   $0x0,-0x14(%rbp)
je     128e <main+0x14e>
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%ecx
lea    0xe23(%rip),%rdx
lea    0xe16(%rip),%rax
cmp    $0x1,%ecx
cmovg  %rax,%rdx
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xc(%rbp),%rdi
call   1060 <separator@plt>
cmpl   $0x0,-0x18(%rbp)
je     12ca <main+0x18a>
mov    -0x18(%rbp),%esi
mov    -0x18(%rbp),%ecx
lea    0xde7(%rip),%rdx
lea    0xdda(%rip),%rax
cmp    $0x1,%ecx
cmovg  %rax,%rdx
lea    0xdea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xc(%rbp),%rdi
call   1060 <separator@plt>
cmpl   $0x0,-0x1c(%rbp)
je     130b <main+0x1cb>
mov    -0x1c(%rbp),%esi
mov    -0x1c(%rbp),%ecx
lea    0xdab(%rip),%rdx
lea    0xd9e(%rip),%rax
cmp    $0x1,%ecx
cmovg  %rax,%rdx
lea    0xdc2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xc(%rbp),%rdi
call   1060 <separator@plt>
jmp    1319 <main+0x1d9>
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2cc0(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
lea    0xea0(%rip),%r14
lea    0xecf(%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   1060 <scanf@plt>
movslq 0x1c(%rsp),%rdi
imul   $0x66666667,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%ecx
mov    %edi,%eax
sub    %ecx,%eax
test   %rdi,%rdi
js     1170 <main+0x20>
test   %eax,%eax
jne    1170 <main+0x20>
lea    0x18(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
call   1050 <calculateBillAmount@plt>
xor    %eax,%eax
cmpl   $0x0,0x14(%rsp)
setne  %al
cmpl   $0x1,0x18(%rsp)
sbb    $0xffffffff,%eax
cmpl   $0x1,0x10(%rsp)
sbb    $0xffffffff,%eax
cmpl   $0x1,0xc(%rsp)
sbb    $0xffffffff,%eax
mov    %eax,0x8(%rsp)
mov    0x1c(%rsp),%esi
lea    0xe40(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%esi
test   %esi,%esi
je     1236 <main+0xe6>
cmp    $0x2,%esi
lea    0xe73(%rip),%rax
lea    0xe72(%rip),%rdx
cmovge %rax,%rdx
lea    0xe4c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rdi
call   1070 <separator@plt>
mov    0x14(%rsp),%esi
test   %esi,%esi
je     126b <main+0x11b>
cmp    $0x2,%esi
lea    0xe3e(%rip),%rax
lea    0xe3d(%rip),%rdx
cmovge %rax,%rdx
lea    0xe37(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rdi
call   1070 <separator@plt>
mov    0x10(%rsp),%esi
test   %esi,%esi
je     12a0 <main+0x150>
cmp    $0x2,%esi
lea    0xe09(%rip),%rax
lea    0xe08(%rip),%rdx
cmovge %rax,%rdx
lea    0xe15(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rdi
call   1070 <separator@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
je     12d7 <main+0x187>
cmp    $0x2,%esi
lea    0xdd4(%rip),%rax
lea    0xdd3(%rip),%rdx
cmovge %rax,%rdx
lea    0xdf4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rdi
call   1070 <separator@plt>
jmp    12e3 <main+0x193>
lea    0xdeb(%rip),%rdi
call   1030 <puts@plt>
mov    0x2cf6(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [54 x i8] c"Input non-negative amount divisible with 10, please: \00"
@.str.1 = [4 x i8] c" %d\00"
@.str.2 = [55 x i8] c"You've requested a withdrawal of $%d, we'll give you: \00"
@.str.3 = [21 x i8] c"%d hundred dollar %s\00"
@.str.4 = [6 x i8] c"bills\00"
@.str.5 = [5 x i8] c"bill\00"
@.str.6 = [19 x i8] c"%d fifty dollar %s\00"
@.str.7 = [20 x i8] c"%d twenty dollar %s\00"
@.str.8 = [17 x i8] c"%d ten dollar %s\00"
@.str.9 = [29 x i8] c"No dolla dolla bills y'all!\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
br label %8
8: ; preds = %18, %0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %11
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %11
%15 = load i32, i32* %2
%16 = srem i32 %15, 10
%17 = icmp ne i32 %16, 0
br label %18
18: ; preds = %14, %11
%19 = phi i1 [ true, %11 ], [ %17, %14 ]
br i1 %19, label %8, label %20
20: ; preds = %18
%21 = load i32, i32* %2
%22 = call i32 @calculateBillAmount(i32 %21, i32* %4, i32* %5, i32* %6, i32* %7)
%23 = load i32, i32* %4
%24 = icmp ne i32 %23, 0
%25 = xor i1 %24, true
%26 = xor i1 %25, true
%27 = zext i1 %26 to i32
%28 = load i32, i32* %5
%29 = icmp ne i32 %28, 0
%30 = xor i1 %29, true
%31 = xor i1 %30, true
%32 = zext i1 %31 to i32
%33 = add nsw i32 %27, %32
%34 = load i32, i32* %6
%35 = icmp ne i32 %34, 0
%36 = xor i1 %35, true
%37 = xor i1 %36, true
%38 = zext i1 %37 to i32
%39 = add nsw i32 %33, %38
%40 = load i32, i32* %7
%41 = icmp ne i32 %40, 0
%42 = xor i1 %41, true
%43 = xor i1 %42, true
%44 = zext i1 %43 to i32
%45 = add nsw i32 %39, %44
store i32 %45, i32* %3
%46 = load i32, i32* %2
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0), i32 %46)
%48 = load i32, i32* %4
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %58
50: ; preds = %20
%51 = load i32, i32* %4
%52 = load i32, i32* %4
%53 = icmp sgt i32 %52, 1
%54 = zext i1 %53 to i64
%55 = select i1 %53, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %51, i8* %55)
%57 = call i32 @separator(i32* %3)
br label %58
58: ; preds = %50, %20
%59 = load i32, i32* %5
%60 = icmp ne i32 %59, 0
br i1 %60, label %61, label %69
61: ; preds = %58
%62 = load i32, i32* %5
%63 = load i32, i32* %5
%64 = icmp sgt i32 %63, 1
%65 = zext i1 %64 to i64
%66 = select i1 %64, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32 %62, i8* %66)
%68 = call i32 @separator(i32* %3)
br label %69
69: ; preds = %61, %58
%70 = load i32, i32* %6
%71 = icmp ne i32 %70, 0
br i1 %71, label %72, label %80
72: ; preds = %69
%73 = load i32, i32* %6
%74 = load i32, i32* %6
%75 = icmp sgt i32 %74, 1
%76 = zext i1 %75 to i64
%77 = select i1 %75, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i32 %73, i8* %77)
%79 = call i32 @separator(i32* %3)
br label %80
80: ; preds = %72, %69
%81 = load i32, i32* %7
%82 = icmp ne i32 %81, 0
br i1 %82, label %83, label %91
83: ; preds = %80
%84 = load i32, i32* %7
%85 = load i32, i32* %7
%86 = icmp sgt i32 %85, 1
%87 = zext i1 %86 to i64
%88 = select i1 %86, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i32 %84, i8* %88)
%90 = call i32 @separator(i32* %3)
br label %93
91: ; preds = %80
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0))
br label %93
93: ; preds = %91, %83
%94 = load i32, i32* @EXIT_SUCCESS
ret i32 %94
}

LLVM IR (-O2):
@.str = [54 x i8] c"Input non-negative amount divisible with 10, please: \00"
@.str.1 = [4 x i8] c" %d\00"
@.str.2 = [55 x i8] c"You've requested a withdrawal of $%d, we'll give you: \00"
@.str.3 = [21 x i8] c"%d hundred dollar %s\00"
@.str.4 = [6 x i8] c"bills\00"
@.str.5 = [5 x i8] c"bill\00"
@.str.6 = [19 x i8] c"%d fifty dollar %s\00"
@.str.7 = [20 x i8] c"%d twenty dollar %s\00"
@.str.8 = [17 x i8] c"%d ten dollar %s\00"
@EXIT_SUCCESS = global i32 0
@str = [28 x i8] c"No dolla dolla bills y'all!\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*
%8 = bitcast i32* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
br label %13
13: ; preds = %13, %0
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%16 = load i32, i32* %1
%17 = icmp sgt i32 %16, -1
%18 = srem i32 %16, 10
%19 = icmp eq i32 %18, 0
%20 = and i1 %17, %19
br i1 %20, label %21, label %13
21: ; preds = %13
%22 = call i32 @calculateBillAmount(i32 %16, i32* %3, i32* %4, i32* %5, i32* %6)
%23 = load i32, i32* %3
%24 = icmp ne i32 %23, 0
%25 = zext i1 %24 to i32
%26 = load i32, i32* %4
%27 = icmp ne i32 %26, 0
%28 = zext i1 %27 to i32
%29 = add nuw nsw i32 %28, %25
%30 = load i32, i32* %5
%31 = icmp ne i32 %30, 0
%32 = zext i1 %31 to i32
%33 = add nuw nsw i32 %29, %32
%34 = load i32, i32* %6
%35 = icmp ne i32 %34, 0
%36 = zext i1 %35 to i32
%37 = add nuw nsw i32 %33, %36
store i32 %37, i32* %2
%38 = load i32, i32* %1
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %3
%41 = icmp eq i32 %40, 0
br i1 %41, label %47, label %42
42: ; preds = %21
%43 = icmp sgt i32 %40, 1
%44 = select i1 %43, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %40, i8* %44)
%46 = call i32 @separator(i32* %2)
br label %47
47: ; preds = %42, %21
%48 = load i32, i32* %4
%49 = icmp eq i32 %48, 0
br i1 %49, label %55, label %50
50: ; preds = %47
%51 = icmp sgt i32 %48, 1
%52 = select i1 %51, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32 %48, i8* %52)
%54 = call i32 @separator(i32* %2)
br label %55
55: ; preds = %50, %47
%56 = load i32, i32* %5
%57 = icmp eq i32 %56, 0
br i1 %57, label %63, label %58
58: ; preds = %55
%59 = icmp sgt i32 %56, 1
%60 = select i1 %59, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i32 %56, i8* %60)
%62 = call i32 @separator(i32* %2)
br label %63
63: ; preds = %58, %55
%64 = load i32, i32* %6
%65 = icmp eq i32 %64, 0
br i1 %65, label %71, label %66
66: ; preds = %63
%67 = icmp sgt i32 %64, 1
%68 = select i1 %67, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i32 %64, i8* %68)
%70 = call i32 @separator(i32* %2)
br label %73
71: ; preds = %63
%72 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %73
73: ; preds = %71, %66
%74 = load i32, i32* @EXIT_SUCCESS
ret i32 %74
}