#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 *, char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main(void) {
  int baseSalary = 200;
  float sales = 0;
  float totalSalary = 0;
  float commission = 0.09;
  printf("%s", "Enter sales in dollars (-1 to end): ");
  scanf("%f", &sales);
  while (sales != -1) {
    totalSalary = baseSalary + (sales * commission);
    printf("%s %0.2f\n\n", "Salary is: $", totalSalary);
    printf("%s", "Enter sales in dollars (-1 to end): ");
    scanf("%f", &sales);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xc8,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xeb2(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
lea    0xeae(%rip),%rdi
lea    0xeaa(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0xc(%rbp),%xmm0
movss  0xe7f(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1199 <main+0x79>
jp     1199 <main+0x79>
jmp    11fd <main+0xdd>
cvtsi2ssl -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
movss  -0x14(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe6e(%rip),%rdi
lea    0xe72(%rip),%rsi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe2e(%rip),%rdi
lea    0xe2a(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe41(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
jmp    1178 <main+0x58>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xed2(%rip),%rdi
lea    0xece(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
ucomiss 0xe9a(%rip),%xmm0
jne    116e <main+0x4e>
jnp    11ea <main+0xca>
lea    0xec2(%rip),%r14
lea    0xec6(%rip),%r15
lea    0xe89(%rip),%r12
lea    0xe85(%rip),%r13
lea    0xea3(%rip),%rbx
lea    0x4(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
mulss  0xe5c(%rip),%xmm0
addss  0xe58(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
ucomiss 0xe1a(%rip),%xmm0
jne    11a0 <main+0x80>
jp     11a0 <main+0x80>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [37 x i8] c"Enter sales in dollars (-1 to end): \00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [11 x i8] c"%s %0.2f\0A\0A\00"
@.str.4 = [13 x i8] c"Salary is: $\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca float
store i32 0, i32* %1
store i32 200, i32* %2
store float 0.000000e+00, float* %3
store float 0.000000e+00, float* %4
store float 0x3FB70A3D80000000, float* %5
%6 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
br label %8
8: ; preds = %11, %0
%9 = load float, float* %3
%10 = fcmp une float %9, -1.000000e+00
br i1 %10, label %11, label %22
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sitofp i32 %12 to float
%14 = load float, float* %3
%15 = load float, float* %5
%16 = call float @llvm.fmuladd.f32(float %14, float %15, float %13)
store float %16, float* %4
%17 = load float, float* %4
%18 = fpext float %17 to double
%19 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), double %18)
%20 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
br label %8
22: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [37 x i8] c"Enter sales in dollars (-1 to end): \00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [11 x i8] c"%s %0.2f\0A\0A\00"
@.str.4 = [13 x i8] c"Salary is: $\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
store float 0.000000e+00, float* %1
%3 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = fcmp une float %5, -1.000000e+00
br i1 %6, label %7, label %16
7: ; preds = %0, %7
%8 = phi float [ %14, %7 ], [ %5, %0 ]
%9 = call float @llvm.fmuladd.f32(float %8, float 0x3FB70A3D80000000, float 2.000000e+02)
%10 = fpext float %9 to double
%11 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), double %10)
%12 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %1)
%14 = load float, float* %1
%15 = fcmp une float %14, -1.000000e+00
br i1 %15, label %7, label %16
16: ; preds = %7, %0
ret i32 0
}