#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 */
typedef int /*<<< orphan*/ wchar_t;
struct _wchar_list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ wchar_list_add(struct _wchar_list *, int /*<<< orphan*/ *);
struct _wchar_list *wchar_list_initial();
struct _wchar_list *wchar_list_initial_by_array(wchar_t *_array[], int _size) {
  struct _wchar_list *s = wchar_list_initial();
  int i;
  for (i = 0; i < _size; i++)
    wchar_list_add(s, _array[i]);
  return s;
}


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

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

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

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