#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*/ scanf(char *, ...);
int main(void) {
  int order, change, money;
  char name[100];
  scanf("%d", &order);
  scanf(" %[^\n]", name);
  scanf("%d", &change);
  scanf("%d", &money);
  int cost = money - change;
  int a = cost / 500, b = (cost % 500) / 100, c = ((cost % 500) % 100) / 50,
      d = (((cost % 500) % 100) % 50) / 10,
      e = ((((cost % 500) % 100) % 50) % 10) / 5,
      f = (((((cost % 500) % 100) % 50) % 10) % 5) / 1;
  printf("                              Transaction ID: %03d\n", order);
  printf("- %s -\n", name);
  printf("Change: %d\n", money - change);
  printf("+-----------------------------------------------+\n");
  printf("| Coin\\Bank |    1|    5|   10|   50|  100|  500|\n");
  printf("+-----------------------------------------------+\n");
  printf("| Number    |    %d|    %d|    %d|    %d|    %d|    %d|\n", f, e, d,
         c, b, a);
  printf("+-----------------------------------------------+\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
lea    0xece(%rip),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    -0x70(%rbp),%rsi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe98(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%eax
mov    $0x1f4,%ecx
cltd
idiv   %ecx
mov    %eax,-0x78(%rbp)
mov    -0x74(%rbp),%eax
mov    $0x1f4,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x7c(%rbp)
mov    -0x74(%rbp),%eax
mov    $0x1f4,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x32,%ecx
cltd
idiv   %ecx
mov    %eax,-0x80(%rbp)
mov    -0x74(%rbp),%eax
mov    $0x1f4,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x32,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x84(%rbp)
mov    -0x74(%rbp),%eax
mov    $0x1f4,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x32,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,-0x88(%rbp)
mov    -0x74(%rbp),%eax
mov    $0x1f4,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x32,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8c(%rbp)
mov    -0x4(%rbp),%esi
lea    0xd91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
sub    -0x8(%rbp),%esi
lea    0xda7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xda5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8c(%rbp),%esi
mov    -0x88(%rbp),%edx
mov    -0x84(%rbp),%ecx
mov    -0x80(%rbp),%r8d
mov    -0x7c(%rbp),%r9d
mov    -0x78(%rbp),%eax
lea    0xdc4(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
lea    0xeb8(%rip),%rbx
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xea5(%rip),%rdi
lea    0x20(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x10(%rsp),%eax
sub    0x14(%rsp),%eax
cltq
imul   $0x10624dd3,%rax,%r15
mov    %r15,%rcx
shr    $0x3f,%rcx
sar    $0x25,%r15
add    %ecx,%r15d
imul   $0x1f4,%r15d,%ecx
sub    %ecx,%eax
movswl %ax,%ecx
imul   $0x147b,%ecx,%ebp
mov    %ebp,%ecx
shr    $0x1f,%ecx
sar    $0x13,%ebp
add    %ecx,%ebp
imul   $0x64,%ebp,%ecx
sub    %ecx,%eax
movsbl %al,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,8),%ecx
movzwl %cx,%ecx
movswl %cx,%edx
shr    $0xf,%ecx
shr    $0xb,%edx
add    %cl,%dl
movsbl %dl,%ecx
mov    %ecx,0x18(%rsp)
movzbl %cl,%ecx
imul   $0x32,%ecx,%ecx
sub    %cl,%al
movsbl %al,%eax
imul   $0x67,%eax,%ecx
movzwl %cx,%edx
shr    $0xa,%ecx
shr    $0xf,%edx
add    %cl,%dl
movsbl %dl,%r12d
movzbl %r12b,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%al
movsbl %al,%eax
imul   $0x67,%eax,%ecx
movzwl %cx,%edx
shr    $0x9,%ecx
shr    $0xf,%edx
add    %cl,%dl
movsbl %dl,%r14d
movzbl %r14b,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%al
movsbl %al,%r13d
mov    0x1c(%rsp),%esi
lea    0xdcf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdf5(%rip),%rdi
lea    0x20(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
sub    0x14(%rsp),%esi
lea    0xde2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe4b(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe0a(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r15d,(%rsp)
lea    0xdb9(%rip),%rdi
mov    %r13d,%esi
mov    %r14d,%edx
mov    %r12d,%ecx
mov    0x18(%rsp),%r8d
mov    %ebp,%r9d
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c" %[^\0A]\00"
@.str.2 = [52 x i8] c" Transaction ID: %03d\0A\00"
@.str.3 = [8 x i8] c"- %s -\0A\00"
@.str.4 = [12 x i8] c"Change: %d\0A\00"
@.str.5 = [51 x i8] c"+-----------------------------------------------+\0A\00"
@.str.6 = [51 x i8] c"| Coin\\Bank | 1| 5| 10| 50| 100| 500|\0A\00"
@.str.7 = [57 x i8] c"| Number | %d| %d| %d| %d| %d| %d|\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [100 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%17 = load i32, i32* %3
%18 = load i32, i32* %2
%19 = sub nsw i32 %17, %18
store i32 %19, i32* %5
%20 = load i32, i32* %5
%21 = sdiv i32 %20, 500
store i32 %21, i32* %6
%22 = load i32, i32* %5
%23 = srem i32 %22, 500
%24 = sdiv i32 %23, 100
store i32 %24, i32* %7
%25 = load i32, i32* %5
%26 = srem i32 %25, 500
%27 = srem i32 %26, 100
%28 = sdiv i32 %27, 50
store i32 %28, i32* %8
%29 = load i32, i32* %5
%30 = srem i32 %29, 500
%31 = srem i32 %30, 100
%32 = srem i32 %31, 50
%33 = sdiv i32 %32, 10
store i32 %33, i32* %9
%34 = load i32, i32* %5
%35 = srem i32 %34, 500
%36 = srem i32 %35, 100
%37 = srem i32 %36, 50
%38 = srem i32 %37, 10
%39 = sdiv i32 %38, 5
store i32 %39, i32* %10
%40 = load i32, i32* %5
%41 = srem i32 %40, 500
%42 = srem i32 %41, 100
%43 = srem i32 %42, 50
%44 = srem i32 %43, 10
%45 = srem i32 %44, 5
%46 = sdiv i32 %45, 1
store i32 %46, i32* %11
%47 = load i32, i32* %1
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), i32 %47)
%49 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %49)
%51 = load i32, i32* %3
%52 = load i32, i32* %2
%53 = sub nsw i32 %51, %52
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %53)
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0))
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.6, i64 0, i64 0))
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0))
%58 = load i32, i32* %11
%59 = load i32, i32* %10
%60 = load i32, i32* %9
%61 = load i32, i32* %8
%62 = load i32, i32* %7
%63 = load i32, i32* %6
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.7, i64 0, i64 0), i32 %58, i32 %59, i32 %60, i32 %61, i32 %62, i32 %63)
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c" %[^\0A]\00"
@.str.2 = [52 x i8] c" Transaction ID: %03d\0A\00"
@.str.3 = [8 x i8] c"- %s -\0A\00"
@.str.4 = [12 x i8] c"Change: %d\0A\00"
@.str.7 = [57 x i8] c"| Number | %d| %d| %d| %d| %d| %d|\0A\00"
@str.8 = [50 x i8] c"| Coin\\Bank | 1| 5| 10| 50| 100| 500|\00"
@str.10 = [50 x i8] c"+-----------------------------------------------+\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [100 x i8]
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = sub nsw i32 %13, %14
%16 = sdiv i32 %15, 500
%17 = srem i32 %15, 500
%18 = trunc i32 %17 to i16
%19 = sdiv i16 %18, 100
%20 = sext i16 %19 to i32
%21 = srem i16 %18, 100
%22 = trunc i16 %21 to i8
%23 = sdiv i8 %22, 50
%24 = sext i8 %23 to i32
%25 = srem i8 %22, 50
%26 = sdiv i8 %25, 10
%27 = sext i8 %26 to i32
%28 = srem i8 %25, 10
%29 = sdiv i8 %28, 5
%30 = sext i8 %29 to i32
%31 = srem i8 %28, 5
%32 = sext i8 %31 to i32
%33 = load i32, i32* %1
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), i32 %33)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%36 = load i32, i32* %3
%37 = load i32, i32* %2
%38 = sub nsw i32 %36, %37
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %38)
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.10, i64 0, i64 0))
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.8, i64 0, i64 0))
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.10, i64 0, i64 0))
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.7, i64 0, i64 0), i32 %32, i32 %30, i32 %27, i32 %24, i32 %20, i32 %16)
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.10, i64 0, i64 0))
ret i32 0
}