#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 *, float, float);
int convert(int upper) {
  float fahr, celsius;
  int lower, step;
  lower = 0;
  step = 20;
  fahr = lower;
  while (fahr <= upper) {
    celsius = (5.0 / 9.0) * (fahr - 32.0);
    printf("%3.0f %6.1f\n", fahr, celsius);
    fahr = fahr + step;
  }
}


x86 assembly (clang, -O0):
<convert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x14,-0x18(%rbp)
cvtsi2ssl -0x14(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm1
cvtsi2ssl -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     119e <convert+0x8e>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xeb1(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xe9d(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x18(%rbp),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1133 <convert+0x23>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert>:
push   %rbx
sub    $0x10,%rsp
test   %edi,%edi
js     118c <convert+0x7c>
cvtsi2ss %edi,%xmm0
movss  %xmm0,0xc(%rsp)
xorps  %xmm0,%xmm0
lea    0xee7(%rip),%rbx
nopl   (%rax)
movss  %xmm0,0x8(%rsp)
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xeb8(%rip),%xmm0
mulsd  0xeb8(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
mov    %rbx,%rdi
movss  0x8(%rsp),%xmm0
call   1030 <printf@plt>
movss  0x8(%rsp),%xmm0
addss  0xe9d(%rip),%xmm0
movss  %xmm0,0x8(%rsp)
movss  0xc(%rsp),%xmm0
ucomiss 0x8(%rsp),%xmm0
movss  0x8(%rsp),%xmm0
jae    1130 <convert+0x20>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"%3.0f %6.1f\0A\00"
define i32 @convert(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = alloca float
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i32 0, i32* %6
store i32 20, i32* %7
%8 = load i32, i32* %6
%9 = sitofp i32 %8 to float
store float %9, float* %4
br label %10
10: ; preds = %15, %1
%11 = load float, float* %4
%12 = load i32, i32* %3
%13 = sitofp i32 %12 to float
%14 = fcmp ole float %11, %13
br i1 %14, label %15, label %28
15: ; preds = %10
%16 = load float, float* %4
%17 = fpext float %16 to double
%18 = fsub double %17, 3.200000e+01
%19 = fmul double 0x3FE1C71C71C71C72, %18
%20 = fptrunc double %19 to float
store float %20, float* %5
%21 = load float, float* %4
%22 = load float, float* %5
%23 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), float %21, float %22)
%24 = load float, float* %4
%25 = load i32, i32* %7
%26 = sitofp i32 %25 to float
%27 = fadd float %24, %26
store float %27, float* %4
br label %10
28: ; preds = %10
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
@.str = [13 x i8] c"%3.0f %6.1f\0A\00"
define i32 @convert(i32 %0) {
%2 = sitofp i32 %0 to float
%3 = icmp slt i32 %0, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi float [ %11, %4 ], [ 0.000000e+00, %1 ]
%6 = fpext float %5 to double
%7 = fadd double %6, -3.200000e+01
%8 = fmul double %7, 0x3FE1C71C71C71C72
%9 = fptrunc double %8 to float
%10 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), float %5, float %9)
%11 = fadd float %5, 2.000000e+01
%12 = fcmp ugt float %11, %2
br i1 %12, label %13, label %4
13: ; preds = %4, %1
ret i32 undef
}