#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*/ print(char *);
int /*<<< orphan*/ printid(int);
int round(float);
int main() {
  float a = 2.304692654015389;
  int b;
  b = round(a);
  print("a 2.304692654015389");
  printid(a);
  print("b 2");
  printid(b);
  a = -2.304692654015389;
  print("a -2.304692654015389");
  printid(a);
  b = round(a);
  print("b -2");
  printid(b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xebd(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
call   1050 <round@plt>
mov    %eax,-0xc(%rbp)
lea    0xea8(%rip),%rdi
call   1030 <print@plt>
cvttss2si -0x8(%rbp),%edi
call   1040 <printid@plt>
lea    0xea6(%rip),%rdi
call   1030 <print@plt>
mov    -0xc(%rbp),%edi
call   1040 <printid@plt>
movss  0xe75(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
lea    0xe89(%rip),%rdi
call   1030 <print@plt>
cvttss2si -0x8(%rbp),%edi
call   1040 <printid@plt>
movss  -0x8(%rbp),%xmm0
call   1050 <round@plt>
mov    %eax,-0xc(%rbp)
lea    0xe7b(%rip),%rdi
call   1030 <print@plt>
mov    -0xc(%rbp),%edi
call   1040 <printid@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
movss  0xec7(%rip),%xmm0
call   1050 <round@plt>
mov    %eax,%ebx
lea    0xec1(%rip),%rdi
call   1030 <print@plt>
mov    $0x2,%edi
call   1040 <printid@plt>
lea    0xebf(%rip),%rdi
call   1030 <print@plt>
mov    %ebx,%edi
call   1040 <printid@plt>
lea    0xeb0(%rip),%rdi
call   1030 <print@plt>
mov    $0xfffffffe,%edi
call   1040 <printid@plt>
movss  0xe7d(%rip),%xmm0
call   1050 <round@plt>
mov    %eax,%ebx
lea    0xea0(%rip),%rdi
call   1030 <print@plt>
mov    %ebx,%edi
call   1040 <printid@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"a 2.304692654015389\00"
@.str.1 = [4 x i8] c"b 2\00"
@.str.2 = [21 x i8] c"a -2.304692654015389\00"
@.str.3 = [5 x i8] c"b -2\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32
store i32 0, i32* %1
store float 0x40027002C0000000, float* %2
%4 = load float, float* %2
%5 = call i32 @round(float %4)
store i32 %5, i32* %3
%6 = call i32 @print(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%7 = load float, float* %2
%8 = fptosi float %7 to i32
%9 = call i32 @printid(i32 %8)
%10 = call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* %3
%12 = call i32 @printid(i32 %11)
store float 0xC0027002C0000000, float* %2
%13 = call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%14 = load float, float* %2
%15 = fptosi float %14 to i32
%16 = call i32 @printid(i32 %15)
%17 = load float, float* %2
%18 = call i32 @round(float %17)
store i32 %18, i32* %3
%19 = call i32 @print(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%20 = load i32, i32* %3
%21 = call i32 @printid(i32 %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"a 2.304692654015389\00"
@.str.1 = [4 x i8] c"b 2\00"
@.str.2 = [21 x i8] c"a -2.304692654015389\00"
@.str.3 = [5 x i8] c"b -2\00"
define i32 @main() {
%1 = tail call i32 @round(float 0x40027002C0000000)
%2 = tail call i32 @print(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @printid(i32 2)
%4 = tail call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @printid(i32 %1)
%6 = tail call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @printid(i32 -2)
%8 = tail call i32 @round(float 0xC0027002C0000000)
%9 = tail call i32 @print(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%10 = tail call i32 @printid(i32 %8)
ret i32 0
}