#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
int main() {
  double tk, tc, tf;
  int step;
  step = 10;
  printf("%10s | %10s | %10s\n", "Kelvin", "Celsius", "Fahrenheit");
  printf("-----------+------------+-----------\n");
  for (tk = 0; tk <= 1000; tk += step) {
    tc = tk - 273.15;
    tf = tk * 9.0 / 5.0 - 459.67;
    printf("%10.2f | %10.2f | %10.2f\n", tk, tc, tf);
    if (tk >= 300)
      step = 100;
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x24(%rbp)
lea    0xf03(%rip),%rdi
lea    0xf10(%rip),%rsi
lea    0xf10(%rip),%rdx
lea    0xf11(%rip),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe99(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1206 <main+0xf6>
movsd  -0x10(%rbp),%xmm0
movsd  0xea9(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe90(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xe7b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe67(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
lea    0xebc(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  0xe2c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11ed <main+0xdd>
movl   $0x64,-0x24(%rbp)
jmp    11f2 <main+0xe2>
cvtsi2sdl -0x24(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    115f <main+0x4f>
mov    0x2dd3(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xf01(%rip),%rdi
lea    0xf0e(%rip),%rsi
lea    0xf0e(%rip),%rdx
lea    0xf0f(%rip),%rcx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf26(%rip),%rdi
call   1030 <puts@plt>
xorpd  %xmm2,%xmm2
mov    $0xa,%ebp
lea    0xef7(%rip),%r14
mov    $0x64,%ebx
nopl   0x0(%rax)
movsd  %xmm2,0x8(%rsp)
movapd %xmm2,%xmm1
addsd  0xe7e(%rip),%xmm1
mulsd  0xe7e(%rip),%xmm2
divsd  0xe7e(%rip),%xmm2
addsd  0xe7e(%rip),%xmm2
mov    %r14,%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x3,%al
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
ucomisd 0xe68(%rip),%xmm0
cmovae %ebx,%ebp
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x8(%rsp),%xmm2
movsd  0xe48(%rip),%xmm0
ucomisd %xmm2,%xmm0
jae    1170 <main+0x50>
mov    0x2df3(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"%10s | %10s | %10s\0A\00"
@.str.1 = [7 x i8] c"Kelvin\00"
@.str.2 = [8 x i8] c"Celsius\00"
@.str.3 = [11 x i8] c"Fahrenheit\00"
@.str.4 = [38 x i8] c"-----------+------------+-----------\0A\00"
@.str.5 = [26 x i8] c"%10.2f | %10.2f | %10.2f\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 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))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
store double 0.000000e+00, double* %2
br label %8
8: ; preds = %26, %0
%9 = load double, double* %2
%10 = fcmp ole double %9, 1.000000e+03
br i1 %10, label %11, label %31
11: ; preds = %8
%12 = load double, double* %2
%13 = fsub double %12, 2.731500e+02
store double %13, double* %3
%14 = load double, double* %2
%15 = fmul double %14, 9.000000e+00
%16 = fdiv double %15, 5.000000e+00
%17 = fsub double %16, 4.596700e+02
store double %17, double* %4
%18 = load double, double* %2
%19 = load double, double* %3
%20 = load double, double* %4
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), double %18, double %19, double %20)
%22 = load double, double* %2
%23 = fcmp oge double %22, 3.000000e+02
br i1 %23, label %24, label %25
24: ; preds = %11
store i32 100, i32* %5
br label %25
25: ; preds = %24, %11
br label %26
26: ; preds = %25
%27 = load i32, i32* %5
%28 = sitofp i32 %27 to double
%29 = load double, double* %2
%30 = fadd double %29, %28
store double %30, double* %2
br label %8
31: ; preds = %8
%32 = load i32, i32* @EXIT_SUCCESS
ret i32 %32
}

LLVM IR (-O2):
@.str = [20 x i8] c"%10s | %10s | %10s\0A\00"
@.str.1 = [7 x i8] c"Kelvin\00"
@.str.2 = [8 x i8] c"Celsius\00"
@.str.3 = [11 x i8] c"Fahrenheit\00"
@.str.5 = [26 x i8] c"%10.2f | %10.2f | %10.2f\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [37 x i8] c"-----------+------------+-----------\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 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 ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 10, %0 ], [ %12, %3 ]
%5 = phi double [ 0.000000e+00, %0 ], [ %14, %3 ]
%6 = fadd double %5, -2.731500e+02
%7 = fmul double %5, 9.000000e+00
%8 = fdiv double %7, 5.000000e+00
%9 = fadd double %8, -4.596700e+02
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), double %5, double %6, double %9)
%11 = fcmp ult double %5, 3.000000e+02
%12 = select i1 %11, i32 %4, i32 100
%13 = sitofp i32 %12 to double
%14 = fadd double %5, %13
%15 = fcmp ugt double %14, 1.000000e+03
br i1 %15, label %16, label %3
16: ; preds = %3
%17 = load i32, i32* @EXIT_SUCCESS
ret i32 %17
}