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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
struct vector *vectorCreate();
struct vector *vectorDelete(struct vector *);
int vectorGet(struct vector *, int);
int vectorLength(struct vector *);
int /*<<< orphan*/ vectorSet(struct vector *, int, int);
int main(void) {
  struct vector *v0 = vectorCreate();
  vectorSet(v0, 10, 2);
  printf("%d\n", vectorGet(v0, 100));
  printf("%d\n", vectorGet(v0, 10));
  printf("%d\n", vectorLength(v0));
  v0 = vectorDelete(v0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <vectorCreate@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
mov    $0x2,%edx
call   1080 <vectorSet@plt>
mov    -0x10(%rbp),%rdi
mov    $0x64,%esi
call   1060 <vectorGet@plt>
mov    %eax,%esi
lea    0xe5c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1060 <vectorGet@plt>
mov    %eax,%esi
lea    0xe40(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1070 <vectorLength@plt>
mov    %eax,%esi
lea    0xe29(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <vectorDelete@plt>
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <vectorCreate@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0xa,%esi
mov    $0x2,%edx
call   1080 <vectorSet@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
call   1060 <vectorGet@plt>
lea    0xe6c(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1060 <vectorGet@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1070 <vectorLength@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <vectorDelete@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.vector = type { i32 }
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.vector*
store i32 0, i32* %1
%3 = call %struct.vector* (...) @vectorCreate()
store %struct.vector* %3, %struct.vector** %2
%4 = load %struct.vector*, %struct.vector** %2
%5 = call i32 @vectorSet(%struct.vector* %4, i32 10, i32 2)
%6 = load %struct.vector*, %struct.vector** %2
%7 = call i32 @vectorGet(%struct.vector* %6, i32 100)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load %struct.vector*, %struct.vector** %2
%10 = call i32 @vectorGet(%struct.vector* %9, i32 10)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load %struct.vector*, %struct.vector** %2
%13 = call i32 @vectorLength(%struct.vector* %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = load %struct.vector*, %struct.vector** %2
%16 = call %struct.vector* @vectorDelete(%struct.vector* %15)
store %struct.vector* %16, %struct.vector** %2
ret i32 0
}

LLVM IR (-O2):
%struct.vector = type { i32 }
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call %struct.vector* (...) @vectorCreate()
%2 = tail call i32 @vectorSet(%struct.vector* %1, i32 10, i32 2)
%3 = tail call i32 @vectorGet(%struct.vector* %1, i32 100)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @vectorGet(%struct.vector* %1, i32 10)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 @vectorLength(%struct.vector* %1)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = tail call %struct.vector* @vectorDelete(%struct.vector* %1)
ret i32 0
}