#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 */
struct _float_list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ float_list_add(struct _float_list *, float);
struct _float_list *float_list_initial();
struct _float_list *float_list_initial_by_array(float _array[], int _size) {
  struct _float_list *s = float_list_initial();
  int i;
  for (i = 0; i < _size; i++)
    float_list_add(s, _array[i]);
  return s;
}


x86 assembly (clang, -O0):
<float_list_initial_by_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <float_list_initial@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1171 <float_list_initial_by_array+0x51>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
call   1040 <float_list_add@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1141 <float_list_initial_by_array+0x21>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<float_list_initial_by_array>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%r14
xor    %eax,%eax
call   1030 <float_list_initial@plt>
mov    %rax,%r15
test   %ebp,%ebp
jle    1157 <float_list_initial_by_array+0x37>
mov    %ebp,%ebp
xor    %ebx,%ebx
xchg   %ax,%ax
movss  (%r14,%rbx,4),%xmm0
mov    %r15,%rdi
call   1040 <float_list_add@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1140 <float_list_initial_by_array+0x20>
mov    %r15,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct._float_list = type { i32 }
define %struct._float_list* @float_list_initial_by_array(float* %0, i32 %1) {
%3 = alloca float*
%4 = alloca i32
%5 = alloca %struct._float_list*
%6 = alloca i32
store float* %0, float** %3
store i32 %1, i32* %4
%7 = call %struct._float_list* (...) @float_list_initial()
store %struct._float_list* %7, %struct._float_list** %5
store i32 0, i32* %6
br label %8
8: ; preds = %20, %2
%9 = load i32, i32* %6
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %23
12: ; preds = %8
%13 = load %struct._float_list*, %struct._float_list** %5
%14 = load float*, float** %3
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds float, float* %14, i64 %16
%18 = load float, float* %17
%19 = call i32 @float_list_add(%struct._float_list* %13, float %18)
br label %20
20: ; preds = %12
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 1
store i32 %22, i32* %6
br label %8
23: ; preds = %8
%24 = load %struct._float_list*, %struct._float_list** %5
ret %struct._float_list* %24
}

LLVM IR (-O2):
%struct._float_list = type { i32 }
define %struct._float_list* @float_list_initial_by_array(float* nocapture %0, i32 %1) {
%3 = tail call %struct._float_list* (...) @float_list_initial()
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %14
5: ; preds = %2
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %12, %7 ]
%9 = getelementptr inbounds float, float* %0, i64 %8
%10 = load float, float* %9
%11 = tail call i32 @float_list_add(%struct._float_list* %3, float %10)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %6
br i1 %13, label %14, label %7
14: ; preds = %7, %2
ret %struct._float_list* %3
}