#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 *, ...);
void tempconv(int lower, int upper, int step) {
  double fahr, celsuis;
  printf("Fahr Celsuis\n");
  fahr = lower;
  while (fahr <= upper) {
    celsuis = (5.0 / 9.0) * (fahr - 32.0);
    printf("%3.0f %6.1f\n", fahr, celsuis);
    fahr += step;
  }
}


x86 assembly (clang, -O0):
<tempconv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
lea    0xee8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm1
cvtsi2sdl -0x8(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     119b <tempconv+0x8b>
movsd  -0x18(%rbp),%xmm1
movsd  0xeae(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xe9a(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xe9e(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
cvtsi2sdl -0xc(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1139 <tempconv+0x29>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tempconv>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xee7(%rip),%rdi
call   1030 <puts@plt>
cvtsi2sd %ebx,%xmm1
cvtsi2sd %ebp,%xmm0
ucomisd %xmm1,%xmm0
jb     11ae <tempconv+0x8e>
cvtsi2sd %r14d,%xmm2
movsd  %xmm2,0x10(%rsp)
lea    0xeb5(%rip),%rbx
movsd  %xmm0,0x18(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  %xmm1,0x8(%rsp)
addsd  0xe82(%rip),%xmm1
mulsd  0xe82(%rip),%xmm1
mov    %rbx,%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0x18(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
addsd  0x10(%rsp),%xmm1
ucomisd %xmm1,%xmm0
jae    1170 <tempconv+0x50>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.1 = [13 x i8] c"%3.0f %6.1f\0A\00"
@str = [13 x i8] c"Fahr Celsuis\00"
define void @tempconv(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%5 = sitofp i32 %0 to double
%6 = sitofp i32 %1 to double
%7 = fcmp ugt double %5, %6
br i1 %7, label %17, label %8
8: ; preds = %3
%9 = sitofp i32 %2 to double
br label %10
10: ; preds = %8, %10
%11 = phi double [ %5, %8 ], [ %15, %10 ]
%12 = fadd double %11, -3.200000e+01
%13 = fmul double %12, 0x3FE1C71C71C71C72
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %11, double %13)
%15 = fadd double %11, %9
%16 = fcmp ugt double %15, %6
br i1 %16, label %17, label %10
17: ; preds = %10, %3
ret void
}