#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 *);
int main(void) {
  int h;
  int q;
  int d;
  int n;
  int p;
  int total, value;
  printf("How many half dollars do you have? ");
  scanf("%d", &h);
  printf("How many quarters do you have? ");
  scanf("%d", &q);
  printf("How many dimes do you have? ");
  scanf("%d", &d);
  printf("How many nickels do you have? ");
  scanf("%d", &n);
  printf("How many pennies do you have? ");
  scanf("%d", &p);
  total = h + q + d + n + p;
  value = 50 * h + 25 * q + 10 * d + 5 * n + p;
  printf("\nYou entered:\t%d half dollars\n\t\t%d quarters\n\t\t%d "
         "quarters\n\t\t%d dimes\n\t\t%d pennies\n",
         h, q, d, n, p);
  printf("The value of your %d coins is equivalent to %d pennies\n", total,
         value);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec2(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea4(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe86(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe68(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
imul   $0x32,-0x8(%rbp),%eax
imul   $0x19,-0xc(%rbp),%ecx
add    %ecx,%eax
imul   $0xa,-0x10(%rbp),%ecx
add    %ecx,%eax
imul   $0x5,-0x14(%rbp),%ecx
add    %ecx,%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
lea    0xed3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee9(%rip),%rbx
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xedd(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xedf(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xee3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
lea    (%rdx,%rsi,1),%ebx
mov    0xc(%rsp),%ecx
add    %ecx,%ebx
mov    0x8(%rsp),%r8d
add    %r8d,%ebx
mov    0x4(%rsp),%r9d
add    %r9d,%ebx
imul   $0x32,%esi,%eax
lea    (%rdx,%rdx,4),%edi
lea    (%rdi,%rdi,4),%edi
add    %eax,%edi
lea    (%rcx,%rcx,4),%eax
lea    (%rdi,%rax,2),%eax
lea    (%r8,%r8,4),%ebp
add    %eax,%ebp
add    %r9d,%ebp
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [36 x i8] c"How many half dollars do you have? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [32 x i8] c"How many quarters do you have? \00"
@.str.3 = [29 x i8] c"How many dimes do you have? \00"
@.str.4 = [31 x i8] c"How many nickels do you have? \00"
@.str.5 = [31 x i8] c"How many pennies do you have? \00"
@.str.6 = [83 x i8] c"\0AYou entered:\09%d half dollars\0A\09\09%d quarters\0A\09\09%d quarters\0A\09\09%d dimes\0A\09\09%d pennies\0A\00"
@.str.7 = [56 x i8] c"The value of your %d coins is equivalent to %d pennies\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
store i32 0, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = add nsw i32 %19, %20
%22 = load i32, i32* %4
%23 = add nsw i32 %21, %22
%24 = load i32, i32* %5
%25 = add nsw i32 %23, %24
%26 = load i32, i32* %6
%27 = add nsw i32 %25, %26
store i32 %27, i32* %7
%28 = load i32, i32* %2
%29 = mul nsw i32 50, %28
%30 = load i32, i32* %3
%31 = mul nsw i32 25, %30
%32 = add nsw i32 %29, %31
%33 = load i32, i32* %4
%34 = mul nsw i32 10, %33
%35 = add nsw i32 %32, %34
%36 = load i32, i32* %5
%37 = mul nsw i32 5, %36
%38 = add nsw i32 %35, %37
%39 = load i32, i32* %6
%40 = add nsw i32 %38, %39
store i32 %40, i32* %8
%41 = load i32, i32* %2
%42 = load i32, i32* %3
%43 = load i32, i32* %4
%44 = load i32, i32* %5
%45 = load i32, i32* %6
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.6, i64 0, i64 0), i32 %41, i32 %42, i32 %43, i32 %44, i32 %45)
%47 = load i32, i32* %7
%48 = load i32, i32* %8
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.7, i64 0, i64 0), i32 %47, i32 %48)
ret i32 0
}

LLVM IR (-O2):
@.str = [36 x i8] c"How many half dollars do you have? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [32 x i8] c"How many quarters do you have? \00"
@.str.3 = [29 x i8] c"How many dimes do you have? \00"
@.str.4 = [31 x i8] c"How many nickels do you have? \00"
@.str.5 = [31 x i8] c"How many pennies do you have? \00"
@.str.6 = [83 x i8] c"\0AYou entered:\09%d half dollars\0A\09\09%d quarters\0A\09\09%d quarters\0A\09\09%d dimes\0A\09\09%d pennies\0A\00"
@.str.7 = [56 x i8] c"The value of your %d coins is equivalent to %d pennies\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%21 = load i32, i32* %1
%22 = load i32, i32* %2
%23 = add nsw i32 %22, %21
%24 = load i32, i32* %3
%25 = add nsw i32 %23, %24
%26 = load i32, i32* %4
%27 = add nsw i32 %25, %26
%28 = load i32, i32* %5
%29 = add nsw i32 %27, %28
%30 = mul nsw i32 %21, 50
%31 = mul nsw i32 %22, 25
%32 = add nsw i32 %31, %30
%33 = mul nsw i32 %24, 10
%34 = add nsw i32 %32, %33
%35 = mul nsw i32 %26, 5
%36 = add nsw i32 %34, %35
%37 = add nsw i32 %36, %28
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([83 x i8], [83 x i8]* @.str.6, i64 0, i64 0), i32 %21, i32 %22, i32 %24, i32 %26, i32 %28)
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.7, i64 0, i64 0), i32 %29, i32 %37)
ret i32 0
}