#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 main() {
  float fahr, celsius;
  int lower, upper, step;
  float ratio;
  lower = 0;
  upper = 300;
  step = 20;
  ratio = 5.0 / 9.0;
  fahr = upper;
  printf("This is a simple program that converts\n");
  printf("Celsius to Fahrenheit in decimal format\n");
  while (fahr >= lower) {
    celsius = ratio * (fahr - 32);
    printf("Celsius: %6.2f Fahrenheit: %3.1f\n", celsius, fahr);
    fahr = fahr - step;
  }
  celsius = upper;
  ratio = 9.0 / 5.0;
  printf("Now let's print the reverse\n");
  while (celsius >= lower) {
    fahr = celsius * ratio + 32;
    printf("Fahrenheit: %6.2f Celsius: %3.1f\n", fahr, celsius);
    celsius = celsius - step;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x12c,-0x14(%rbp)
movl   $0x14,-0x18(%rbp)
movss  0xec4(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
cvtsi2ssl -0x14(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
ucomiss %xmm1,%xmm0
jb     11d1 <main+0xc1>
movss  -0x1c(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  0xe7c(%rip),%xmm2
subss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xeab(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
cvtsi2ssl -0x18(%rbp),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    1167 <main+0x57>
cvtsi2ssl -0x14(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xe21(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
ucomiss %xmm1,%xmm0
jb     1260 <main+0x150>
movss  -0xc(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xde9(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe5b(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x18(%rbp),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11f6 <main+0xe6>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0x108c(%rip),%rdi
call   1030 <puts@plt>
lea    0x10a7(%rip),%rdi
call   1030 <puts@plt>
lea    0x1030(%rip),%rbx
movsd  0xeb8(%rip),%xmm0
movsd  0xeb8(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xeae(%rip),%xmm0
movsd  0xeae(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xea4(%rip),%xmm0
movsd  0xea4(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe9a(%rip),%xmm0
movsd  0xe9a(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe90(%rip),%xmm0
movsd  0xe90(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe86(%rip),%xmm0
movsd  0xe86(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe7c(%rip),%xmm0
movsd  0xe7c(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe72(%rip),%xmm0
movsd  0xe72(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe68(%rip),%xmm0
movsd  0xe68(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe5e(%rip),%xmm0
movsd  0xe5e(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe54(%rip),%xmm0
movsd  0xe54(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe4a(%rip),%xmm0
movsd  0xe4a(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe40(%rip),%xmm0
movsd  0xe40(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe36(%rip),%xmm0
movsd  0xe36(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe2c(%rip),%xmm0
movsd  0xe2c(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe22(%rip),%xmm0
xorps  %xmm1,%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
lea    0xf21(%rip),%rdi
call   1030 <puts@plt>
lea    0xea4(%rip),%rbx
movsd  0xe02(%rip),%xmm0
mov    %rbx,%rdi
movsd  0xd07(%rip),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xdf0(%rip),%xmm0
mov    %rbx,%rdi
movsd  0xcfd(%rip),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xdde(%rip),%xmm0
mov    %rbx,%rdi
movsd  0xcf3(%rip),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xdcc(%rip),%xmm0
mov    %rbx,%rdi
movsd  0xce9(%rip),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xdba(%rip),%xmm0
mov    %rbx,%rdi
movsd  0xcdf(%rip),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xda8(%rip),%xmm0
mov    %rbx,%rdi
movsd  0xcd5(%rip),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xd96(%rip),%xmm0
mov    %rbx,%rdi
movsd  0xccb(%rip),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xd84(%rip),%xmm0
mov    %rbx,%rdi
movsd  0xcc1(%rip),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xd72(%rip),%xmm0
mov    %rbx,%rdi
movsd  0xcb7(%rip),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xd60(%rip),%xmm0
mov    %rbx,%rdi
movsd  0xcad(%rip),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xd4e(%rip),%xmm0
mov    %rbx,%rdi
movsd  0xca3(%rip),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xd3c(%rip),%xmm0
mov    %rbx,%rdi
movsd  0xc99(%rip),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
mov    %rbx,%rdi
movsd  0xc57(%rip),%xmm0
movsd  0xc8f(%rip),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xd10(%rip),%xmm0
mov    %rbx,%rdi
movsd  0xc85(%rip),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xcfe(%rip),%xmm0
mov    %rbx,%rdi
movsd  0xc7b(%rip),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xcec(%rip),%xmm0
xorps  %xmm1,%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [40 x i8] c"This is a simple program that converts\0A\00"
@.str.1 = [41 x i8] c"Celsius to Fahrenheit in decimal format\0A\00"
@.str.2 = [34 x i8] c"Celsius: %6.2f Fahrenheit: %3.1f\0A\00"
@.str.3 = [29 x i8] c"Now let's print the reverse\0A\00"
@.str.4 = [34 x i8] c"Fahrenheit: %6.2f Celsius: %3.1f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
store i32 0, i32* %1
store i32 0, i32* %4
store i32 300, i32* %5
store i32 20, i32* %6
store float 0x3FE1C71C80000000, float* %7
%8 = load i32, i32* %5
%9 = sitofp i32 %8 to float
store float %9, float* %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %17, %0
%13 = load float, float* %2
%14 = load i32, i32* %4
%15 = sitofp i32 %14 to float
%16 = fcmp oge float %13, %15
br i1 %16, label %17, label %31
17: ; preds = %12
%18 = load float, float* %7
%19 = load float, float* %2
%20 = fsub float %19, 3.200000e+01
%21 = fmul float %18, %20
store float %21, float* %3
%22 = load float, float* %3
%23 = fpext float %22 to double
%24 = load float, float* %2
%25 = fpext float %24 to double
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double %23, double %25)
%27 = load float, float* %2
%28 = load i32, i32* %6
%29 = sitofp i32 %28 to float
%30 = fsub float %27, %29
store float %30, float* %2
br label %12
31: ; preds = %12
%32 = load i32, i32* %5
%33 = sitofp i32 %32 to float
store float %33, float* %3
store float 0x3FFCCCCCC0000000, float* %7
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
br label %35
35: ; preds = %40, %31
%36 = load float, float* %3
%37 = load i32, i32* %4
%38 = sitofp i32 %37 to float
%39 = fcmp oge float %36, %38
br i1 %39, label %40, label %53
40: ; preds = %35
%41 = load float, float* %3
%42 = load float, float* %7
%43 = call float @llvm.fmuladd.f32(float %41, float %42, float 3.200000e+01)
store float %43, float* %2
%44 = load float, float* %2
%45 = fpext float %44 to double
%46 = load float, float* %3
%47 = fpext float %46 to double
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double %45, double %47)
%49 = load float, float* %3
%50 = load i32, i32* %6
%51 = sitofp i32 %50 to float
%52 = fsub float %49, %51
store float %52, float* %3
br label %35
53: ; preds = %35
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [34 x i8] c"Celsius: %6.2f Fahrenheit: %3.1f\0A\00"
@.str.4 = [34 x i8] c"Fahrenheit: %6.2f Celsius: %3.1f\0A\00"
@str = [39 x i8] c"This is a simple program that converts\00"
@str.5 = [40 x i8] c"Celsius to Fahrenheit in decimal format\00"
@str.6 = [28 x i8] c"Now let's print the reverse\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.5, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double 0x40629C71E0000000, double 3.000000e+02)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double 0x406138E3A0000000, double 2.800000e+02)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double 0x405FAAAAC0000000, double 2.600000e+02)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double 0x405CE38E40000000, double 2.400000e+02)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double 0x405A1C71E0000000, double 2.200000e+02)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double 0x4057555560000000, double 2.000000e+02)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double 0x40548E3900000000, double 1.800000e+02)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double 0x4051C71C80000000, double 1.600000e+02)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double 0x404E000020000000, double 1.400000e+02)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double 0x404871C740000000, double 1.200000e+02)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double 0x4042E38E40000000, double 1.000000e+02)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double 0x403AAAAAC0000000, double 8.000000e+01)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double 0x402F1C71E0000000, double 6.000000e+01)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double 0x4011C71C80000000, double 4.000000e+01)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double 0xC01AAAAAC0000000, double 2.000000e+01)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double 0xC031C71C80000000, double 0.000000e+00)
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.6, i64 0, i64 0))
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double 5.720000e+02, double 3.000000e+02)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double 5.360000e+02, double 2.800000e+02)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double 5.000000e+02, double 2.600000e+02)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double 4.640000e+02, double 2.400000e+02)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double 4.280000e+02, double 2.200000e+02)
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double 3.920000e+02, double 2.000000e+02)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double 3.560000e+02, double 1.800000e+02)
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double 3.200000e+02, double 1.600000e+02)
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double 2.840000e+02, double 1.400000e+02)
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double 2.480000e+02, double 1.200000e+02)
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double 2.120000e+02, double 1.000000e+02)
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double 1.760000e+02, double 8.000000e+01)
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double 1.400000e+02, double 6.000000e+01)
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double 1.040000e+02, double 4.000000e+01)
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double 6.800000e+01, double 2.000000e+01)
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double 3.200000e+01, double 0.000000e+00)
ret i32 0
}