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

/* Variables and functions */
int /*<<< orphan*/ al_add(struct al *, int *);
struct al *al_create(int);
int /*<<< orphan*/ al_dump(struct al *);
int al_insertat(struct al *, int, int *);
int al_remove(struct al *, int *);
int al_removeat(struct al *, int);
int al_resize(struct al *, int);
int /*<<< orphan*/ free(struct al *);
int *new_int(int);
int /*<<< orphan*/ printf(char *, int);
main() {
  struct al *l;
  int *u;
  l = al_create(5);
  al_add(l, new_int(1));
  al_add(l, new_int(2));
  al_add(l, new_int(3));
  printf("%d\n", al_resize(l, 3));
  al_dump(l);
  al_insertat(l, 0, new_int(4));
  al_dump(l);
  printf("%d\n", al_insertat(l, 6, NULL));
  printf("%d\n", al_insertat(l, 3, new_int(5)));
  al_dump(l);
  printf("%d\n", al_removeat(l, 5));
  printf("%d\n", al_removeat(l, 4));
  printf("%d\n", al_insertat(l, 2, u = new_int(6)));
  al_dump(l);
  printf("%d\n", al_remove(l, u));
  al_dump(l);
  free(l);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x5,%edi
call   1040 <al_create@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    $0x1,%edi
call   1080 <new_int@plt>
mov    -0x48(%rbp),%rdi
mov    %rax,%rsi
call   1070 <al_add@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    $0x2,%edi
call   1080 <new_int@plt>
mov    -0x40(%rbp),%rdi
mov    %rax,%rsi
call   1070 <al_add@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    $0x3,%edi
call   1080 <new_int@plt>
mov    -0x38(%rbp),%rdi
mov    %rax,%rsi
call   1070 <al_add@plt>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   10c0 <al_resize@plt>
mov    %eax,%esi
lea    0xdd2(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1090 <al_dump@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    $0x4,%edi
call   1080 <new_int@plt>
mov    -0x30(%rbp),%rdi
mov    %rax,%rdx
xor    %esi,%esi
call   10a0 <al_insertat@plt>
mov    -0x10(%rbp),%rdi
call   1090 <al_dump@plt>
mov    -0x10(%rbp),%rdi
mov    $0x6,%esi
xor    %eax,%eax
mov    %eax,%edx
call   10a0 <al_insertat@plt>
mov    %eax,%esi
lea    0xd80(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    $0x5,%edi
call   1080 <new_int@plt>
mov    -0x28(%rbp),%rdi
mov    %rax,%rdx
mov    $0x3,%esi
call   10a0 <al_insertat@plt>
mov    %eax,%esi
lea    0xd4f(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1090 <al_dump@plt>
mov    -0x10(%rbp),%rdi
mov    $0x5,%esi
call   10b0 <al_removeat@plt>
mov    %eax,%esi
lea    0xd2a(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   10b0 <al_removeat@plt>
mov    %eax,%esi
lea    0xd0e(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    $0x6,%edi
call   1080 <new_int@plt>
mov    -0x20(%rbp),%rdi
mov    %rax,%rdx
mov    %rdx,-0x18(%rbp)
mov    $0x2,%esi
call   10a0 <al_insertat@plt>
mov    %eax,%esi
lea    0xcd9(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1090 <al_dump@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <al_remove@plt>
mov    %eax,%esi
lea    0xcb5(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1090 <al_dump@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x5,%edi
call   1040 <al_create@plt>
mov    %rax,%rbx
mov    $0x1,%edi
call   1080 <new_int@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1070 <al_add@plt>
mov    $0x2,%edi
call   1080 <new_int@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1070 <al_add@plt>
mov    $0x3,%edi
call   1080 <new_int@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1070 <al_add@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   10c0 <al_resize@plt>
lea    0xdfb(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1090 <al_dump@plt>
mov    $0x4,%edi
call   1080 <new_int@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %rax,%rdx
call   10a0 <al_insertat@plt>
mov    %rbx,%rdi
call   1090 <al_dump@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %edx,%edx
call   10a0 <al_insertat@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    $0x5,%edi
call   1080 <new_int@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %rax,%rdx
call   10a0 <al_insertat@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1090 <al_dump@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   10b0 <al_removeat@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   10b0 <al_removeat@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    $0x6,%edi
call   1080 <new_int@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %rax,%rdx
call   10a0 <al_insertat@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1090 <al_dump@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <al_remove@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1090 <al_dump@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.al = type { i32 }
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.al*
%3 = alloca i32*
store i32 0, i32* %1
%4 = call %struct.al* @al_create(i32 5)
store %struct.al* %4, %struct.al** %2
%5 = load %struct.al*, %struct.al** %2
%6 = call i32* @new_int(i32 1)
%7 = call i32 @al_add(%struct.al* %5, i32* %6)
%8 = load %struct.al*, %struct.al** %2
%9 = call i32* @new_int(i32 2)
%10 = call i32 @al_add(%struct.al* %8, i32* %9)
%11 = load %struct.al*, %struct.al** %2
%12 = call i32* @new_int(i32 3)
%13 = call i32 @al_add(%struct.al* %11, i32* %12)
%14 = load %struct.al*, %struct.al** %2
%15 = call i32 @al_resize(%struct.al* %14, i32 3)
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = load %struct.al*, %struct.al** %2
%18 = call i32 @al_dump(%struct.al* %17)
%19 = load %struct.al*, %struct.al** %2
%20 = call i32* @new_int(i32 4)
%21 = call i32 @al_insertat(%struct.al* %19, i32 0, i32* %20)
%22 = load %struct.al*, %struct.al** %2
%23 = call i32 @al_dump(%struct.al* %22)
%24 = load %struct.al*, %struct.al** %2
%25 = call i32 @al_insertat(%struct.al* %24, i32 6, i32* null)
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = load %struct.al*, %struct.al** %2
%28 = call i32* @new_int(i32 5)
%29 = call i32 @al_insertat(%struct.al* %27, i32 3, i32* %28)
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %29)
%31 = load %struct.al*, %struct.al** %2
%32 = call i32 @al_dump(%struct.al* %31)
%33 = load %struct.al*, %struct.al** %2
%34 = call i32 @al_removeat(%struct.al* %33, i32 5)
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %34)
%36 = load %struct.al*, %struct.al** %2
%37 = call i32 @al_removeat(%struct.al* %36, i32 4)
%38 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %37)
%39 = load %struct.al*, %struct.al** %2
%40 = call i32* @new_int(i32 6)
store i32* %40, i32** %3
%41 = call i32 @al_insertat(%struct.al* %39, i32 2, i32* %40)
%42 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %41)
%43 = load %struct.al*, %struct.al** %2
%44 = call i32 @al_dump(%struct.al* %43)
%45 = load %struct.al*, %struct.al** %2
%46 = load i32*, i32** %3
%47 = call i32 @al_remove(%struct.al* %45, i32* %46)
%48 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %47)
%49 = load %struct.al*, %struct.al** %2
%50 = call i32 @al_dump(%struct.al* %49)
%51 = load %struct.al*, %struct.al** %2
%52 = call i32 @free(%struct.al* %51)
ret i32 0
}

LLVM IR (-O2):
%struct.al = type { i32 }
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call %struct.al* @al_create(i32 5)
%2 = tail call i32* @new_int(i32 1)
%3 = tail call i32 @al_add(%struct.al* %1, i32* %2)
%4 = tail call i32* @new_int(i32 2)
%5 = tail call i32 @al_add(%struct.al* %1, i32* %4)
%6 = tail call i32* @new_int(i32 3)
%7 = tail call i32 @al_add(%struct.al* %1, i32* %6)
%8 = tail call i32 @al_resize(%struct.al* %1, i32 3)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = tail call i32 @al_dump(%struct.al* %1)
%11 = tail call i32* @new_int(i32 4)
%12 = tail call i32 @al_insertat(%struct.al* %1, i32 0, i32* %11)
%13 = tail call i32 @al_dump(%struct.al* %1)
%14 = tail call i32 @al_insertat(%struct.al* %1, i32 6, i32* null)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = tail call i32* @new_int(i32 5)
%17 = tail call i32 @al_insertat(%struct.al* %1, i32 3, i32* %16)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = tail call i32 @al_dump(%struct.al* %1)
%20 = tail call i32 @al_removeat(%struct.al* %1, i32 5)
%21 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = tail call i32 @al_removeat(%struct.al* %1, i32 4)
%23 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = tail call i32* @new_int(i32 6)
%25 = tail call i32 @al_insertat(%struct.al* %1, i32 2, i32* %24)
%26 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = tail call i32 @al_dump(%struct.al* %1)
%28 = tail call i32 @al_remove(%struct.al* %1, i32* %24)
%29 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %28)
%30 = tail call i32 @al_dump(%struct.al* %1)
%31 = tail call i32 @free(%struct.al* %1)
ret i32 0
}