#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(void) {
  float work_hours, hours_rate, salary = 0;
  printf("Enter # of hours worked:");
  scanf("%f", &work_hours);
  while (work_hours != -1) {
    printf("Enter # hourly rate of the worker($00.00):");
    scanf("%f", &hours_rate);
    salary = work_hours * hours_rate;
    if (work_hours > 40) {
      double excess_hours = work_hours - 40;
      salary = (40 * hours_rate) + (excess_hours * 1.5 * hours_rate);
    }
    printf("salary is $ %.2f\n\n", salary);
    printf("Enter # of hours worked:");
    scanf("%f", &work_hours);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
movss  0xe9e(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1176 <main+0x56>
jp     1176 <main+0x56>
jmp    1245 <main+0x125>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9e(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xe54(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    120b <main+0xeb>
movss  -0x8(%rbp),%xmm0
movss  0xe3e(%rip),%xmm1
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movss  0xe29(%rip),%xmm0
mulss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe1c(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe3c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xde7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdf2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
jmp    1155 <main+0x35>
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
lea    0xee6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
movss  (%rsp),%xmm0
ucomiss 0xeac(%rip),%xmm0
jne    115c <main+0x3c>
jnp    1229 <main+0x109>
lea    0xed1(%rip),%r14
lea    0xec7(%rip),%rbx
lea    0x4(%rsp),%r15
lea    0xee9(%rip),%r12
lea    0xe9b(%rip),%r13
mov    %rsp,%rbp
jmp    11f2 <main+0xd2>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
addss  0xe70(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm2,%xmm2
cvtss2sd %xmm1,%xmm2
mulss  %xmm3,%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0xe5d(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1040 <scanf@plt>
movss  (%rsp),%xmm0
ucomiss 0xe12(%rip),%xmm0
jne    11f2 <main+0xd2>
jnp    1229 <main+0x109>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
movss  (%rsp),%xmm0
movss  0x4(%rsp),%xmm1
movss  0xdea(%rip),%xmm3
ucomiss %xmm3,%xmm0
ja     1190 <main+0x70>
mulss  %xmm1,%xmm0
jmp    11bf <main+0x9f>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Enter # of hours worked:\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [43 x i8] c"Enter # hourly rate of the worker($00.00):\00"
@.str.3 = [19 x i8] c"salary is $ %.2f\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca double
store i32 0, i32* %1
store float 0.000000e+00, float* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
br label %8
8: ; preds = %32, %0
%9 = load float, float* %2
%10 = fcmp une float %9, -1.000000e+00
br i1 %10, label %11, label %38
11: ; preds = %8
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%14 = load float, float* %2
%15 = load float, float* %3
%16 = fmul float %14, %15
store float %16, float* %4
%17 = load float, float* %2
%18 = fcmp ogt float %17, 4.000000e+01
br i1 %18, label %19, label %32
19: ; preds = %11
%20 = load float, float* %2
%21 = fsub float %20, 4.000000e+01
%22 = fpext float %21 to double
store double %22, double* %5
%23 = load float, float* %3
%24 = fmul float 4.000000e+01, %23
%25 = fpext float %24 to double
%26 = load double, double* %5
%27 = fmul double %26, 1.500000e+00
%28 = load float, float* %3
%29 = fpext float %28 to double
%30 = call double @llvm.fmuladd.f64(double %27, double %29, double %25)
%31 = fptrunc double %30 to float
store float %31, float* %4
br label %32
32: ; preds = %19, %11
%33 = load float, float* %4
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), double %34)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%37 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
br label %8
38: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"Enter # of hours worked:\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [43 x i8] c"Enter # hourly rate of the worker($00.00):\00"
@.str.3 = [19 x i8] c"salary is $ %.2f\0A\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = bitcast float* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%7 = load float, float* %1
%8 = fcmp une float %7, -1.000000e+00
br i1 %8, label %9, label %33
9: ; preds = %0, %25
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%12 = load float, float* %1
%13 = load float, float* %2
%14 = fmul float %12, %13
%15 = fcmp ogt float %12, 4.000000e+01
br i1 %15, label %16, label %25
16: ; preds = %9
%17 = fadd float %12, -4.000000e+01
%18 = fpext float %17 to double
%19 = fmul float %13, 4.000000e+01
%20 = fpext float %19 to double
%21 = fmul double %18, 1.500000e+00
%22 = fpext float %13 to double
%23 = call double @llvm.fmuladd.f64(double %21, double %22, double %20)
%24 = fptrunc double %23 to float
br label %25
25: ; preds = %16, %9
%26 = phi float [ %24, %16 ], [ %14, %9 ]
%27 = fpext float %26 to double
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), double %27)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%31 = load float, float* %1
%32 = fcmp une float %31, -1.000000e+00
br i1 %32, label %9, label %33
33: ; preds = %25, %0
ret i32 0
}