#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 *, ...);
double rint(int);
int main() {
  float c;
  printf("Avec le cast\n");
  for (c = 0.0; c <= 20.0; c += 0.5)
    printf("%4.1f Degres valent %2d Fahrenheit\n", c, (int)(9 * c) / 5 + 32);
  printf("Avec le rint\n");
  for (c = 0.0; c <= 20.0; c += 0.5)
    printf("%4.1f Degres valent %4.2f Fahrenheit\n", c, rint((9 * c) / 5 + 32));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xeaa(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     11b8 <main+0x98>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0xea7(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
cvttss2si %xmm1,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
add    $0x20,%esi
lea    0xe9c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe62(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    1145 <main+0x25>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe21(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     125e <main+0x13e>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movss  0xe19(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  0xe08(%rip),%xmm1
divss  %xmm1,%xmm0
movss  0xdf8(%rip),%xmm1
addss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
call   1040 <rint@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
lea    0xe28(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdbc(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    11ce <main+0xae>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xf22(%rip),%rdi
call   1030 <puts@plt>
xorps  %xmm1,%xmm1
lea    0xec9(%rip),%rbx
nopl   0x0(%rax,%rax,1)
movss  %xmm1,0x4(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movss  0x4(%rsp),%xmm1
mulss  0xe95(%rip),%xmm1
cvttss2si %xmm1,%eax
cltq
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
sar    $0x21,%rcx
shr    $0x3f,%rax
lea    (%rcx,%rax,1),%esi
add    $0x20,%esi
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x4(%rsp),%xmm1
addss  0xe63(%rip),%xmm1
movss  0xe5f(%rip),%xmm0
ucomiss %xmm1,%xmm0
jae    1150 <main+0x20>
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
xorps  %xmm0,%xmm0
lea    0xe74(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movss  %xmm0,0x4(%rsp)
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
movss  0x4(%rsp),%xmm0
mulss  0xe12(%rip),%xmm0
divss  0xe16(%rip),%xmm0
addss  0xe12(%rip),%xmm0
cvttss2si %xmm0,%edi
call   1050 <rint@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x2,%al
call   1040 <printf@plt>
movss  0x4(%rsp),%xmm0
addss  0xddc(%rip),%xmm0
movss  %xmm0,0x4(%rsp)
movss  0xdd2(%rip),%xmm0
ucomiss 0x4(%rsp),%xmm0
movss  0x4(%rsp),%xmm0
jae    11d0 <main+0xa0>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Avec le cast\0A\00"
@.str.1 = [36 x i8] c"%4.1f Degres valent %2d Fahrenheit\0A\00"
@.str.2 = [14 x i8] c"Avec le rint\0A\00"
@.str.3 = [38 x i8] c"%4.1f Degres valent %4.2f Fahrenheit\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store float 0.000000e+00, float* %2
br label %4
4: ; preds = %17, %0
%5 = load float, float* %2
%6 = fpext float %5 to double
%7 = fcmp ole double %6, 2.000000e+01
br i1 %7, label %8, label %22
8: ; preds = %4
%9 = load float, float* %2
%10 = fpext float %9 to double
%11 = load float, float* %2
%12 = fmul float 9.000000e+00, %11
%13 = fptosi float %12 to i32
%14 = sdiv i32 %13, 5
%15 = add nsw i32 %14, 32
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), double %10, i32 %15)
br label %17
17: ; preds = %8
%18 = load float, float* %2
%19 = fpext float %18 to double
%20 = fadd double %19, 5.000000e-01
%21 = fptrunc double %20 to float
store float %21, float* %2
br label %4
22: ; preds = %4
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
store float 0.000000e+00, float* %2
br label %24
24: ; preds = %38, %22
%25 = load float, float* %2
%26 = fpext float %25 to double
%27 = fcmp ole double %26, 2.000000e+01
br i1 %27, label %28, label %43
28: ; preds = %24
%29 = load float, float* %2
%30 = fpext float %29 to double
%31 = load float, float* %2
%32 = fmul float 9.000000e+00, %31
%33 = fdiv float %32, 5.000000e+00
%34 = fadd float %33, 3.200000e+01
%35 = fptosi float %34 to i32
%36 = call double @rint(i32 %35)
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), double %30, double %36)
br label %38
38: ; preds = %28
%39 = load float, float* %2
%40 = fpext float %39 to double
%41 = fadd double %40, 5.000000e-01
%42 = fptrunc double %41 to float
store float %42, float* %2
br label %24
43: ; preds = %24
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [36 x i8] c"%4.1f Degres valent %2d Fahrenheit\0A\00"
@.str.3 = [38 x i8] c"%4.1f Degres valent %4.2f Fahrenheit\0A\00"
@str = [13 x i8] c"Avec le cast\00"
@str.4 = [13 x i8] c"Avec le rint\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
%3 = phi float [ 0.000000e+00, %0 ], [ %10, %2 ]
%4 = fpext float %3 to double
%5 = fmul float %3, 9.000000e+00
%6 = fptosi float %5 to i32
%7 = sdiv i32 %6, 5
%8 = add nsw i32 %7, 32
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), double %4, i32 %8)
%10 = fadd float %3, 5.000000e-01
%11 = fcmp ugt float %10, 2.000000e+01
br i1 %11, label %12, label %2
12: ; preds = %2
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.4, i64 0, i64 0))
br label %14
14: ; preds = %12, %14
%15 = phi float [ 0.000000e+00, %12 ], [ %23, %14 ]
%16 = fpext float %15 to double
%17 = fmul float %15, 9.000000e+00
%18 = fdiv float %17, 5.000000e+00
%19 = fadd float %18, 3.200000e+01
%20 = fptosi float %19 to i32
%21 = tail call double @rint(i32 %20)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), double %16, double %21)
%23 = fadd float %15, 5.000000e-01
%24 = fcmp ugt float %23, 2.000000e+01
br i1 %24, label %25, label %14
25: ; preds = %14
ret i32 0
}