#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, ...);
int main(void) {
  char firstInitial, middleInitial;
  int number_of_pencils;
  int number_of_notebooks;
  float pencils = 0.23;
  float notebooks = 2.89;
  float lunchbox = 4.99;
  firstInitial = 'J';
  middleInitial = 'R';
  number_of_pencils = 7;
  number_of_notebooks = 4;
  printf("%c%c needs %d pencils, %d notebooks, and 1 lunchbox\n", firstInitial,
         middleInitial, number_of_pencils, number_of_notebooks);
  printf("The total cost is $%.2f\n\n", number_of_pencils * pencils +
                                            number_of_notebooks * notebooks +
                                            lunchbox);
  firstInitial = 'A';
  middleInitial = 'J';
  number_of_pencils = 10;
  number_of_notebooks = 3;
  printf("%c%c needs %d pencils, %d notebooks, and 1 lunchbox\n", firstInitial,
         middleInitial, number_of_pencils, number_of_notebooks);
  printf("The total cost is %.2f\n\n", number_of_pencils * pencils +
                                           number_of_notebooks * notebooks +
                                           lunchbox);
  firstInitial = 'M';
  middleInitial = 'J';
  number_of_pencils = 9;
  number_of_notebooks = 2;
  printf("%c%c needs %d pencils, %d notebooks, and 1 lunchbox\n", firstInitial,
         middleInitial, number_of_pencils, number_of_notebooks);
  printf("The total cost is %.2f\n\n", number_of_pencils * pencils +
                                           number_of_notebooks * notebooks +
                                           lunchbox);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xee1(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xed0(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xebf(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movb   $0x4a,-0x5(%rbp)
movb   $0x52,-0x6(%rbp)
movl   $0x7,-0xc(%rbp)
movl   $0x4,-0x10(%rbp)
movsbl -0x5(%rbp),%esi
movsbl -0x6(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cvtsi2ssl -0xc(%rbp),%xmm0
movss  -0x14(%rbp),%xmm2
cvtsi2ssl -0x10(%rbp),%xmm1
mulss  -0x18(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
addss  -0x1c(%rbp),%xmm0
cvttss2si %xmm0,%esi
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movb   $0x41,-0x5(%rbp)
movb   $0x4a,-0x6(%rbp)
movl   $0xa,-0xc(%rbp)
movl   $0x3,-0x10(%rbp)
movsbl -0x5(%rbp),%esi
movsbl -0x6(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cvtsi2ssl -0xc(%rbp),%xmm0
movss  -0x14(%rbp),%xmm2
cvtsi2ssl -0x10(%rbp),%xmm1
mulss  -0x18(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
addss  -0x1c(%rbp),%xmm0
cvttss2si %xmm0,%esi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movb   $0x4d,-0x5(%rbp)
movb   $0x4a,-0x6(%rbp)
movl   $0x9,-0xc(%rbp)
movl   $0x2,-0x10(%rbp)
movsbl -0x5(%rbp),%esi
movsbl -0x6(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cvtsi2ssl -0xc(%rbp),%xmm0
movss  -0x14(%rbp),%xmm2
cvtsi2ssl -0x10(%rbp),%xmm1
mulss  -0x18(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
addss  -0x1c(%rbp),%xmm0
cvttss2si %xmm0,%esi
lea    0xdea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%r14
mov    %r14,%rdi
mov    $0x4a,%esi
mov    $0x52,%edx
mov    $0x7,%ecx
mov    $0x4,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
mov    $0x12,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x41,%esi
mov    $0x4a,%edx
mov    $0xa,%ecx
mov    $0x3,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedc(%rip),%rbx
mov    %rbx,%rdi
mov    $0xf,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x4d,%esi
mov    $0x4a,%edx
mov    $0x9,%ecx
mov    $0x2,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xc,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [53 x i8] c"%c%c needs %d pencils, %d notebooks, and 1 lunchbox\0A\00"
@.str.1 = [26 x i8] c"The total cost is $%.2f\0A\0A\00"
@.str.2 = [25 x i8] c"The total cost is %.2f\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
%7 = alloca float
%8 = alloca float
store i32 0, i32* %1
store float 0x3FCD70A3E0000000, float* %6
store float 0x40071EB860000000, float* %7
store float 0x4013F5C280000000, float* %8
store i8 74, i8* %2
store i8 82, i8* %3
store i32 7, i32* %4
store i32 4, i32* %5
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = load i8, i8* %3
%12 = sext i8 %11 to i32
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %12, i32 %13, i32 %14)
%16 = load i32, i32* %4
%17 = sitofp i32 %16 to float
%18 = load float, float* %6
%19 = load i32, i32* %5
%20 = sitofp i32 %19 to float
%21 = load float, float* %7
%22 = fmul float %20, %21
%23 = call float @llvm.fmuladd.f32(float %17, float %18, float %22)
%24 = load float, float* %8
%25 = fadd float %23, %24
%26 = fptosi float %25 to i32
%27 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %26)
store i8 65, i8* %2
store i8 74, i8* %3
store i32 10, i32* %4
store i32 3, i32* %5
%28 = load i8, i8* %2
%29 = sext i8 %28 to i32
%30 = load i8, i8* %3
%31 = sext i8 %30 to i32
%32 = load i32, i32* %4
%33 = load i32, i32* %5
%34 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %29, i32 %31, i32 %32, i32 %33)
%35 = load i32, i32* %4
%36 = sitofp i32 %35 to float
%37 = load float, float* %6
%38 = load i32, i32* %5
%39 = sitofp i32 %38 to float
%40 = load float, float* %7
%41 = fmul float %39, %40
%42 = call float @llvm.fmuladd.f32(float %36, float %37, float %41)
%43 = load float, float* %8
%44 = fadd float %42, %43
%45 = fptosi float %44 to i32
%46 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %45)
store i8 77, i8* %2
store i8 74, i8* %3
store i32 9, i32* %4
store i32 2, i32* %5
%47 = load i8, i8* %2
%48 = sext i8 %47 to i32
%49 = load i8, i8* %3
%50 = sext i8 %49 to i32
%51 = load i32, i32* %4
%52 = load i32, i32* %5
%53 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %48, i32 %50, i32 %51, i32 %52)
%54 = load i32, i32* %4
%55 = sitofp i32 %54 to float
%56 = load float, float* %6
%57 = load i32, i32* %5
%58 = sitofp i32 %57 to float
%59 = load float, float* %7
%60 = fmul float %58, %59
%61 = call float @llvm.fmuladd.f32(float %55, float %56, float %60)
%62 = load float, float* %8
%63 = fadd float %61, %62
%64 = fptosi float %63 to i32
%65 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %64)
ret i32 0
}

LLVM IR (-O2):
@.str = [53 x i8] c"%c%c needs %d pencils, %d notebooks, and 1 lunchbox\0A\00"
@.str.1 = [26 x i8] c"The total cost is $%.2f\0A\0A\00"
@.str.2 = [25 x i8] c"The total cost is %.2f\0A\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 74, i32 82, i32 7, i32 4)
%2 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 18)
%3 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 65, i32 74, i32 10, i32 3)
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 15)
%5 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 77, i32 74, i32 9, i32 2)
%6 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 12)
ret i32 0
}