#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 *, ...);
int main(void) {
  int workHours = 0;
  float hourlyRate = 0;
  float total = 0;
  printf("%s", "Enter # of hours worked (-1 to end): ");
  scanf("%d", &workHours);
  while (workHours != -1) {
    printf("%s", "Enter hourly rate of the worker ($00.00): ");
    scanf("%f", &hourlyRate);
    if (workHours > 40) {
      total = ((float)40 * hourlyRate) +
              ((float)(workHours - 40) * (hourlyRate + (hourlyRate / 2)));
    } else {
      total = (float)workHours * hourlyRate;
    }
    printf("%s %0.2f\n\n", "Salary is $", total);
    printf("%s", "Enter # of hours worked (-1 to end): ");
    scanf("%d", &workHours);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
lea    0xebb(%rip),%rdi
lea    0xeb7(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0xffffffff,-0x8(%rbp)
je     1248 <main+0x128>
lea    0xe8a(%rip),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x28,-0x8(%rbp)
jle    11ef <main+0xcf>
movss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%eax
sub    $0x28,%eax
cvtsi2ss %eax,%xmm1
movss  -0xc(%rbp),%xmm2
movss  -0xc(%rbp),%xmm3
movss  0xe3b(%rip),%xmm4
divss  %xmm4,%xmm3
addss  %xmm3,%xmm2
mulss  %xmm2,%xmm1
movss  0xe23(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    11fe <main+0xde>
cvtsi2ssl -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe54(%rip),%rdi
lea    0xe58(%rip),%rsi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xde5(%rip),%rdi
lea    0xde1(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdf9(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
jmp    116d <main+0x4d>
xor    %eax,%eax
add    $0x10,%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,(%rsp)
movl   $0x0,0x4(%rsp)
lea    0xec7(%rip),%rdi
lea    0xec3(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0xffffffff,(%rsp)
je     123e <main+0x11e>
lea    0xe97(%rip),%rbx
lea    0xeea(%rip),%r13
lea    0xeee(%rip),%rbp
lea    0xe85(%rip),%r14
lea    0xea4(%rip),%r15
mov    %rsp,%r12
jmp    11de <main+0xbe>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r13,%rdi
mov    %rbp,%rsi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0xffffffff,(%rsp)
je     123e <main+0x11e>
mov    %rbx,%rdi
lea    0xe4c(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe69(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    (%rsp),%eax
cmp    $0x29,%eax
jl     11a0 <main+0x80>
movss  0x4(%rsp),%xmm0
add    $0xffffffd8,%eax
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
movaps %xmm0,%xmm2
mulss  0xddb(%rip),%xmm2
addss  %xmm0,%xmm2
mulss  %xmm1,%xmm2
mulss  0xdcf(%rip),%xmm0
addss  %xmm2,%xmm0
jmp    11ad <main+0x8d>
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 = [38 x i8] c"Enter # of hours worked (-1 to end): \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [43 x i8] c"Enter hourly rate of the worker ($00.00): \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [11 x i8] c"%s %0.2f\0A\0A\00"
@.str.6 = [12 x i8] c"Salary is $\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
store i32 0, i32* %1
store i32 0, i32* %2
store float 0.000000e+00, float* %3
store float 0.000000e+00, float* %4
%5 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %7
7: ; preds = %31, %0
%8 = load i32, i32* %2
%9 = icmp ne i32 %8, -1
br i1 %9, label %10, label %37
10: ; preds = %7
%11 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %3)
%13 = load i32, i32* %2
%14 = icmp sgt i32 %13, 40
br i1 %14, label %15, label %26
15: ; preds = %10
%16 = load float, float* %3
%17 = load i32, i32* %2
%18 = sub nsw i32 %17, 40
%19 = sitofp i32 %18 to float
%20 = load float, float* %3
%21 = load float, float* %3
%22 = fdiv float %21, 2.000000e+00
%23 = fadd float %20, %22
%24 = fmul float %19, %23
%25 = call float @llvm.fmuladd.f32(float 4.000000e+01, float %16, float %24)
store float %25, float* %4
br label %31
26: ; preds = %10
%27 = load i32, i32* %2
%28 = sitofp i32 %27 to float
%29 = load float, float* %3
%30 = fmul float %28, %29
store float %30, float* %4
br label %31
31: ; preds = %26, %15
%32 = load float, float* %4
%33 = fpext float %32 to double
%34 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), double %33)
%35 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%36 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %7
37: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [38 x i8] c"Enter # of hours worked (-1 to end): \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [43 x i8] c"Enter hourly rate of the worker ($00.00): \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [11 x i8] c"%s %0.2f\0A\0A\00"
@.str.6 = [12 x i8] c"Salary is $\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast float* %2 to i8*
store float 0.000000e+00, float* %2
%5 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, -1
br i1 %8, label %34, label %9
9: ; preds = %0, %26
%10 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %2)
%12 = load i32, i32* %1
%13 = icmp sgt i32 %12, 40
br i1 %13, label %14, label %22
14: ; preds = %9
%15 = load float, float* %2
%16 = add nsw i32 %12, -40
%17 = sitofp i32 %16 to float
%18 = fmul float %15, 5.000000e-01
%19 = fadd float %15, %18
%20 = fmul float %19, %17
%21 = call float @llvm.fmuladd.f32(float %15, float 4.000000e+01, float %20)
br label %26
22: ; preds = %9
%23 = sitofp i32 %12 to float
%24 = load float, float* %2
%25 = fmul float %24, %23
br label %26
26: ; preds = %22, %14
%27 = phi float [ %21, %14 ], [ %25, %22 ]
%28 = fpext float %27 to double
%29 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), double %28)
%30 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%31 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%32 = load i32, i32* %1
%33 = icmp eq i32 %32, -1
br i1 %33, label %34, label %9
34: ; preds = %26, %0
ret i32 0
}