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

/* Variables and functions */
struct node *CreateList(int *, int);
int LinkedListLength(struct node *);
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ printf(char *);
void test2() {
  int values[] = {1, 3, 5, 7, 9, 23};
  struct node *llist = CreateList(values, 6);
  int ret = LinkedListLength(llist);
  assert(ret == 6);
  ret = LinkedListLength(NULL);
  assert(ret == 0);
  printf("Test 3 passed\n");
}


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xeb1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeae(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeab(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x6,%esi
call   1060 <CreateList@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <LinkedListLength@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x6,-0x2c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <LinkedListLength@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xe5c(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
sub    $0x18,%rsp
mov    0xec5(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xea9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x6,%esi
call   1060 <CreateList@plt>
mov    %rax,%rdi
call   1040 <LinkedListLength@plt>
xor    %edi,%edi
cmp    $0x6,%eax
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
call   1040 <LinkedListLength@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
lea    0xe7f(%rip),%rdi
call   1030 <puts@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@__const.test2.values = [6 x i32] [i32 1, i32 3, i32 5, i32 7, i32 9, i32 23]
@.str = [15 x i8] c"Test 3 passed\0A\00"
define void @test2() {
%1 = alloca [6 x i32]
%2 = alloca %struct.node*
%3 = alloca i32
%4 = bitcast [6 x i32]* %1 to i8*
%5 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%6 = call %struct.node* @CreateList(i32* %5, i32 6)
store %struct.node* %6, %struct.node** %2
%7 = load %struct.node*, %struct.node** %2
%8 = call i32 @LinkedListLength(%struct.node* %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 6
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = call i32 @LinkedListLength(%struct.node* null)
store i32 %13, i32* %3
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, 0
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.node = type { i32 }
@__const.test2.values = [6 x i32] [i32 1, i32 3, i32 5, i32 7, i32 9, i32 23]
@str = [14 x i8] c"Test 3 passed\00"
define void @test2() {
%1 = alloca [6 x i32]
%2 = bitcast [6 x i32]* %1 to i8*
%3 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%4 = call %struct.node* @CreateList(i32* %3, i32 6)
%5 = call i32 @LinkedListLength(%struct.node* %4)
%6 = icmp eq i32 %5, 6
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = call i32 @LinkedListLength(%struct.node* null)
%10 = icmp eq i32 %9, 0
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret void
}