#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 _long_long_list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ long_long_list_add(struct _long_long_list *, long long);
struct _long_long_list *long_long_list_initial();
struct _long_long_list *long_long_list_initial_by_array(long long _array[],
                                                        int _size) {
  struct _long_long_list *s = long_long_list_initial();
  int i;
  for (i = 0; i < _size; i++)
    long_long_list_add(s, _array[i]);
  return s;
}


x86 assembly (clang, -O0):
<long_long_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 <long_long_list_initial@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1170 <long_long_list_initial_by_array+0x50>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <long_long_list_add@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1141 <long_long_list_initial_by_array+0x21>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<long_long_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 <long_long_list_initial@plt>
mov    %rax,%r15
test   %ebp,%ebp
jle    1155 <long_long_list_initial_by_array+0x35>
mov    %ebp,%ebp
xor    %ebx,%ebx
xchg   %ax,%ax
mov    (%r14,%rbx,8),%rsi
mov    %r15,%rdi
call   1040 <long_long_list_add@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1140 <long_long_list_initial_by_array+0x20>
mov    %r15,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct._long_long_list = type { i32 }
define %struct._long_long_list* @long_long_list_initial_by_array(i64* %0, i32 %1) {
%3 = alloca i64*
%4 = alloca i32
%5 = alloca %struct._long_long_list*
%6 = alloca i32
store i64* %0, i64** %3
store i32 %1, i32* %4
%7 = call %struct._long_long_list* (...) @long_long_list_initial()
store %struct._long_long_list* %7, %struct._long_long_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._long_long_list*, %struct._long_long_list** %5
%14 = load i64*, i64** %3
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i64, i64* %14, i64 %16
%18 = load i64, i64* %17
%19 = call i32 @long_long_list_add(%struct._long_long_list* %13, i64 %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._long_long_list*, %struct._long_long_list** %5
ret %struct._long_long_list* %24
}

LLVM IR (-O2):
%struct._long_long_list = type { i32 }
define %struct._long_long_list* @long_long_list_initial_by_array(i64* nocapture %0, i32 %1) {
%3 = tail call %struct._long_long_list* (...) @long_long_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 i64, i64* %0, i64 %8
%10 = load i64, i64* %9
%11 = tail call i32 @long_long_list_add(%struct._long_long_list* %3, i64 %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._long_long_list* %3
}