#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 */
scalar_t__ floorf(float const);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  const float float_in[4] = {-1.1, -0.9, -0.1, 0.1};
  int int_out[4];
  int index;
  for (index = 0; index < 4; index++) {
    int_out[index] = (int)floorf(float_in[index]);
  }
  printf("Float inputs =");
  for (index = 0; index < 4; index++) {
    printf(" %g", float_in[index]);
  }
  printf("\n");
  printf("(int) floorf() outputs =");
  for (index = 0; index < 4; index++) {
    printf(" %d", int_out[index]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x4,-0x34(%rbp)
jge    1184 <main+0x64>
movslq -0x34(%rbp),%rax
movss  -0x20(%rbp,%rax,4),%xmm0
call   1040 <floorf@plt>
mov    %eax,%ecx
movslq -0x34(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1153 <main+0x33>
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x4,-0x34(%rbp)
jge    11cd <main+0xad>
movslq -0x34(%rbp),%rax
movss  -0x20(%rbp,%rax,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe67(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1199 <main+0x79>
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x4,-0x34(%rbp)
jge    121e <main+0xfe>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11f0 <main+0xd0>
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
movss  0xebf(%rip),%xmm0
call   1050 <floorf@plt>
mov    %rax,%r14
movss  0xeb3(%rip),%xmm0
call   1050 <floorf@plt>
mov    %rax,%r15
movss  0xea7(%rip),%xmm0
call   1050 <floorf@plt>
mov    %rax,%r12
movss  0xe9b(%rip),%xmm0
call   1050 <floorf@plt>
mov    %rax,%r13
lea    0xeb0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb1(%rip),%rbx
movsd  0xe7a(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0xe70(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0xe66(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0xe5c(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe5c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe67(%rip),%rbx
mov    %rbx,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.float_in = [4 x float] [float 0xBFF19999A0000000, float 0xBFECCCCCC0000000, float 0xBFB99999A0000000, float 0x3FB99999A0000000]
@.str = [15 x i8] c"Float inputs =\00"
@.str.1 = [4 x i8] c" %g\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [25 x i8] c"(int) floorf() outputs =\00"
@.str.4 = [4 x i8] c" %d\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4 x float]
%7 = alloca [4 x i32]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [4 x float]* %6 to i8*
store i32 0, i32* %8
br label %10
10: ; preds = %23, %2
%11 = load i32, i32* %8
%12 = icmp slt i32 %11, 4
br i1 %12, label %13, label %26
13: ; preds = %10
%14 = load i32, i32* %8
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [4 x float], [4 x float]* %6, i64 0, i64 %15
%17 = load float, float* %16
%18 = call i64 @floorf(float %17)
%19 = trunc i64 %18 to i32
%20 = load i32, i32* %8
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 %21
store i32 %19, i32* %22
br label %23
23: ; preds = %13
%24 = load i32, i32* %8
%25 = add nsw i32 %24, 1
store i32 %25, i32* %8
br label %10
26: ; preds = %10
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %8
br label %28
28: ; preds = %38, %26
%29 = load i32, i32* %8
%30 = icmp slt i32 %29, 4
br i1 %30, label %31, label %41
31: ; preds = %28
%32 = load i32, i32* %8
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [4 x float], [4 x float]* %6, i64 0, i64 %33
%35 = load float, float* %34
%36 = fpext float %35 to double
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %36)
br label %38
38: ; preds = %31
%39 = load i32, i32* %8
%40 = add nsw i32 %39, 1
store i32 %40, i32* %8
br label %28
41: ; preds = %28
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %8
br label %44
44: ; preds = %53, %41
%45 = load i32, i32* %8
%46 = icmp slt i32 %45, 4
br i1 %46, label %47, label %56
47: ; preds = %44
%48 = load i32, i32* %8
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %51)
br label %53
53: ; preds = %47
%54 = load i32, i32* %8
%55 = add nsw i32 %54, 1
store i32 %55, i32* %8
br label %44
56: ; preds = %44
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Float inputs =\00"
@.str.1 = [4 x i8] c" %g\00"
@.str.3 = [25 x i8] c"(int) floorf() outputs =\00"
@.str.4 = [4 x i8] c" %d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @floorf(float 0xBFF19999A0000000)
%4 = trunc i64 %3 to i32
%5 = tail call i64 @floorf(float 0xBFECCCCCC0000000)
%6 = trunc i64 %5 to i32
%7 = tail call i64 @floorf(float 0xBFB99999A0000000)
%8 = trunc i64 %7 to i32
%9 = tail call i64 @floorf(float 0x3FB99999A0000000)
%10 = trunc i64 %9 to i32
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double 0xBFF19999A0000000)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double 0xBFECCCCCC0000000)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double 0xBFB99999A0000000)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double 0x3FB99999A0000000)
%16 = tail call i32 @putchar(i32 10)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %4)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %6)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %8)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %10)
%22 = tail call i32 @putchar(i32 10)
ret i32 0
}