#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(int argc, char *argv[]) {
  int months;
  float payment;
  float total;
  printf("How many months does your cellphone plan last?");
  scanf("%d", &months);
  printf("How much do you pay a month?");
  scanf("%f", &payment);
  total = months * payment;
  printf("Your phone plan lasts %d months and you pay $%.2f per month.\n",
         months, payment);
  printf("Your total amount to pay is $%6.2f.\n", total);
  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)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cvtsi2ssl -0x14(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x14(%rbp),%esi
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeba(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xee1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xee6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x14(%rsp),%esi
cvtsi2ss %esi,%xmm1
movss  0x10(%rsp),%xmm0
mulss  %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
cvtss2sd %xmm0,%xmm0
lea    0xec9(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeef(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [47 x i8] c"How many months does your cellphone plan last?\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [29 x i8] c"How much do you pay a month?\00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [62 x i8] c"Your phone plan lasts %d months and you pay $%.2f per month.\0A\00"
@.str.5 = [37 x i8] c"Your total amount to pay is $%6.2f.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca float
%8 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %7)
%13 = load i32, i32* %6
%14 = sitofp i32 %13 to float
%15 = load float, float* %7
%16 = fmul float %14, %15
store float %16, float* %8
%17 = load i32, i32* %6
%18 = load float, float* %7
%19 = fpext float %18 to double
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.4, i64 0, i64 0), i32 %17, double %19)
%21 = load float, float* %8
%22 = fpext float %21 to double
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), double %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [47 x i8] c"How many months does your cellphone plan last?\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [29 x i8] c"How much do you pay a month?\00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [62 x i8] c"Your phone plan lasts %d months and you pay $%.2f per month.\0A\00"
@.str.5 = [37 x i8] c"Your total amount to pay is $%6.2f.\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca float
%5 = bitcast i32* %3 to i8*
%6 = bitcast float* %4 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %4)
%11 = load i32, i32* %3
%12 = sitofp i32 %11 to float
%13 = load float, float* %4
%14 = fmul float %13, %12
%15 = fpext float %13 to double
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str.4, i64 0, i64 0), i32 %11, double %15)
%17 = fpext float %14 to double
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), double %17)
ret i32 0
}