#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 */

/* Variables and functions */
int data_numplayers();
int endgame_printscorebreakdown(int);
int /*<<< orphan*/ io_clearscreen();
int /*<<< orphan*/ print_wonder(int, int /*<<< orphan*/, int, int, int *);
int print_wondersmall(int, int, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ printmessage(int, int, int);
int endgame_refresh(int focus) {
  io_clearscreen();
  int num = data_numplayers();
  int x, y, i;
  int array[2];
  print_wonder(34, 0, focus, -1, array);
  x = y = 0;
  for (i = 0; i < num; i++) {
    y = print_wondersmall(x, y, i, focus == i, 0);
  }
  printmessage(x, y + 2, 35);
  return endgame_printscorebreakdown(focus);
}


x86 assembly (clang, -O0):
<endgame_refresh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1060 <io_clearscreen@plt>
mov    $0x0,%al
call   1080 <data_numplayers@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edx
lea    -0x1c(%rbp),%r8
mov    $0x22,%edi
xor    %esi,%esi
mov    $0xffffffff,%ecx
call   1040 <print_wonder@plt>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11e5 <endgame_refresh+0x85>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x4(%rbp),%eax
cmp    -0x14(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%ecx
xor    %r8d,%r8d
call   1050 <print_wondersmall@plt>
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a9 <endgame_refresh+0x49>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
add    $0x2,%esi
mov    $0x23,%edx
call   1070 <printmessage@plt>
mov    -0x4(%rbp),%edi
call   1030 <endgame_printscorebreakdown@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<endgame_refresh>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edi,%r14d
xor    %ebp,%ebp
xor    %eax,%eax
call   1060 <io_clearscreen@plt>
xor    %eax,%eax
call   1080 <data_numplayers@plt>
mov    %eax,%ebx
lea    0x8(%rsp),%r8
mov    $0x22,%edi
xor    %esi,%esi
mov    %r14d,%edx
mov    $0xffffffff,%ecx
call   1040 <print_wonder@plt>
test   %ebx,%ebx
jle    11c2 <endgame_refresh+0x62>
xor    %eax,%eax
nopl   0x0(%rax)
xor    %ecx,%ecx
cmp    %ebp,%r14d
sete   %cl
xor    %edi,%edi
mov    %eax,%esi
mov    %ebp,%edx
xor    %r8d,%r8d
call   1050 <print_wondersmall@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    11a0 <endgame_refresh+0x40>
add    $0x2,%eax
jmp    11c7 <endgame_refresh+0x67>
mov    $0x2,%eax
xor    %edi,%edi
mov    %eax,%esi
mov    $0x23,%edx
call   1070 <printmessage@plt>
mov    %r14d,%edi
call   1030 <endgame_printscorebreakdown@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @endgame_refresh(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [2 x i32]
store i32 %0, i32* %2
%8 = call i32 (...) @io_clearscreen()
%9 = call i32 (...) @data_numplayers()
store i32 %9, i32* %3
%10 = load i32, i32* %2
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%12 = call i32 @print_wonder(i32 34, i32 0, i32 %10, i32 -1, i32* %11)
store i32 0, i32* %5
store i32 0, i32* %4
store i32 0, i32* %6
br label %13
13: ; preds = %26, %1
%14 = load i32, i32* %6
%15 = load i32, i32* %3
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %29
17: ; preds = %13
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = load i32, i32* %6
%21 = load i32, i32* %2
%22 = load i32, i32* %6
%23 = icmp eq i32 %21, %22
%24 = zext i1 %23 to i32
%25 = call i32 @print_wondersmall(i32 %18, i32 %19, i32 %20, i32 %24, i32 0)
store i32 %25, i32* %5
br label %26
26: ; preds = %17
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %13
29: ; preds = %13
%30 = load i32, i32* %4
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 2
%33 = call i32 @printmessage(i32 %30, i32 %32, i32 35)
%34 = load i32, i32* %2
%35 = call i32 @endgame_printscorebreakdown(i32 %34)
ret i32 %35
}

LLVM IR (-O2):
define i32 @endgame_refresh(i32 %0) {
%2 = alloca [2 x i32]
%3 = tail call i32 (...) @io_clearscreen()
%4 = tail call i32 (...) @data_numplayers()
%5 = bitcast [2 x i32]* %2 to i8*
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%7 = call i32 @print_wonder(i32 34, i32 0, i32 %0, i32 -1, i32* %6)
%8 = icmp sgt i32 %4, 0
br i1 %8, label %9, label %19
9: ; preds = %1, %9
%10 = phi i32 [ %15, %9 ], [ 0, %1 ]
%11 = phi i32 [ %14, %9 ], [ 0, %1 ]
%12 = icmp eq i32 %10, %0
%13 = zext i1 %12 to i32
%14 = call i32 @print_wondersmall(i32 0, i32 %11, i32 %10, i32 %13, i32 0)
%15 = add nuw nsw i32 %10, 1
%16 = icmp eq i32 %15, %4
br i1 %16, label %17, label %9
17: ; preds = %9
%18 = add i32 %14, 2
br label %19
19: ; preds = %17, %1
%20 = phi i32 [ 2, %1 ], [ %18, %17 ]
%21 = call i32 @printmessage(i32 0, i32 %20, i32 35)
%22 = call i32 @endgame_printscorebreakdown(i32 %0)
ret i32 %22
}