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

/* Variables and functions */
int /*<<< orphan*/ assert(int);
void hold_empty_set(struct read_set *q[2], struct read_set *s) {
  if (!q[0]) {
    q[0] = s;
  } else {
    assert(!q[1]);
    q[1] = s;
  }
}


x86 assembly (clang, -O0):
<hold_empty_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
jne    113e <hold_empty_set+0x2e>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
jmp    1162 <hold_empty_set+0x52>
mov    -0x8(%rbp),%rax
cmpq   $0x0,0x8(%rax)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x8(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hold_empty_set>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
cmpq   $0x0,(%rdi)
je     1135 <hold_empty_set+0x25>
lea    0x8(%rdi),%r14
xor    %eax,%eax
cmpq   $0x0,0x8(%rdi)
sete   %al
mov    %eax,%edi
call   1030 <assert@plt>
mov    %r14,%rdi
mov    %rbx,(%rdi)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.read_set = type { i32 }
define void @hold_empty_set(%struct.read_set** %0, %struct.read_set* %1) {
%3 = alloca %struct.read_set**
%4 = alloca %struct.read_set*
store %struct.read_set** %0, %struct.read_set*** %3
store %struct.read_set* %1, %struct.read_set** %4
%5 = load %struct.read_set**, %struct.read_set*** %3
%6 = getelementptr inbounds %struct.read_set*, %struct.read_set** %5, i64 0
%7 = load %struct.read_set*, %struct.read_set** %6
%8 = icmp ne %struct.read_set* %7, null
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = load %struct.read_set*, %struct.read_set** %4
%11 = load %struct.read_set**, %struct.read_set*** %3
%12 = getelementptr inbounds %struct.read_set*, %struct.read_set** %11, i64 0
store %struct.read_set* %10, %struct.read_set** %12
br label %24
13: ; preds = %2
%14 = load %struct.read_set**, %struct.read_set*** %3
%15 = getelementptr inbounds %struct.read_set*, %struct.read_set** %14, i64 1
%16 = load %struct.read_set*, %struct.read_set** %15
%17 = icmp ne %struct.read_set* %16, null
%18 = xor i1 %17, true
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = load %struct.read_set*, %struct.read_set** %4
%22 = load %struct.read_set**, %struct.read_set*** %3
%23 = getelementptr inbounds %struct.read_set*, %struct.read_set** %22, i64 1
store %struct.read_set* %21, %struct.read_set** %23
br label %24
24: ; preds = %13, %9
ret void
}

LLVM IR (-O2):
%struct.read_set = type { i32 }
define void @hold_empty_set(%struct.read_set** nocapture %0, %struct.read_set* %1) {
%3 = load %struct.read_set*, %struct.read_set** %0
%4 = icmp eq %struct.read_set* %3, null
br i1 %4, label %11, label %5
5: ; preds = %2
%6 = getelementptr inbounds %struct.read_set*, %struct.read_set** %0, i64 1
%7 = load %struct.read_set*, %struct.read_set** %6
%8 = icmp eq %struct.read_set* %7, null
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
br label %11
11: ; preds = %2, %5
%12 = phi %struct.read_set** [ %6, %5 ], [ %0, %2 ]
store %struct.read_set* %1, %struct.read_set** %12
ret void
}