#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 *, float *);
int main() {
  float sales, commission, salary;
  const float rate = 0.09;
  const float basicPay = 200.0;
  printf("Enter sales in dollars (-1 to end): ");
  scanf("%f", &sales);
  while ((int)sales != -1) {
    salary = basicPay;
    commission = sales * rate;
    salary += commission;
    printf("Salary is: $%.2f\n", salary);
    printf("\n\nEnter 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)
movss  0xecd(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xebc(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cvttss2si -0x8(%rbp),%eax
cmp    $0xffffffff,%eax
je     11dd <main+0xbd>
movss  0xe83(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xe7a(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe58(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe39(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
jmp    1167 <main+0x47>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xef0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
cvttss2si %xmm0,%eax
cmp    $0xffffffff,%eax
je     11b2 <main+0x92>
lea    0xeae(%rip),%r14
lea    0xeb9(%rip),%r15
lea    0xe9d(%rip),%r12
lea    0x4(%rsp),%rbx
mulss  0xe88(%rip),%xmm0
addss  0xe84(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
cvttss2si %xmm0,%eax
cmp    $0xffffffff,%eax
jne    1170 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Enter sales in dollars (-1 to end): \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [18 x i8] c"Salary is: $%.2f\0A\00"
@.str.3 = [39 x i8] c"\0A\0AEnter sales in dollars (-1 to end): \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store i32 0, i32* %1
store float 0x3FB70A3D80000000, float* %5
store float 2.000000e+02, float* %6
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
br label %9
9: ; preds = %13, %0
%10 = load float, float* %2
%11 = fptosi float %10 to i32
%12 = icmp ne i32 %11, -1
br i1 %12, label %13, label %24
13: ; preds = %9
store float 2.000000e+02, float* %4
%14 = load float, float* %2
%15 = fmul float %14, 0x3FB70A3D80000000
store float %15, float* %3
%16 = load float, float* %3
%17 = load float, float* %4
%18 = fadd float %17, %16
store float %18, float* %4
%19 = load float, float* %4
%20 = fpext float %19 to double
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), double %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
br label %9
24: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [37 x i8] c"Enter sales in dollars (-1 to end): \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [18 x i8] c"Salary is: $%.2f\0A\00"
@.str.3 = [39 x i8] c"\0A\0AEnter sales in dollars (-1 to end): \00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = fptosi float %5 to i32
%7 = icmp eq i32 %6, -1
br i1 %7, label %19, label %8
8: ; preds = %0, %8
%9 = phi float [ %16, %8 ], [ %5, %0 ]
%10 = fmul float %9, 0x3FB70A3D80000000
%11 = fadd float %10, 2.000000e+02
%12 = fpext float %11 to double
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), double %12)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%16 = load float, float* %1
%17 = fptosi float %16 to i32
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %8
19: ; preds = %8, %0
ret i32 0
}