#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 celsius_to_fahr(float);
float fahr_to_celsius(float);
int /*<<< orphan*/ printf(char *, ...);
main() {
  float fahr, celsius, fahrenheit;
  float lower, upper, step;
  lower = 0;
  upper = 300;
  step = 20;
  printf("%6s\t|%8s\t|%12s\n", "Fahr", "Celsius", "Fahrenheit");
  printf("---------------------------------------\n");
  fahr = lower;
  while (fahr <= upper) {
    celsius = fahr_to_celsius(fahr);
    fahrenheit = celsius_to_fahr(celsius);
    printf("%6.0f\t|%8.1f\t|%12.1f\n", fahr, celsius, fahrenheit);
    fahr = fahr + step;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xeb5(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xea4(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
lea    0xea0(%rip),%rdi
lea    0xea9(%rip),%rsi
lea    0xea7(%rip),%rdx
lea    0xea8(%rip),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0x18(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     120a <main+0xda>
movss  -0x8(%rbp),%xmm0
call   1040 <fahr_to_celsius@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
call   1050 <celsius_to_fahr@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x10(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xe6a(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    119c <main+0x6c>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xeb6(%rip),%rdi
lea    0xebf(%rip),%rsi
lea    0xebd(%rip),%rdx
lea    0xebe(%rip),%rcx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffec,%ebp
lea    0xeaa(%rip),%rbx
xchg   %ax,%ax
add    $0x14,%ebp
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
movss  %xmm0,0x4(%rsp)
call   1050 <fahr_to_celsius@plt>
movss  %xmm0,(%rsp)
call   1060 <celsius_to_fahr@plt>
movss  0x4(%rsp),%xmm1
xorps  %xmm3,%xmm3
cvtss2sd %xmm1,%xmm3
movss  (%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm0,%xmm2
mov    %rbx,%rdi
movaps %xmm3,%xmm0
mov    $0x3,%al
call   1040 <printf@plt>
cmp    $0x119,%ebp
jb     1180 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"%6s\09|%8s\09|%12s\0A\00"
@.str.1 = [5 x i8] c"Fahr\00"
@.str.2 = [8 x i8] c"Celsius\00"
@.str.3 = [11 x i8] c"Fahrenheit\00"
@.str.4 = [41 x i8] c"---------------------------------------\0A\00"
@.str.5 = [22 x i8] c"%6.0f\09|%8.1f\09|%12.1f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store i32 0, i32* %1
store float 0.000000e+00, float* %5
store float 3.000000e+02, float* %6
store float 2.000000e+01, float* %7
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0))
%10 = load float, float* %5
store float %10, float* %2
br label %11
11: ; preds = %15, %0
%12 = load float, float* %2
%13 = load float, float* %6
%14 = fcmp ole float %12, %13
br i1 %14, label %15, label %30
15: ; preds = %11
%16 = load float, float* %2
%17 = call float @fahr_to_celsius(float %16)
store float %17, float* %3
%18 = load float, float* %3
%19 = call float @celsius_to_fahr(float %18)
store float %19, float* %4
%20 = load float, float* %2
%21 = fpext float %20 to double
%22 = load float, float* %3
%23 = fpext float %22 to double
%24 = load float, float* %4
%25 = fpext float %24 to double
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), double %21, double %23, double %25)
%27 = load float, float* %2
%28 = load float, float* %7
%29 = fadd float %27, %28
store float %29, float* %2
br label %11
30: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"%6s\09|%8s\09|%12s\0A\00"
@.str.1 = [5 x i8] c"Fahr\00"
@.str.2 = [8 x i8] c"Celsius\00"
@.str.3 = [11 x i8] c"Fahrenheit\00"
@.str.5 = [22 x i8] c"%6.0f\09|%8.1f\09|%12.1f\0A\00"
@str = [40 x i8] c"---------------------------------------\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %12, %3 ]
%5 = sitofp i32 %4 to float
%6 = tail call float @fahr_to_celsius(float %5)
%7 = tail call float @celsius_to_fahr(float %6)
%8 = fpext float %5 to double
%9 = fpext float %6 to double
%10 = fpext float %7 to double
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), double %8, double %9, double %10)
%12 = add nuw nsw i32 %4, 20
%13 = icmp ugt i32 %4, 280
br i1 %13, label %14, label %3
14: ; preds = %3
ret i32 0
}