#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 */
float get_float();
int get_int();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char **argv) {
  int id_number, num_people;
  float hours, rate, pay;
  printf("How many people: ");
  scanf("%d", &num_people);
  do {
    printf("\nInput ID number: ");
    id_number = get_int();
    printf("Input rate of pay: ");
    rate = get_float();
    printf("Input hours: ");
    hours = get_float();
    if (hours > 40.0) {
      pay = (40.0 * rate) + ((hours - 40.0) * (rate * 1.5));
    } else {
      pay = hours * rate;
    }
    printf("\nID Number: %d\n", id_number);
    printf("You've worked %.2f hours, with a rate of $%.2f per hour "
           "which equals to a pay of: $%.2f.\n\n",
           hours, rate, pay);
    num_people--;
  } while (num_people > 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <get_int@plt>
mov    %eax,-0x14(%rbp)
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <get_float@plt>
movss  %xmm0,-0x20(%rbp)
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <get_float@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe2f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1230 <main+0xf0>
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x1c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe0b(%rip),%xmm2
subsd  %xmm2,%xmm1
movss  -0x20(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movsd  0xdfe(%rip),%xmm3
mulsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xde6(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    123f <main+0xff>
movss  -0x1c(%rbp),%xmm0
mulss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x20(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x24(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xdf8(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jg     1174 <main+0x34>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
lea    0xec1(%rip),%r14
lea    0xecd(%rip),%r15
lea    0xeda(%rip),%r12
lea    0xee1(%rip),%r13
lea    0xeea(%rip),%rbx
jmp    11fa <main+0xba>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movss  (%rsp),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,0x8(%rsp)
cvtss2sd %xmm1,%xmm1
movsd  %xmm1,(%rsp)
mov    %r13,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movss  0x8(%rsp),%xmm0
xorps  %xmm2,%xmm2
cvtss2sd %xmm0,%xmm2
mov    %rbx,%rdi
movsd  0x10(%rsp),%xmm0
movsd  (%rsp),%xmm1
mov    $0x3,%al
call   1030 <printf@plt>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0xc(%rsp)
cmp    $0x1,%eax
jle    1297 <main+0x157>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <get_int@plt>
mov    %eax,%ebp
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <get_float@plt>
movss  %xmm0,(%rsp)
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <get_float@plt>
xorps  %xmm3,%xmm3
cvtss2sd %xmm0,%xmm3
ucomiss 0xdbe(%rip),%xmm0
movsd  %xmm3,0x10(%rsp)
jbe    11a0 <main+0x60>
movss  (%rsp),%xmm0
xorps  %xmm2,%xmm2
cvtss2sd %xmm0,%xmm2
movaps %xmm3,%xmm0
addsd  0xda3(%rip),%xmm0
movaps %xmm2,%xmm1
mulsd  0xda0(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm2,(%rsp)
movaps %xmm2,%xmm0
mulsd  0xd94(%rip),%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x8(%rsp)
jmp    11b8 <main+0x78>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"How many people: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"\0AInput ID number: \00"
@.str.3 = [20 x i8] c"Input rate of pay: \00"
@.str.4 = [14 x i8] c"Input hours: \00"
@.str.5 = [16 x i8] c"\0AID Number: %d\0A\00"
@.str.6 = [91 x i8] c"You've worked %.2f hours, with a rate of $%.2f per hour which equals to a pay of: $%.2f.\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
br label %13
13: ; preds = %51, %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 (...) @get_int()
store i32 %15, i32* %6
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%17 = call float (...) @get_float()
store float %17, float* %9
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%19 = call float (...) @get_float()
store float %19, float* %8
%20 = load float, float* %8
%21 = fpext float %20 to double
%22 = fcmp ogt double %21, 4.000000e+01
br i1 %22, label %23, label %35
23: ; preds = %13
%24 = load float, float* %9
%25 = fpext float %24 to double
%26 = load float, float* %8
%27 = fpext float %26 to double
%28 = fsub double %27, 4.000000e+01
%29 = load float, float* %9
%30 = fpext float %29 to double
%31 = fmul double %30, 1.500000e+00
%32 = fmul double %28, %31
%33 = call double @llvm.fmuladd.f64(double 4.000000e+01, double %25, double %32)
%34 = fptrunc double %33 to float
store float %34, float* %10
br label %39
35: ; preds = %13
%36 = load float, float* %8
%37 = load float, float* %9
%38 = fmul float %36, %37
store float %38, float* %10
br label %39
39: ; preds = %35, %23
%40 = load i32, i32* %6
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %40)
%42 = load float, float* %8
%43 = fpext float %42 to double
%44 = load float, float* %9
%45 = fpext float %44 to double
%46 = load float, float* %10
%47 = fpext float %46 to double
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.6, i64 0, i64 0), double %43, double %45, double %47)
%49 = load i32, i32* %7
%50 = add nsw i32 %49, -1
store i32 %50, i32* %7
br label %51
51: ; preds = %39
%52 = load i32, i32* %7
%53 = icmp sgt i32 %52, 0
br i1 %53, label %13, label %54
54: ; preds = %51
%55 = load i32, i32* %3
ret i32 %55
}

LLVM IR (-O2):
@.str = [18 x i8] c"How many people: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"\0AInput ID number: \00"
@.str.3 = [20 x i8] c"Input rate of pay: \00"
@.str.4 = [14 x i8] c"Input hours: \00"
@.str.5 = [16 x i8] c"\0AID Number: %d\0A\00"
@.str.6 = [91 x i8] c"You've worked %.2f hours, with a rate of $%.2f per hour which equals to a pay of: $%.2f.\0A\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 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), i32* %3)
br label %7
7: ; preds = %26, %2
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (...) @get_int()
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%11 = call float (...) @get_float()
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%13 = call float (...) @get_float()
%14 = fpext float %13 to double
%15 = fcmp ogt float %13, 4.000000e+01
br i1 %15, label %16, label %23
16: ; preds = %7
%17 = fpext float %11 to double
%18 = fadd double %14, -4.000000e+01
%19 = fmul double %17, 1.500000e+00
%20 = fmul double %19, %18
%21 = call double @llvm.fmuladd.f64(double %17, double 4.000000e+01, double %20)
%22 = fptrunc double %21 to float
br label %26
23: ; preds = %7
%24 = fmul float %11, %13
%25 = fpext float %11 to double
br label %26
26: ; preds = %23, %16
%27 = phi double [ %25, %23 ], [ %17, %16 ]
%28 = phi float [ %24, %23 ], [ %22, %16 ]
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %9)
%30 = fpext float %28 to double
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([91 x i8], [91 x i8]* @.str.6, i64 0, i64 0), double %14, double %27, double %30)
%32 = load i32, i32* %3
%33 = add nsw i32 %32, -1
store i32 %33, i32* %3
%34 = icmp sgt i32 %32, 1
br i1 %34, label %7, label %35
35: ; preds = %26
ret i32 0
}