#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*/ getchar();
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, ...);
int main(void) {
  int hours;
  double rate;
  puts("How many (whole) hours has the employee worked?");
  scanf("%d", &hours);
  getchar();
  puts("What is the hourly rate?");
  scanf("%lf", &rate);
  getchar();
  printf("Total earnings $%.2f\n", rate * hours);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1030 <puts@plt>
lea    0xece(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
lea    0xec5(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
movsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
lea    0xea2(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
lea    0xed9(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
lea    0xecf(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cvtsi2sdl 0xc(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [48 x i8] c"How many (whole) hours has the employee worked?\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [25 x i8] c"What is the hourly rate?\00"
@.str.3 = [4 x i8] c"%lf\00"
@.str.4 = [22 x i8] c"Total earnings $%.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
store i32 0, i32* %1
%4 = call i32 @puts(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = call i32 (...) @getchar()
%7 = call i32 @puts(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %3)
%9 = call i32 (...) @getchar()
%10 = load double, double* %3
%11 = load i32, i32* %2
%12 = sitofp i32 %11 to double
%13 = fmul double %10, %12
%14 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), double %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [48 x i8] c"How many (whole) hours has the employee worked?\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [25 x i8] c"What is the hourly rate?\00"
@.str.3 = [4 x i8] c"%lf\00"
@.str.4 = [22 x i8] c"Total earnings $%.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = bitcast i32* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 (...) @getchar()
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %2)
%10 = call i32 (...) @getchar()
%11 = load double, double* %2
%12 = load i32, i32* %1
%13 = sitofp i32 %12 to double
%14 = fmul double %11, %13
%15 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), double %14)
ret i32 0
}