#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 *BuildOneTwoThree();
int /*<<< orphan*/ DeleteList(struct node **);
int Length(struct node *);
int Pop(struct node **);
int /*<<< orphan*/ assert(int);
void PopTest() {
  struct node *head = BuildOneTwoThree();
  int a = Pop(&head);
  assert(a == 1);
  int b = Pop(&head);
  assert(b == 2);
  int c = Pop(&head);
  assert(c == 3);
  int len = Length(head);
  assert(len == 0);
  DeleteList(&head);
}


x86 assembly (clang, -O0):
<PopTest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1030 <BuildOneTwoThree@plt>
mov    %rax,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <Pop@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x8(%rbp),%rdi
call   1040 <Pop@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x2,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x8(%rbp),%rdi
call   1040 <Pop@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1070 <Length@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x8(%rbp),%rdi
call   1060 <DeleteList@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PopTest>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1030 <BuildOneTwoThree@plt>
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <Pop@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1040 <Pop@plt>
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1040 <Pop@plt>
xor    %edi,%edi
cmp    $0x3,%eax
sete   %dil
call   1050 <assert@plt>
mov    0x8(%rsp),%rdi
call   1070 <Length@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1060 <DeleteList@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.node = type { i32 }
define void @PopTest() {
%1 = alloca %struct.node*
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = call %struct.node* (...) @BuildOneTwoThree()
store %struct.node* %6, %struct.node** %1
%7 = call i32 @Pop(%struct.node** %1)
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 1
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = call i32 @Pop(%struct.node** %1)
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = icmp eq i32 %13, 2
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = call i32 @Pop(%struct.node** %1)
store i32 %17, i32* %4
%18 = load i32, i32* %4
%19 = icmp eq i32 %18, 3
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = load %struct.node*, %struct.node** %1
%23 = call i32 @Length(%struct.node* %22)
store i32 %23, i32* %5
%24 = load i32, i32* %5
%25 = icmp eq i32 %24, 0
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = call i32 @DeleteList(%struct.node** %1)
ret void
}

LLVM IR (-O2):
%struct.node = type { i32 }
define void @PopTest() {
%1 = alloca %struct.node*
%2 = bitcast %struct.node** %1 to i8*
%3 = tail call %struct.node* (...) @BuildOneTwoThree()
store %struct.node* %3, %struct.node** %1
%4 = call i32 @Pop(%struct.node** %1)
%5 = icmp eq i32 %4, 1
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = call i32 @Pop(%struct.node** %1)
%9 = icmp eq i32 %8, 2
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = call i32 @Pop(%struct.node** %1)
%13 = icmp eq i32 %12, 3
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = load %struct.node*, %struct.node** %1
%17 = call i32 @Length(%struct.node* %16)
%18 = icmp eq i32 %17, 0
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = call i32 @DeleteList(%struct.node** %1)
ret void
}