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

/* Variables and functions */
scalar_t__ emptyQ(struct queue *);
int endofgame(struct queue *player1, struct queue *player2) {
  if (emptyQ(player1) && emptyQ(player2))
    return 3;
  if (emptyQ(player1))
    return 2;
  if (emptyQ(player2))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<endofgame>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <emptyQ@plt>
cmp    $0x0,%rax
je     1152 <endofgame+0x42>
mov    -0x18(%rbp),%rdi
call   1030 <emptyQ@plt>
cmp    $0x0,%rax
je     1152 <endofgame+0x42>
movl   $0x3,-0x4(%rbp)
jmp    1197 <endofgame+0x87>
mov    -0x10(%rbp),%rdi
call   1030 <emptyQ@plt>
cmp    $0x0,%rax
je     1171 <endofgame+0x61>
movl   $0x2,-0x4(%rbp)
jmp    1197 <endofgame+0x87>
mov    -0x18(%rbp),%rdi
call   1030 <emptyQ@plt>
cmp    $0x0,%rax
je     1190 <endofgame+0x80>
movl   $0x1,-0x4(%rbp)
jmp    1197 <endofgame+0x87>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<endofgame>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <emptyQ@plt>
test   %rax,%rax
je     1139 <endofgame+0x29>
mov    %r14,%rdi
call   1030 <emptyQ@plt>
mov    %rax,%rcx
mov    $0x3,%eax
test   %rcx,%rcx
jne    1161 <endofgame+0x51>
mov    %rbx,%rdi
call   1030 <emptyQ@plt>
mov    %rax,%rcx
mov    $0x2,%eax
test   %rcx,%rcx
jne    1161 <endofgame+0x51>
mov    %r14,%rdi
call   1030 <emptyQ@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.queue = type { i32 }
define i32 @endofgame(%struct.queue* %0, %struct.queue* %1) {
%3 = alloca i32
%4 = alloca %struct.queue*
%5 = alloca %struct.queue*
store %struct.queue* %0, %struct.queue** %4
store %struct.queue* %1, %struct.queue** %5
%6 = load %struct.queue*, %struct.queue** %4
%7 = call i64 @emptyQ(%struct.queue* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load %struct.queue*, %struct.queue** %5
%11 = call i64 @emptyQ(%struct.queue* %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %9
store i32 3, i32* %3
br label %25
14: ; preds = %9, %2
%15 = load %struct.queue*, %struct.queue** %4
%16 = call i64 @emptyQ(%struct.queue* %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %14
store i32 2, i32* %3
br label %25
19: ; preds = %14
%20 = load %struct.queue*, %struct.queue** %5
%21 = call i64 @emptyQ(%struct.queue* %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %19
store i32 1, i32* %3
br label %25
24: ; preds = %19
store i32 0, i32* %3
br label %25
25: ; preds = %24, %23, %18, %13
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
%struct.queue = type { i32 }
define i32 @endofgame(%struct.queue* %0, %struct.queue* %1) {
%3 = tail call i64 @emptyQ(%struct.queue* %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i64 @emptyQ(%struct.queue* %1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %5, %2
%9 = tail call i64 @emptyQ(%struct.queue* %0)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = tail call i64 @emptyQ(%struct.queue* %1)
%13 = icmp ne i64 %12, 0
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %11, %8, %5
%16 = phi i32 [ 3, %5 ], [ 2, %8 ], [ %14, %11 ]
ret i32 %16
}