#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 */
scalar_t__ calculation(int, int *, int *, int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int print(int input, int a_hundred, int a_fifty, int a_twenty, int a_ten) {
  if (calculation(input, &a_hundred, &a_fifty, &a_twenty, &a_ten) == 0)
    printf("\nThe entered amount is invalid \n");
  else {
    printf("\nThe withdrawn bills is following\n");
    if (a_hundred > 0)
      printf("%d x %d$\n", a_hundred, 100);
    if (a_fifty > 0)
      printf("%d x %d$\n", a_fifty, 50);
    if (a_twenty > 0)
      printf("%d x %d$\n", a_twenty, 20);
    if (a_ten > 0)
      printf("%d x %d$\n", a_ten, 10);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x8(%rbp),%edi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
lea    -0x18(%rbp),%r8
call   1030 <calculation@plt>
cmp    $0x0,%rax
jne    116d <print+0x4d>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1200 <print+0xe0>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
jle    119b <print+0x7b>
mov    -0xc(%rbp),%esi
lea    0xeb5(%rip),%rdi
mov    $0x64,%edx
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x10(%rbp)
jle    11bb <print+0x9b>
mov    -0x10(%rbp),%esi
lea    0xe95(%rip),%rdi
mov    $0x32,%edx
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x14(%rbp)
jle    11db <print+0xbb>
mov    -0x14(%rbp),%esi
lea    0xe75(%rip),%rdi
mov    $0x14,%edx
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x18(%rbp)
jle    11fb <print+0xdb>
mov    -0x18(%rbp),%esi
lea    0xe55(%rip),%rdi
mov    $0xa,%edx
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1200 <print+0xe0>
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
sub    $0x18,%rsp
mov    %esi,0x14(%rsp)
mov    %edx,0x10(%rsp)
mov    %ecx,0xc(%rsp)
mov    %r8d,0x8(%rsp)
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
call   1040 <calculation@plt>
test   %rax,%rax
je     11ed <print+0xad>
lea    0xe90(%rip),%rdi
call   1050 <puts@plt>
mov    0x14(%rsp),%esi
test   %esi,%esi
jle    119a <print+0x5a>
lea    0xe72(%rip),%rdi
mov    $0x64,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x10(%rsp),%esi
test   %esi,%esi
jle    11b5 <print+0x75>
lea    0xe57(%rip),%rdi
mov    $0x32,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
jle    11d0 <print+0x90>
lea    0xe3c(%rip),%rdi
mov    $0x14,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%rsp),%esi
test   %esi,%esi
jle    11f9 <print+0xb9>
lea    0xe21(%rip),%rdi
mov    $0xa,%edx
xor    %eax,%eax
call   1060 <printf@plt>
jmp    11f9 <print+0xb9>
lea    0xe38(%rip),%rdi
call   1050 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"\0AThe entered amount is invalid \0A\00"
@.str.1 = [35 x i8] c"\0AThe withdrawn bills is following\0A\00"
@.str.2 = [10 x i8] c"%d x %d$\0A\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @print(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
%12 = load i32, i32* %7
%13 = call i64 @calculation(i32 %12, i32* %8, i32* %9, i32* %10, i32* %11)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %5
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %43
17: ; preds = %5
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%19 = load i32, i32* %8
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i32, i32* %8
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %22, i32 100)
br label %24
24: ; preds = %21, %17
%25 = load i32, i32* %9
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load i32, i32* %9
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %28, i32 50)
br label %30
30: ; preds = %27, %24
%31 = load i32, i32* %10
%32 = icmp sgt i32 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load i32, i32* %10
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %34, i32 20)
br label %36
36: ; preds = %33, %30
%37 = load i32, i32* %11
%38 = icmp sgt i32 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = load i32, i32* %11
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %40, i32 10)
br label %42
42: ; preds = %39, %36
br label %43
43: ; preds = %42, %15
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%45 = load i32, i32* %6
ret i32 %45
}

LLVM IR (-O2):
@.str.2 = [10 x i8] c"%d x %d$\0A\00"
@str = [34 x i8] c"\0AThe withdrawn bills is following\00"
@str.4 = [32 x i8] c"\0AThe entered amount is invalid \00"
define i32 @print(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 %4, i32* %9
%10 = call i64 @calculation(i32 %0, i32* %6, i32* %7, i32* %8, i32* %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %5
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.4, i64 0, i64 0))
br label %35
14: ; preds = %5
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%16 = load i32, i32* %6
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %16, i32 100)
br label %20
20: ; preds = %18, %14
%21 = load i32, i32* %7
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %21, i32 50)
br label %25
25: ; preds = %23, %20
%26 = load i32, i32* %8
%27 = icmp sgt i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %26, i32 20)
br label %30
30: ; preds = %28, %25
%31 = load i32, i32* %9
%32 = icmp sgt i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %31, i32 10)
br label %35
35: ; preds = %30, %33, %12
%36 = call i32 @putchar(i32 10)
ret i32 undef
}