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

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ append_element(struct llist *, char *);
struct llist *create_llist();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(int /*<<< orphan*/ *);
struct llist *create_label_list(char argv[1000][200], int label_count) {
  struct llist *lbl_list = create_llist();
  if (NULL == lbl_list) {
    perror(NULL);
    exit(EXIT_FAILURE);
  }
  int i;
  for (i = 0; i < label_count; i++) {
    if (!append_element(lbl_list, argv[i])) {
      perror(NULL);
      exit(EXIT_FAILURE);
    }
  }
  return lbl_list;
}


x86 assembly (clang, -O0):
<create_label_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1040 <create_llist@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
jne    117d <create_label_list+0x3d>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <perror@plt>
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11de <create_label_list+0x9e>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x1c(%rbp),%rax
imul   $0xc8,%rax,%rax
add    %rax,%rsi
call   1030 <append_element@plt>
cmp    $0x0,%eax
jne    11cb <create_label_list+0x8b>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <perror@plt>
mov    0x2e1c(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
jmp    11d0 <create_label_list+0x90>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1184 <create_label_list+0x44>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_label_list>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <create_llist@plt>
test   %rax,%rax
je     1184 <create_label_list+0x44>
mov    %rax,%r14
test   %ebp,%ebp
jle    117c <create_label_list+0x3c>
mov    %ebp,%ebp
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <append_element@plt>
test   %eax,%eax
je     1184 <create_label_list+0x44>
add    $0xc8,%rbx
add    $0xffffffffffffffff,%rbp
jne    1160 <create_label_list+0x20>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret
xor    %edi,%edi
call   1050 <perror@plt>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
%struct.llist = type { i32 }
@EXIT_FAILURE = global i32 0
define %struct.llist* @create_label_list([200 x i8]* %0, i32 %1) {
%3 = alloca [200 x i8]*
%4 = alloca i32
%5 = alloca %struct.llist*
%6 = alloca i32
store [200 x i8]* %0, [200 x i8]** %3
store i32 %1, i32* %4
%7 = call %struct.llist* (...) @create_llist()
store %struct.llist* %7, %struct.llist** %5
%8 = load %struct.llist*, %struct.llist** %5
%9 = icmp eq %struct.llist* null, %8
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = call i32 @perror(i32* null)
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %2
store i32 0, i32* %6
br label %15
15: ; preds = %33, %14
%16 = load i32, i32* %6
%17 = load i32, i32* %4
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %36
19: ; preds = %15
%20 = load %struct.llist*, %struct.llist** %5
%21 = load [200 x i8]*, [200 x i8]** %3
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [200 x i8], [200 x i8]* %21, i64 %23
%25 = getelementptr inbounds [200 x i8], [200 x i8]* %24, i64 0, i64 0
%26 = call i32 @append_element(%struct.llist* %20, i8* %25)
%27 = icmp ne i32 %26, 0
br i1 %27, label %32, label %28
28: ; preds = %19
%29 = call i32 @perror(i32* null)
%30 = load i32, i32* @EXIT_FAILURE
%31 = call i32 @exit(i32 %30)
unreachable
32: ; preds = %19
br label %33
33: ; preds = %32
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 1
store i32 %35, i32* %6
br label %15
36: ; preds = %15
%37 = load %struct.llist*, %struct.llist** %5
ret %struct.llist* %37
}

LLVM IR (-O2):
%struct.llist = type { i32 }
@EXIT_FAILURE = global i32 0
define %struct.llist* @create_label_list([200 x i8]* %0, i32 %1) {
%3 = tail call %struct.llist* (...) @create_llist()
%4 = icmp eq %struct.llist* %3, null
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = icmp sgt i32 %1, 0
br i1 %6, label %7, label %25
7: ; preds = %5
%8 = zext i32 %1 to i64
br label %15
9: ; preds = %2
%10 = tail call i32 @perror(i32* null)
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %15
%14 = icmp eq i64 %20, %8
br i1 %14, label %25, label %15
15: ; preds = %7, %13
%16 = phi i64 [ 0, %7 ], [ %20, %13 ]
%17 = getelementptr inbounds [200 x i8], [200 x i8]* %0, i64 %16, i64 0
%18 = tail call i32 @append_element(%struct.llist* %3, i8* %17)
%19 = icmp eq i32 %18, 0
%20 = add nuw nsw i64 %16, 1
br i1 %19, label %21, label %13
21: ; preds = %15
%22 = tail call i32 @perror(i32* null)
%23 = load i32, i32* @EXIT_FAILURE
%24 = tail call i32 @exit(i32 %23)
unreachable
25: ; preds = %13, %5
ret %struct.llist* %3
}