#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 myceil(float);
int myfloor(float);
int /*<<< orphan*/ printf(char *, float, double, ...);
double steal(float);
int main(void) {
  float array[5] = {49, 49.001, 49.5, 49.9, 50.0};
  for (int i = 0; i < 5; i++) {
    printf("%6.3f ceil=%2d floor=%2d\n", array[i], myceil(array[i]),
           myfloor(array[i]));
  }
  float value = 1.23456789;
  printf("value=%.8f steal=%.8f\n", value, steal(value));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb5(%rip),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    11dd <main+0x9d>
movslq -0x24(%rbp),%rax
movss  -0x20(%rbp,%rax,4),%xmm0
movss  %xmm0,-0x34(%rbp)
movslq -0x24(%rbp),%rax
movss  -0x20(%rbp,%rax,4),%xmm0
call   1050 <myceil@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movslq -0x24(%rbp),%rax
movss  -0x20(%rbp,%rax,4),%xmm0
call   1030 <myfloor@plt>
movss  -0x34(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
mov    %eax,%esi
lea    0xe5c(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1175 <main+0x35>
movss  0xe1b(%rip),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x28(%rbp),%xmm0
call   1040 <steal@plt>
movaps %xmm0,%xmm1
movss  -0x38(%rbp),%xmm0
lea    0xe31(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movss  0xeb3(%rip),%xmm0
call   1050 <myceil@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
movss  0xe99(%rip),%xmm0
call   1030 <myfloor@plt>
lea    0xea5(%rip),%rbx
mov    %rbx,%rdi
movss  0xe82(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
mov    %eax,%esi
mov    $0x2,%al
call   1060 <printf@plt>
movss  0xe6f(%rip),%xmm0
call   1050 <myceil@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
movss  0xe55(%rip),%xmm0
call   1030 <myfloor@plt>
mov    %rbx,%rdi
movss  0xe45(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
mov    %eax,%esi
mov    $0x2,%al
call   1060 <printf@plt>
movss  0xe32(%rip),%xmm0
call   1050 <myceil@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
movss  0xe18(%rip),%xmm0
call   1030 <myfloor@plt>
mov    %rbx,%rdi
movss  0xe08(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
mov    %eax,%esi
mov    $0x2,%al
call   1060 <printf@plt>
movss  0xdf5(%rip),%xmm0
call   1050 <myceil@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
movss  0xddb(%rip),%xmm0
call   1030 <myfloor@plt>
mov    %rbx,%rdi
movss  0xdcb(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
mov    %eax,%esi
mov    $0x2,%al
call   1060 <printf@plt>
movss  0xdb8(%rip),%xmm0
call   1050 <myceil@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
movss  0xd9e(%rip),%xmm0
call   1030 <myfloor@plt>
mov    %rbx,%rdi
movss  0xd8e(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
mov    %eax,%esi
mov    $0x2,%al
call   1060 <printf@plt>
movss  0xd7b(%rip),%xmm0
call   1040 <steal@plt>
movaps %xmm0,%xmm1
lea    0xd8a(%rip),%rdi
movss  0xd64(%rip),%xmm0
mov    $0x2,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.array = [5 x float] [float 4.900000e+01, float 0x40488020C0000000, float 4.950000e+01, float 0x4048F33340000000, float 5.000000e+01]
@.str = [26 x i8] c"%6.3f ceil=%2d floor=%2d\0A\00"
@.str.1 = [23 x i8] c"value=%.8f steal=%.8f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x float]
%3 = alloca i32
%4 = alloca float
store i32 0, i32* %1
%5 = bitcast [5 x float]* %2 to i8*
store i32 0, i32* %3
br label %6
6: ; preds = %26, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 5
br i1 %8, label %9, label %29
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 %11
%13 = load float, float* %12
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 %15
%17 = load float, float* %16
%18 = call i32 @myceil(float %17)
%19 = sitofp i32 %18 to double
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 %21
%23 = load float, float* %22
%24 = call i32 @myfloor(float %23)
%25 = call i32 (i8*, float, double, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), float %13, double %19, i32 %24)
br label %26
26: ; preds = %9
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %6
29: ; preds = %6
store float 0x3FF3C0CA40000000, float* %4
%30 = load float, float* %4
%31 = load float, float* %4
%32 = call double @steal(float %31)
%33 = call i32 (i8*, float, double, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), float %30, double %32)
%34 = load i32, i32* %1
ret i32 %34
}

LLVM IR (-O2):
@.str = [26 x i8] c"%6.3f ceil=%2d floor=%2d\0A\00"
@.str.1 = [23 x i8] c"value=%.8f steal=%.8f\0A\00"
define i32 @main() {
%1 = tail call i32 @myceil(float 4.900000e+01)
%2 = sitofp i32 %1 to double
%3 = tail call i32 @myfloor(float 4.900000e+01)
%4 = tail call i32 (i8*, float, double, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), float 4.900000e+01, double %2, i32 %3)
%5 = tail call i32 @myceil(float 0x40488020C0000000)
%6 = sitofp i32 %5 to double
%7 = tail call i32 @myfloor(float 0x40488020C0000000)
%8 = tail call i32 (i8*, float, double, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), float 0x40488020C0000000, double %6, i32 %7)
%9 = tail call i32 @myceil(float 4.950000e+01)
%10 = sitofp i32 %9 to double
%11 = tail call i32 @myfloor(float 4.950000e+01)
%12 = tail call i32 (i8*, float, double, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), float 4.950000e+01, double %10, i32 %11)
%13 = tail call i32 @myceil(float 0x4048F33340000000)
%14 = sitofp i32 %13 to double
%15 = tail call i32 @myfloor(float 0x4048F33340000000)
%16 = tail call i32 (i8*, float, double, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), float 0x4048F33340000000, double %14, i32 %15)
%17 = tail call i32 @myceil(float 5.000000e+01)
%18 = sitofp i32 %17 to double
%19 = tail call i32 @myfloor(float 5.000000e+01)
%20 = tail call i32 (i8*, float, double, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), float 5.000000e+01, double %18, i32 %19)
%21 = tail call double @steal(float 0x3FF3C0CA40000000)
%22 = tail call i32 (i8*, float, double, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), float 0x3FF3C0CA40000000, double %21)
ret i32 0
}