#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 *, ...);
int main() {
  int year;
  float num1, num2, vardep;
  printf("Enter expected number of years. Ex. If 2 years, enter: 2 : ");
  scanf("%d", &year);
  printf("Enter the price value. Ex. 250.00 : ");
  scanf("%f", &num1);
  printf("Enter the salvage value. Ex. 50.00 : ");
  scanf("%f", &num2);
  vardep = num1 - num2;
  printf("DEPRECIATION IS: %.1f / %d = %.1f", vardep, year, vardep / year);
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xef0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf07(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xef8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x4(%rbp),%esi
movss  -0x10(%rbp),%xmm1
cvtsi2ssl -0x4(%rbp),%xmm2
divss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xed1(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef2(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xee2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef9(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xee6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0x8(%rsp),%xmm1
subss  0x4(%rsp),%xmm1
mov    0xc(%rsp),%esi
cvtsi2ss %esi,%xmm2
cvtss2sd %xmm1,%xmm0
divss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xecf(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [60 x i8] c"Enter expected number of years. Ex. If 2 years, enter: 2 : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [37 x i8] c"Enter the price value. Ex. 250.00 : \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [38 x i8] c"Enter the salvage value. Ex. 50.00 : \00"
@.str.5 = [34 x i8] c"DEPRECIATION IS: %.1f / %d = %.1f\00"
@.str.6 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 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 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %3)
%11 = load float, float* %2
%12 = load float, float* %3
%13 = fsub float %11, %12
store float %13, float* %4
%14 = load float, float* %4
%15 = fpext float %14 to double
%16 = load i32, i32* %1
%17 = load float, float* %4
%18 = load i32, i32* %1
%19 = sitofp i32 %18 to float
%20 = fdiv float %17, %19
%21 = fpext float %20 to double
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), double %15, i32 %16, double %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [60 x i8] c"Enter expected number of years. Ex. If 2 years, enter: 2 : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [37 x i8] c"Enter the price value. Ex. 250.00 : \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [38 x i8] c"Enter the salvage value. Ex. 50.00 : \00"
@.str.5 = [34 x i8] c"DEPRECIATION IS: %.1f / %d = %.1f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = bitcast i32* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = bitcast float* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %3)
%13 = load float, float* %2
%14 = load float, float* %3
%15 = fsub float %13, %14
%16 = fpext float %15 to double
%17 = load i32, i32* %1
%18 = sitofp i32 %17 to float
%19 = fdiv float %15, %18
%20 = fpext float %19 to double
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), double %16, i32 %17, double %20)
%22 = call i32 @putchar(i32 10)
ret i32 0
}