#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 */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ draw_O(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ draw_X(int /*<<< orphan*/ *, int, int);
void leave_mark(WINDOW *board, int choice, bool mark) {
  int x_position, y_position;
  y_position = ((8 / 2) + (8 * (choice / 3)));
  x_position = ((16 / 2) + (16 * (choice % 3)));
  if (mark)
    draw_X(board, y_position, x_position);
  else
    draw_O(board, y_position, x_position);
}


x86 assembly (clang, -O0):
<leave_mark>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
shl    $0x3,%eax
add    $0x4,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
shl    $0x4,%eax
add    $0x8,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     117a <leave_mark+0x5a>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <draw_X@plt>
jmp    1189 <leave_mark+0x69>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1040 <draw_O@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<leave_mark>:
mov    %edx,%eax
movslq %esi,%rdx
imul   $0x55555556,%rdx,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
shr    $0x20,%rcx
add    %esi,%ecx
lea    0x4(,%rcx,8),%esi
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%edx
shl    $0x4,%edx
or     $0x8,%edx
test   %eax,%eax
je     1154 <leave_mark+0x34>
jmp    1030 <draw_X@plt>
jmp    1040 <draw_O@plt>

LLVM IR (-O0):
define void @leave_mark(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %5
%10 = sdiv i32 %9, 3
%11 = mul nsw i32 8, %10
%12 = add nsw i32 4, %11
store i32 %12, i32* %8
%13 = load i32, i32* %5
%14 = srem i32 %13, 3
%15 = mul nsw i32 16, %14
%16 = add nsw i32 8, %15
store i32 %16, i32* %7
%17 = load i32, i32* %6
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %3
%20 = load i32*, i32** %4
%21 = load i32, i32* %8
%22 = load i32, i32* %7
%23 = call i32 @draw_X(i32* %20, i32 %21, i32 %22)
br label %29
24: ; preds = %3
%25 = load i32*, i32** %4
%26 = load i32, i32* %8
%27 = load i32, i32* %7
%28 = call i32 @draw_O(i32* %25, i32 %26, i32 %27)
br label %29
29: ; preds = %24, %19
ret void
}

LLVM IR (-O2):
define void @leave_mark(i32* %0, i32 %1, i32 %2) {
%4 = sdiv i32 %1, 3
%5 = shl nsw i32 %4, 3
%6 = or i32 %5, 4
%7 = srem i32 %1, 3
%8 = shl nsw i32 %7, 4
%9 = or i32 %8, 8
%10 = icmp eq i32 %2, 0
br i1 %10, label %13, label %11
11: ; preds = %3
%12 = tail call i32 @draw_X(i32* %0, i32 %6, i32 %9)
br label %15
13: ; preds = %3
%14 = tail call i32 @draw_O(i32* %0, i32 %6, i32 %9)
br label %15
15: ; preds = %13, %11
ret void
}