#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 */
double ctof(float);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  float fahr, celsius;
  int lower, upper, step;
  lower = -40;
  upper = 180;
  step = 20;
  celsius = lower;
  printf("%5s  %8s", "deg C", "deg F\n");
  printf("--------------\n");
  while (celsius <= upper) {
    printf("%5.0f %8.1f\n", celsius, ctof(celsius));
    celsius += step;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffd8,-0x10(%rbp)
movl   $0xb4,-0x14(%rbp)
movl   $0x14,-0x18(%rbp)
cvtsi2ssl -0x10(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
lea    0xeab(%rip),%rdi
lea    0xead(%rip),%rsi
lea    0xeac(%rip),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm1
cvtsi2ssl -0x14(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     11cd <main+0xad>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <ctof@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
lea    0xe74(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
cvtsi2ssl -0x18(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1178 <main+0x58>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xf50(%rip),%rdi
lea    0xf52(%rip),%rsi
lea    0xf51(%rip),%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf57(%rip),%rdi
call   1030 <puts@plt>
movss  0xe9f(%rip),%xmm0
call   1050 <ctof@plt>
movaps %xmm0,%xmm1
lea    0xf2e(%rip),%rbx
movsd  0xeb8(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movss  0xe7a(%rip),%xmm0
call   1050 <ctof@plt>
movaps %xmm0,%xmm1
movsd  0xe9e(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
call   1050 <ctof@plt>
movaps %xmm0,%xmm1
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movss  0xe44(%rip),%xmm0
call   1050 <ctof@plt>
movaps %xmm0,%xmm1
movsd  0xe6c(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movss  0xe26(%rip),%xmm0
call   1050 <ctof@plt>
movaps %xmm0,%xmm1
movsd  0xe52(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movss  0xe08(%rip),%xmm0
call   1050 <ctof@plt>
movaps %xmm0,%xmm1
movsd  0xe38(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movss  0xdea(%rip),%xmm0
call   1050 <ctof@plt>
movaps %xmm0,%xmm1
movsd  0xe1e(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movss  0xdcc(%rip),%xmm0
call   1050 <ctof@plt>
movaps %xmm0,%xmm1
movsd  0xe04(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movss  0xdae(%rip),%xmm0
call   1050 <ctof@plt>
movaps %xmm0,%xmm1
movsd  0xdea(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movss  0xd90(%rip),%xmm0
call   1050 <ctof@plt>
movaps %xmm0,%xmm1
movsd  0xdd0(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movss  0xd72(%rip),%xmm0
call   1050 <ctof@plt>
movaps %xmm0,%xmm1
movsd  0xdb6(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movss  0xd54(%rip),%xmm0
call   1050 <ctof@plt>
movaps %xmm0,%xmm1
movsd  0xd9c(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%5s %8s\00"
@.str.1 = [6 x i8] c"deg C\00"
@.str.2 = [7 x i8] c"deg F\0A\00"
@.str.3 = [16 x i8] c"--------------\0A\00"
@.str.4 = [13 x i8] c"%5.0f %8.1f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 -40, i32* %4
store i32 180, i32* %5
store i32 20, i32* %6
%7 = load i32, i32* %4
%8 = sitofp i32 %7 to float
store float %8, float* %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %11
11: ; preds = %16, %0
%12 = load float, float* %3
%13 = load i32, i32* %5
%14 = sitofp i32 %13 to float
%15 = fcmp ole float %12, %14
br i1 %15, label %16, label %26
16: ; preds = %11
%17 = load float, float* %3
%18 = fpext float %17 to double
%19 = load float, float* %3
%20 = call double @ctof(float %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), double %18, double %20)
%22 = load i32, i32* %6
%23 = sitofp i32 %22 to float
%24 = load float, float* %3
%25 = fadd float %24, %23
store float %25, float* %3
br label %11
26: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%5s %8s\00"
@.str.1 = [6 x i8] c"deg C\00"
@.str.2 = [7 x i8] c"deg F\0A\00"
@.str.4 = [13 x i8] c"%5.0f %8.1f\0A\00"
@str = [15 x i8] c"--------------\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%3 = tail call double @ctof(float -4.000000e+01)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), double -4.000000e+01, double %3)
%5 = tail call double @ctof(float -2.000000e+01)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), double -2.000000e+01, double %5)
%7 = tail call double @ctof(float 0.000000e+00)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), double 0.000000e+00, double %7)
%9 = tail call double @ctof(float 2.000000e+01)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), double 2.000000e+01, double %9)
%11 = tail call double @ctof(float 4.000000e+01)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), double 4.000000e+01, double %11)
%13 = tail call double @ctof(float 6.000000e+01)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), double 6.000000e+01, double %13)
%15 = tail call double @ctof(float 8.000000e+01)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), double 8.000000e+01, double %15)
%17 = tail call double @ctof(float 1.000000e+02)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), double 1.000000e+02, double %17)
%19 = tail call double @ctof(float 1.200000e+02)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), double 1.200000e+02, double %19)
%21 = tail call double @ctof(float 1.400000e+02)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), double 1.400000e+02, double %21)
%23 = tail call double @ctof(float 1.600000e+02)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), double 1.600000e+02, double %23)
%25 = tail call double @ctof(float 1.800000e+02)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), double 1.800000e+02, double %25)
ret i32 0
}