#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 */
int /*<<< orphan*/ lst_append(void *, int);
void *lst_create();
int /*<<< orphan*/ lst_destroy(void *);
int lst_get(void *, int, int *);
int /*<<< orphan*/ lst_insert(void *, int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  void *lst;
  int v;
  lst = lst_create();
  lst_insert(lst, 1, 11);
  lst_append(lst, 11);
  lst_append(lst, 5);
  lst_insert(lst, 2, 8);
  lst_insert(lst, 1, 7);
  lst_insert(lst, 10, 2);
  if (lst_get(lst, 3, &v) == 1)
    printf("v: %d\n", v);
  if (lst_get(lst, 6, &v) == 1)
    printf("v: %d\n", v);
  lst_destroy(lst);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <lst_create@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
mov    $0xb,%edx
call   1070 <lst_insert@plt>
mov    -0x10(%rbp),%rdi
mov    $0xb,%esi
call   1080 <lst_append@plt>
mov    -0x10(%rbp),%rdi
mov    $0x5,%esi
call   1080 <lst_append@plt>
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
mov    $0x8,%edx
call   1070 <lst_insert@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
mov    $0x7,%edx
call   1070 <lst_insert@plt>
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
mov    $0x2,%edx
call   1070 <lst_insert@plt>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
lea    -0x14(%rbp),%rdx
call   1040 <lst_get@plt>
cmp    $0x1,%eax
jne    120c <main+0xac>
mov    -0x14(%rbp),%esi
lea    0xdf9(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x6,%esi
lea    -0x14(%rbp),%rdx
call   1040 <lst_get@plt>
cmp    $0x1,%eax
jne    1236 <main+0xd6>
mov    -0x14(%rbp),%esi
lea    0xdcf(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1060 <lst_destroy@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1030 <lst_create@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x1,%esi
mov    $0xb,%edx
call   1070 <lst_insert@plt>
mov    %rbx,%rdi
mov    $0xb,%esi
call   1080 <lst_append@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1080 <lst_append@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x8,%edx
call   1070 <lst_insert@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x7,%edx
call   1070 <lst_insert@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x2,%edx
call   1070 <lst_insert@plt>
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <lst_get@plt>
cmp    $0x1,%eax
jne    11f8 <main+0x98>
mov    0xc(%rsp),%esi
lea    0xe0d(%rip),%rdi
call   1050 <printf@plt>
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x6,%esi
call   1040 <lst_get@plt>
cmp    $0x1,%eax
jne    121f <main+0xbf>
mov    0xc(%rsp),%esi
lea    0xde6(%rip),%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1060 <lst_destroy@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"v: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
store i32 0, i32* %1
%4 = call i8* (...) @lst_create()
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @lst_insert(i8* %5, i32 1, i32 11)
%7 = load i8*, i8** %2
%8 = call i32 @lst_append(i8* %7, i32 11)
%9 = load i8*, i8** %2
%10 = call i32 @lst_append(i8* %9, i32 5)
%11 = load i8*, i8** %2
%12 = call i32 @lst_insert(i8* %11, i32 2, i32 8)
%13 = load i8*, i8** %2
%14 = call i32 @lst_insert(i8* %13, i32 1, i32 7)
%15 = load i8*, i8** %2
%16 = call i32 @lst_insert(i8* %15, i32 10, i32 2)
%17 = load i8*, i8** %2
%18 = call i32 @lst_get(i8* %17, i32 3, i32* %3)
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %23
20: ; preds = %0
%21 = load i32, i32* %3
%22 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %20, %0
%24 = load i8*, i8** %2
%25 = call i32 @lst_get(i8* %24, i32 6, i32* %3)
%26 = icmp eq i32 %25, 1
br i1 %26, label %27, label %30
27: ; preds = %23
%28 = load i32, i32* %3
%29 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %27, %23
%31 = load i8*, i8** %2
%32 = call i32 @lst_destroy(i8* %31)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"v: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i8* (...) @lst_create()
%4 = tail call i32 @lst_insert(i8* %3, i32 1, i32 11)
%5 = tail call i32 @lst_append(i8* %3, i32 11)
%6 = tail call i32 @lst_append(i8* %3, i32 5)
%7 = tail call i32 @lst_insert(i8* %3, i32 2, i32 8)
%8 = tail call i32 @lst_insert(i8* %3, i32 1, i32 7)
%9 = tail call i32 @lst_insert(i8* %3, i32 10, i32 2)
%10 = call i32 @lst_get(i8* %3, i32 3, i32* %1)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = load i32, i32* %1
%14 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %12, %0
%16 = call i32 @lst_get(i8* %3, i32 6, i32* %1)
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* %1
%20 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %18, %15
%22 = call i32 @lst_destroy(i8* %3)
ret i32 0
}