#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 /*<<< orphan*/ mvprintw(int /*<<< orphan*/, int, char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
void io_selectTrade(int accepted[3], int cursor, int player) {
  player++;
  char status[3][10];
  strcpy(status[0], "Declined");
  strcpy(status[1], "Accepted");
  strcpy(status[2], "Counter ");
  int y = 10;
  int x = 10;
  mvprintw(y++, x, "##################################");
  mvprintw(y++, x, "# Player %d   Player %d   Player %d #",
           (player == 1) ? 2 : 1, (player <= 2) ? 3 : 2, (player <= 3) ? 4 : 3);
  mvprintw(y++, x, "# %s   %s   %s #", status[accepted[0]], status[accepted[1]],
           status[accepted[2]]);
  mvprintw(y++, x, "#    %c          %c          %c     #",
           (cursor == 0) ? '*' : ' ', (cursor == 1) ? '*' : ' ',
           (cursor == 2) ? '*' : ' ');
  mvprintw(y++, x, "##################################");
}


x86 assembly (clang, -O0):
<io_selectTrade>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeba(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x30(%rbp),%rdi
add    $0xa,%rdi
lea    0xeaf(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x30(%rbp),%rdi
add    $0x14,%rdi
lea    0xea4(%rip),%rsi
call   1030 <strcpy@plt>
movl   $0xa,-0x34(%rbp)
movl   $0xa,-0x38(%rbp)
mov    -0x34(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x38(%rbp),%esi
lea    0xe85(%rip),%rdx
mov    $0x0,%al
call   1040 <mvprintw@plt>
mov    -0x34(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x38(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    $0x1,%ecx
mov    $0x2,%eax
cmp    $0x1,%edx
cmove  %eax,%ecx
mov    -0x10(%rbp),%edx
mov    $0x2,%r8d
mov    $0x3,%eax
cmp    $0x2,%edx
cmovle %eax,%r8d
mov    -0x10(%rbp),%edx
mov    $0x3,%r9d
mov    $0x4,%eax
cmp    $0x3,%edx
cmovle %eax,%r9d
lea    0xe4f(%rip),%rdx
mov    $0x0,%al
call   1040 <mvprintw@plt>
mov    -0x34(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x38(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq (%rax),%rax
lea    -0x30(%rbp),%rcx
imul   $0xa,%rax,%rax
add    %rax,%rcx
mov    -0x8(%rbp),%rax
movslq 0x4(%rax),%rax
lea    -0x30(%rbp),%r8
imul   $0xa,%rax,%rax
add    %rax,%r8
mov    -0x8(%rbp),%rax
movslq 0x8(%rax),%rax
lea    -0x30(%rbp),%r9
imul   $0xa,%rax,%rax
add    %rax,%r9
lea    0xe21(%rip),%rdx
mov    $0x0,%al
call   1040 <mvprintw@plt>
mov    -0x34(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x38(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    $0x20,%ecx
mov    $0x2a,%eax
cmp    $0x0,%edx
cmove  %eax,%ecx
mov    -0xc(%rbp),%edx
mov    $0x20,%r8d
mov    $0x2a,%eax
cmp    $0x1,%edx
cmove  %eax,%r8d
mov    -0xc(%rbp),%edx
mov    $0x20,%r9d
mov    $0x2a,%eax
cmp    $0x2,%edx
cmove  %eax,%r9d
lea    0xdd9(%rip),%rdx
mov    $0x0,%al
call   1040 <mvprintw@plt>
mov    -0x34(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x38(%rbp),%esi
lea    0xd63(%rip),%rdx
mov    $0x0,%al
call   1040 <mvprintw@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_selectTrade>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %edx,%ebp
mov    %esi,%r15d
mov    %rdi,%rbx
lea    0xec7(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
lea    0xa(%rsp),%rdi
lea    0xebc(%rip),%rsi
call   1030 <strcpy@plt>
lea    0x14(%rsp),%rdi
lea    0xeb4(%rip),%rsi
call   1030 <strcpy@plt>
lea    0xeb1(%rip),%r14
mov    $0xa,%edi
mov    $0xa,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <mvprintw@plt>
cmp    $0x1,%ebp
mov    $0x1,%ecx
adc    $0x0,%ecx
xor    %r8d,%r8d
cmp    $0x2,%ebp
setl   %r8b
or     $0x2,%r8d
xor    %r9d,%r9d
cmp    $0x3,%ebp
setl   %r9b
add    $0x3,%r9d
lea    0xe92(%rip),%rdx
mov    $0xb,%edi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <mvprintw@plt>
movslq (%rbx),%rax
lea    (%rax,%rax,4),%rax
lea    (%rsp,%rax,2),%rcx
movslq 0x4(%rbx),%rax
lea    (%rax,%rax,4),%rax
lea    (%rsp,%rax,2),%r8
movslq 0x8(%rbx),%rax
lea    (%rax,%rax,4),%rax
lea    (%rsp,%rax,2),%r9
lea    0xe7d(%rip),%rdx
mov    $0xc,%edi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <mvprintw@plt>
test   %r15d,%r15d
mov    $0x2a,%eax
mov    $0x20,%ecx
cmove  %eax,%ecx
cmp    $0x1,%r15d
mov    $0x20,%r8d
cmove  %eax,%r8d
mov    $0x20,%r9d
cmp    $0x2,%r15d
cmove  %eax,%r9d
lea    0xe4a(%rip),%rdx
mov    $0xd,%edi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <mvprintw@plt>
mov    $0xe,%edi
mov    $0xa,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <mvprintw@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"Declined\00"
@.str.1 = [9 x i8] c"Accepted\00"
@.str.2 = [9 x i8] c"Counter \00"
@.str.3 = [35 x i8] c"##################################\00"
@.str.4 = [38 x i8] c"# Player %d Player %d Player %d #\00"
@.str.5 = [17 x i8] c"# %s %s %s #\00"
@.str.6 = [38 x i8] c"# %c %c %c #\00"
define void @io_selectTrade(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [3 x [10 x i8]]
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = load i32, i32* %6
%11 = add nsw i32 %10, 1
store i32 %11, i32* %6
%12 = getelementptr inbounds [3 x [10 x i8]], [3 x [10 x i8]]* %7, i64 0, i64 0
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %12, i64 0, i64 0
%14 = call i32 @strcpy(i8* %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%15 = getelementptr inbounds [3 x [10 x i8]], [3 x [10 x i8]]* %7, i64 0, i64 1
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 0
%17 = call i32 @strcpy(i8* %16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%18 = getelementptr inbounds [3 x [10 x i8]], [3 x [10 x i8]]* %7, i64 0, i64 2
%19 = getelementptr inbounds [10 x i8], [10 x i8]* %18, i64 0, i64 0
%20 = call i32 @strcpy(i8* %19, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
store i32 10, i32* %8
store i32 10, i32* %9
%21 = load i32, i32* %8
%22 = add nsw i32 %21, 1
store i32 %22, i32* %8
%23 = load i32, i32* %9
%24 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 %21, i32 %23, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%25 = load i32, i32* %8
%26 = add nsw i32 %25, 1
store i32 %26, i32* %8
%27 = load i32, i32* %9
%28 = load i32, i32* %6
%29 = icmp eq i32 %28, 1
%30 = zext i1 %29 to i64
%31 = select i1 %29, i32 2, i32 1
%32 = load i32, i32* %6
%33 = icmp sle i32 %32, 2
%34 = zext i1 %33 to i64
%35 = select i1 %33, i32 3, i32 2
%36 = load i32, i32* %6
%37 = icmp sle i32 %36, 3
%38 = zext i1 %37 to i64
%39 = select i1 %37, i32 4, i32 3
%40 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 %25, i32 %27, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 %31, i32 %35, i32 %39)
%41 = load i32, i32* %8
%42 = add nsw i32 %41, 1
store i32 %42, i32* %8
%43 = load i32, i32* %9
%44 = load i32*, i32** %4
%45 = getelementptr inbounds i32, i32* %44, i64 0
%46 = load i32, i32* %45
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [3 x [10 x i8]], [3 x [10 x i8]]* %7, i64 0, i64 %47
%49 = getelementptr inbounds [10 x i8], [10 x i8]* %48, i64 0, i64 0
%50 = load i32*, i32** %4
%51 = getelementptr inbounds i32, i32* %50, i64 1
%52 = load i32, i32* %51
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [3 x [10 x i8]], [3 x [10 x i8]]* %7, i64 0, i64 %53
%55 = getelementptr inbounds [10 x i8], [10 x i8]* %54, i64 0, i64 0
%56 = load i32*, i32** %4
%57 = getelementptr inbounds i32, i32* %56, i64 2
%58 = load i32, i32* %57
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [3 x [10 x i8]], [3 x [10 x i8]]* %7, i64 0, i64 %59
%61 = getelementptr inbounds [10 x i8], [10 x i8]* %60, i64 0, i64 0
%62 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 %41, i32 %43, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* %49, i8* %55, i8* %61)
%63 = load i32, i32* %8
%64 = add nsw i32 %63, 1
store i32 %64, i32* %8
%65 = load i32, i32* %9
%66 = load i32, i32* %5
%67 = icmp eq i32 %66, 0
%68 = zext i1 %67 to i64
%69 = select i1 %67, i32 42, i32 32
%70 = load i32, i32* %5
%71 = icmp eq i32 %70, 1
%72 = zext i1 %71 to i64
%73 = select i1 %71, i32 42, i32 32
%74 = load i32, i32* %5
%75 = icmp eq i32 %74, 2
%76 = zext i1 %75 to i64
%77 = select i1 %75, i32 42, i32 32
%78 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 %63, i32 %65, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i32 %69, i32 %73, i32 %77)
%79 = load i32, i32* %8
%80 = add nsw i32 %79, 1
store i32 %80, i32* %8
%81 = load i32, i32* %9
%82 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 %79, i32 %81, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"Declined\00"
@.str.1 = [9 x i8] c"Accepted\00"
@.str.2 = [9 x i8] c"Counter \00"
@.str.3 = [35 x i8] c"##################################\00"
@.str.4 = [38 x i8] c"# Player %d Player %d Player %d #\00"
@.str.5 = [17 x i8] c"# %s %s %s #\00"
@.str.6 = [38 x i8] c"# %c %c %c #\00"
define void @io_selectTrade(i32* nocapture %0, i32 %1, i32 %2) {
%4 = alloca [3 x [10 x i8]]
%5 = getelementptr inbounds [3 x [10 x i8]], [3 x [10 x i8]]* %4, i64 0, i64 0, i64 0
%6 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [3 x [10 x i8]], [3 x [10 x i8]]* %4, i64 0, i64 1, i64 0
%8 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%9 = getelementptr inbounds [3 x [10 x i8]], [3 x [10 x i8]]* %4, i64 0, i64 2, i64 0
%10 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 10, i32 10, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp eq i32 %2, 0
%13 = select i1 %12, i32 2, i32 1
%14 = icmp slt i32 %2, 2
%15 = select i1 %14, i32 3, i32 2
%16 = icmp slt i32 %2, 3
%17 = select i1 %16, i32 4, i32 3
%18 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 11, i32 10, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 %13, i32 %15, i32 %17)
%19 = load i32, i32* %0
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [3 x [10 x i8]], [3 x [10 x i8]]* %4, i64 0, i64 %20, i64 0
%22 = getelementptr inbounds i32, i32* %0, i64 1
%23 = load i32, i32* %22
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [3 x [10 x i8]], [3 x [10 x i8]]* %4, i64 0, i64 %24, i64 0
%26 = getelementptr inbounds i32, i32* %0, i64 2
%27 = load i32, i32* %26
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [3 x [10 x i8]], [3 x [10 x i8]]* %4, i64 0, i64 %28, i64 0
%30 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 12, i32 10, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* %21, i8* %25, i8* %29)
%31 = icmp eq i32 %1, 0
%32 = select i1 %31, i32 42, i32 32
%33 = icmp eq i32 %1, 1
%34 = select i1 %33, i32 42, i32 32
%35 = icmp eq i32 %1, 2
%36 = select i1 %35, i32 42, i32 32
%37 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 13, i32 10, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i32 %32, i32 %34, i32 %36)
%38 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 14, i32 10, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
ret void
}