#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*/ my_putchar(char);
int /*<<< orphan*/ my_putnbr(unsigned char);
int /*<<< orphan*/ my_putnchar(char, unsigned char);
int /*<<< orphan*/ my_putstr(char *);
int /*<<< orphan*/ print_player(int, int);
int display(unsigned char *rows, int size, int player, int mode) {
  int i;
  print_player(mode, player);
  i = -1;
  while (++i < size) {
    my_putnbr(i + 1);
    my_putnchar(' ', 1 + (i < 9));
    my_putchar('(');
    my_putnbr(rows[i]);
    my_putstr("):");
    my_putnchar(' ',
                (rows[i] % 10 == 0) + (rows[i] < 10) + size + i - rows[i] + 5);
    my_putnchar('|', rows[i]);
    my_putchar('\n');
  }
  return (0);
}


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1060 <print_player@plt>
movl   $0xffffffff,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmp    -0xc(%rbp),%eax
jge    125c <display+0x10c>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
movzbl %al,%edi
call   1070 <my_putnbr@plt>
cmpl   $0x9,-0x18(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x1,%eax
mov    $0x20,%edi
movzbl %al,%esi
call   1030 <my_putnchar@plt>
mov    $0x28,%edi
call   1040 <my_putchar@plt>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1070 <my_putnbr@plt>
lea    0xe2b(%rip),%rdi
call   1050 <my_putstr@plt>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x8(%rbp),%rcx
movslq -0x18(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
cmp    $0xa,%ecx
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
add    %ecx,%eax
add    -0xc(%rbp),%eax
add    -0x18(%rbp),%eax
mov    -0x8(%rbp),%rcx
movslq -0x18(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
sub    %ecx,%eax
add    $0x5,%eax
mov    $0x20,%edi
movzbl %al,%esi
call   1030 <my_putnchar@plt>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    $0x7c,%edi
movzbl (%rax,%rcx,1),%esi
call   1030 <my_putnchar@plt>
mov    $0xa,%edi
call   1040 <my_putchar@plt>
jmp    1177 <display+0x27>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%r13
mov    %ecx,%edi
mov    %edx,%esi
call   1060 <print_player@plt>
test   %r14d,%r14d
jle    121b <display+0xcb>
mov    %r14d,%r15d
add    $0x5,%r14b
movzbl %r14b,%r12d
xor    %ebp,%ebp
lea    -0x1(%rbp),%r14d
lea    0x1(%rbp),%rbx
movzbl %bl,%edi
call   1070 <my_putnbr@plt>
xor    %esi,%esi
cmp    $0x8,%r14d
setl   %sil
add    $0x1,%esi
mov    $0x20,%edi
call   1030 <my_putnchar@plt>
mov    $0x28,%edi
call   1040 <my_putchar@plt>
movzbl 0x0(%r13,%rbp,1),%edi
call   1070 <my_putnbr@plt>
lea    0xe3d(%rip),%rdi
call   1050 <my_putstr@plt>
movzbl 0x0(%r13,%rbp,1),%eax
imul   $0xffffffcd,%eax,%ecx
ror    %cl
cmp    $0xa,%al
setb   %dl
cmp    $0x1a,%cl
adc    $0x0,%dl
sub    %al,%dl
movzbl %dl,%ecx
add    %r12d,%ecx
add    %ebp,%ecx
movzbl %cl,%esi
mov    $0x20,%edi
call   1030 <my_putnchar@plt>
movzbl 0x0(%r13,%rbp,1),%esi
mov    $0x7c,%edi
call   1030 <my_putnchar@plt>
mov    $0xa,%edi
call   1040 <my_putchar@plt>
mov    %rbx,%rbp
cmp    %rbx,%r15
jne    1180 <display+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"):\00"
define i32 @display(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %8
%11 = load i32, i32* %7
%12 = call i32 @print_player(i32 %10, i32 %11)
store i32 -1, i32* %9
br label %13
13: ; preds = %18, %4
%14 = load i32, i32* %9
%15 = add nsw i32 %14, 1
store i32 %15, i32* %9
%16 = load i32, i32* %6
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %76
18: ; preds = %13
%19 = load i32, i32* %9
%20 = add nsw i32 %19, 1
%21 = trunc i32 %20 to i8
%22 = call i32 @my_putnbr(i8 zeroext %21)
%23 = load i32, i32* %9
%24 = icmp slt i32 %23, 9
%25 = zext i1 %24 to i32
%26 = add nsw i32 1, %25
%27 = trunc i32 %26 to i8
%28 = call i32 @my_putnchar(i8 signext 32, i8 zeroext %27)
%29 = call i32 @my_putchar(i8 signext 40)
%30 = load i8*, i8** %5
%31 = load i32, i32* %9
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = load i8, i8* %33
%35 = call i32 @my_putnbr(i8 zeroext %34)
%36 = call i32 @my_putstr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%37 = load i8*, i8** %5
%38 = load i32, i32* %9
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %37, i64 %39
%41 = load i8, i8* %40
%42 = zext i8 %41 to i32
%43 = srem i32 %42, 10
%44 = icmp eq i32 %43, 0
%45 = zext i1 %44 to i32
%46 = load i8*, i8** %5
%47 = load i32, i32* %9
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %46, i64 %48
%50 = load i8, i8* %49
%51 = zext i8 %50 to i32
%52 = icmp slt i32 %51, 10
%53 = zext i1 %52 to i32
%54 = add nsw i32 %45, %53
%55 = load i32, i32* %6
%56 = add nsw i32 %54, %55
%57 = load i32, i32* %9
%58 = add nsw i32 %56, %57
%59 = load i8*, i8** %5
%60 = load i32, i32* %9
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8, i8* %59, i64 %61
%63 = load i8, i8* %62
%64 = zext i8 %63 to i32
%65 = sub nsw i32 %58, %64
%66 = add nsw i32 %65, 5
%67 = trunc i32 %66 to i8
%68 = call i32 @my_putnchar(i8 signext 32, i8 zeroext %67)
%69 = load i8*, i8** %5
%70 = load i32, i32* %9
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8, i8* %69, i64 %71
%73 = load i8, i8* %72
%74 = call i32 @my_putnchar(i8 signext 124, i8 zeroext %73)
%75 = call i32 @my_putchar(i8 signext 10)
br label %13
76: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"):\00"
define i32 @display(i8* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @print_player(i32 %3, i32 %2)
%6 = icmp sgt i32 %1, 0
br i1 %6, label %7, label %42
7: ; preds = %4
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %40, %9 ]
%11 = phi i32 [ -1, %7 ], [ %12, %9 ]
%12 = trunc i64 %10 to i32
%13 = trunc i32 %11 to i8
%14 = add i8 %13, 2
%15 = tail call i32 @my_putnbr(i8 zeroext %14)
%16 = icmp slt i32 %11, 8
%17 = select i1 %16, i8 2, i8 1
%18 = tail call i32 @my_putnchar(i8 signext 32, i8 zeroext %17)
%19 = tail call i32 @my_putchar(i8 signext 40)
%20 = getelementptr inbounds i8, i8* %0, i64 %10
%21 = load i8, i8* %20
%22 = tail call i32 @my_putnbr(i8 zeroext %21)
%23 = tail call i32 @my_putstr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%24 = load i8, i8* %20
%25 = urem i8 %24, 10
%26 = icmp eq i8 %25, 0
%27 = zext i1 %26 to i32
%28 = icmp ult i8 %24, 10
%29 = zext i1 %28 to i32
%30 = add i32 %12, %1
%31 = add i32 %30, %29
%32 = add i32 %31, %27
%33 = trunc i32 %32 to i8
%34 = sub i8 5, %24
%35 = add i8 %34, %33
%36 = tail call i32 @my_putnchar(i8 signext 32, i8 zeroext %35)
%37 = load i8, i8* %20
%38 = tail call i32 @my_putnchar(i8 signext 124, i8 zeroext %37)
%39 = tail call i32 @my_putchar(i8 signext 10)
%40 = add nuw nsw i64 %10, 1
%41 = icmp eq i64 %40, %8
br i1 %41, label %42, label %9
42: ; preds = %9, %4
ret i32 0
}