#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 atoi(char *);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int money = atoi(argv[1]);
  printf("$20 bills :%d\n", money / 20);
  money %= 20;
  printf("$10 bills :%d\n", money / 10);
  money %= 10;
  printf("$5  bills :%d\n", money / 5);
  money %= 5;
  printf("$1  bills :%d\n", money / 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xe5e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
lea    0xecc(%rip),%rdi
movslq %eax,%r14
imul   $0x66666667,%r14,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x23,%rbx
add    %eax,%ebx
mov    %ebx,%esi
call   1030 <printf@plt>
shl    $0x2,%ebx
lea    (%rbx,%rbx,4),%eax
sub    %eax,%r14d
movsbl %r14b,%eax
imul   $0x67,%eax,%eax
movzwl %ax,%eax
mov    %eax,%ecx
shr    $0xf,%ecx
shr    $0x8,%eax
sar    $0x2,%al
add    %cl,%al
movsbl %al,%ebx
lea    0xe93(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
movzbl %bl,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %al,%r14b
movsbl %r14b,%ebp
imul   $0x67,%ebp,%eax
movzwl %ax,%eax
mov    %eax,%ecx
shr    $0xf,%ecx
shr    $0x8,%eax
sar    %al
add    %cl,%al
movsbl %al,%ebx
lea    0xe70(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
movzbl %bl,%eax
lea    (%rax,%rax,4),%eax
sub    %al,%bpl
movsbl %bpl,%esi
lea    0xe64(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"$20 bills :%d\0A\00"
@.str.1 = [15 x i8] c"$10 bills :%d\0A\00"
@.str.2 = [15 x i8] c"$5 bills :%d\0A\00"
@.str.3 = [15 x i8] c"$1 bills :%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = call i32 @atoi(i8* %9)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = sdiv i32 %11, 20
%13 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %6
%15 = srem i32 %14, 20
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = sdiv i32 %16, 10
%18 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %6
%20 = srem i32 %19, 10
store i32 %20, i32* %6
%21 = load i32, i32* %6
%22 = sdiv i32 %21, 5
%23 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %6
%25 = srem i32 %24, 5
store i32 %25, i32* %6
%26 = load i32, i32* %6
%27 = sdiv i32 %26, 1
%28 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"$20 bills :%d\0A\00"
@.str.1 = [15 x i8] c"$10 bills :%d\0A\00"
@.str.2 = [15 x i8] c"$5 bills :%d\0A\00"
@.str.3 = [15 x i8] c"$1 bills :%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atoi(i8* %4)
%6 = sdiv i32 %5, 20
%7 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = srem i32 %5, 20
%9 = trunc i32 %8 to i8
%10 = sdiv i8 %9, 10
%11 = sext i8 %10 to i32
%12 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = srem i8 %9, 10
%14 = sdiv i8 %13, 5
%15 = sext i8 %14 to i32
%16 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = srem i8 %13, 5
%18 = sext i8 %17 to i32
%19 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %18)
ret i32 0
}