#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*/ ACS_HLINE;
int /*<<< orphan*/ ACS_LLCORNER;
int /*<<< orphan*/ ACS_LRCORNER;
int /*<<< orphan*/ ACS_ULCORNER;
int /*<<< orphan*/ ACS_URCORNER;
int /*<<< orphan*/ ACS_VLINE;
int /*<<< orphan*/ drawFive(int, int);
int /*<<< orphan*/ drawFour(int, int);
int /*<<< orphan*/ drawOne(int, int);
int /*<<< orphan*/ drawSix(int, int);
int /*<<< orphan*/ drawThree(int, int);
int /*<<< orphan*/ drawTwo(int, int);
int /*<<< orphan*/ mvaddch(int, int, int /*<<< orphan*/);
int /*<<< orphan*/ mvhline(int, int, int /*<<< orphan*/, int);
int /*<<< orphan*/ mvvline(int, int, int /*<<< orphan*/, int);
void drawDie(int y, int x, int value) {
  mvhline(y, x, ACS_HLINE, 12);
  mvhline(y + 6, x, ACS_HLINE, 12);
  mvvline(y, x + 12, ACS_VLINE, 6);
  mvvline(y, x, ACS_VLINE, 6);
  mvaddch(y, x, ACS_ULCORNER);
  mvaddch(y + 6, x, ACS_LLCORNER);
  mvaddch(y, x + 12, ACS_URCORNER);
  mvaddch(y + 6, x + 12, ACS_LRCORNER);
  switch (value) {
  case 1:
    drawOne(y, x);
    break;
  case 2:
    drawTwo(y, x);
    break;
  case 3:
    drawThree(y, x);
    break;
  case 4:
    drawFour(y, x);
    break;
  case 5:
    drawFive(y, x);
    break;
  case 6:
    drawSix(y, x);
    break;
  }
}


x86 assembly (clang, -O0):
<drawDie>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    0x2e1a(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    (%rax),%edx
mov    $0xc,%ecx
mov    %ecx,-0x34(%rbp)
call   1080 <mvhline@plt>
mov    -0x34(%rbp),%ecx
mov    -0x30(%rbp),%rax
mov    -0x4(%rbp),%edi
add    $0x6,%edi
mov    -0x8(%rbp),%esi
mov    (%rax),%edx
call   1080 <mvhline@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    $0xc,%esi
mov    0x2dd8(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    (%rax),%edx
mov    $0x6,%ecx
mov    %ecx,-0x24(%rbp)
call   1090 <mvvline@plt>
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    (%rax),%edx
call   1090 <mvvline@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    0x2dcc(%rip),%rax
mov    (%rax),%edx
call   10a0 <mvaddch@plt>
mov    -0x4(%rbp),%edi
add    $0x6,%edi
mov    -0x8(%rbp),%esi
mov    0x2d7d(%rip),%rax
mov    (%rax),%edx
call   10a0 <mvaddch@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    $0xc,%esi
mov    0x2d86(%rip),%rax
mov    (%rax),%edx
call   10a0 <mvaddch@plt>
mov    -0x4(%rbp),%edi
add    $0x6,%edi
mov    -0x8(%rbp),%esi
add    $0xc,%esi
mov    0x2d7c(%rip),%rax
mov    (%rax),%edx
call   10a0 <mvaddch@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x5,%eax
ja     12ef <drawDie+0x15f>
mov    -0x18(%rbp),%rax
lea    0xd75(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <drawOne@plt>
jmp    12ef <drawDie+0x15f>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <drawTwo@plt>
jmp    12ef <drawDie+0x15f>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   10b0 <drawThree@plt>
jmp    12ef <drawDie+0x15f>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1070 <drawFour@plt>
jmp    12ef <drawDie+0x15f>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <drawFive@plt>
jmp    12ef <drawDie+0x15f>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1060 <drawSix@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawDie>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %esi,%r14d
mov    %edi,%ebx
mov    0x2e1e(%rip),%rbp
mov    0x0(%rbp),%edx
mov    $0xc,%ecx
call   1080 <mvhline@plt>
lea    0x6(%rbx),%r12d
mov    0x0(%rbp),%edx
mov    %r12d,%edi
mov    %r14d,%esi
mov    $0xc,%ecx
call   1080 <mvhline@plt>
lea    0xc(%r14),%ebp
mov    0x2de7(%rip),%r13
mov    0x0(%r13),%edx
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0x6,%ecx
call   1090 <mvvline@plt>
mov    0x0(%r13),%edx
mov    %ebx,%edi
mov    %r14d,%esi
mov    $0x6,%ecx
call   1090 <mvvline@plt>
mov    0x2de3(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    %r14d,%esi
call   10a0 <mvaddch@plt>
mov    0x2d98(%rip),%rax
mov    (%rax),%edx
mov    %r12d,%edi
mov    %r14d,%esi
call   10a0 <mvaddch@plt>
mov    0x2da4(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    %ebp,%esi
call   10a0 <mvaddch@plt>
mov    0x2da2(%rip),%rax
mov    (%rax),%edx
mov    %r12d,%edi
mov    %ebp,%esi
call   10a0 <mvaddch@plt>
add    $0xffffffff,%r15d
cmp    $0x5,%r15d
ja     127c <drawDie+0xec>
lea    0xda5(%rip),%rax
movslq (%rax,%r15,4),%rcx
add    %rax,%rcx
jmp    *%rcx
mov    %ebx,%edi
mov    %r14d,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <drawOne@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %ebx,%edi
mov    %r14d,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <drawTwo@plt>
mov    %ebx,%edi
mov    %r14d,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    10b0 <drawThree@plt>
mov    %ebx,%edi
mov    %r14d,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <drawFour@plt>
mov    %ebx,%edi
mov    %r14d,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <drawFive@plt>
mov    %ebx,%edi
mov    %r14d,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <drawSix@plt>

LLVM IR (-O0):
@ACS_HLINE = global i32 0
@ACS_VLINE = global i32 0
@ACS_ULCORNER = global i32 0
@ACS_LLCORNER = global i32 0
@ACS_URCORNER = global i32 0
@ACS_LRCORNER = global i32 0
define void @drawDie(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32, i32* @ACS_HLINE
%10 = call i32 @mvhline(i32 %7, i32 %8, i32 %9, i32 12)
%11 = load i32, i32* %4
%12 = add nsw i32 %11, 6
%13 = load i32, i32* %5
%14 = load i32, i32* @ACS_HLINE
%15 = call i32 @mvhline(i32 %12, i32 %13, i32 %14, i32 12)
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 12
%19 = load i32, i32* @ACS_VLINE
%20 = call i32 @mvvline(i32 %16, i32 %18, i32 %19, i32 6)
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = load i32, i32* @ACS_VLINE
%24 = call i32 @mvvline(i32 %21, i32 %22, i32 %23, i32 6)
%25 = load i32, i32* %4
%26 = load i32, i32* %5
%27 = load i32, i32* @ACS_ULCORNER
%28 = call i32 @mvaddch(i32 %25, i32 %26, i32 %27)
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 6
%31 = load i32, i32* %5
%32 = load i32, i32* @ACS_LLCORNER
%33 = call i32 @mvaddch(i32 %30, i32 %31, i32 %32)
%34 = load i32, i32* %4
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 12
%37 = load i32, i32* @ACS_URCORNER
%38 = call i32 @mvaddch(i32 %34, i32 %36, i32 %37)
%39 = load i32, i32* %4
%40 = add nsw i32 %39, 6
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 12
%43 = load i32, i32* @ACS_LRCORNER
%44 = call i32 @mvaddch(i32 %40, i32 %42, i32 %43)
%45 = load i32, i32* %6
switch i32 %45, label %70 [
i32 1, label %46
i32 2, label %50
i32 3, label %54
i32 4, label %58
i32 5, label %62
i32 6, label %66
]
46: ; preds = %3
%47 = load i32, i32* %4
%48 = load i32, i32* %5
%49 = call i32 @drawOne(i32 %47, i32 %48)
br label %70
50: ; preds = %3
%51 = load i32, i32* %4
%52 = load i32, i32* %5
%53 = call i32 @drawTwo(i32 %51, i32 %52)
br label %70
54: ; preds = %3
%55 = load i32, i32* %4
%56 = load i32, i32* %5
%57 = call i32 @drawThree(i32 %55, i32 %56)
br label %70
58: ; preds = %3
%59 = load i32, i32* %4
%60 = load i32, i32* %5
%61 = call i32 @drawFour(i32 %59, i32 %60)
br label %70
62: ; preds = %3
%63 = load i32, i32* %4
%64 = load i32, i32* %5
%65 = call i32 @drawFive(i32 %63, i32 %64)
br label %70
66: ; preds = %3
%67 = load i32, i32* %4
%68 = load i32, i32* %5
%69 = call i32 @drawSix(i32 %67, i32 %68)
br label %70
70: ; preds = %3, %66, %62, %58, %54, %50, %46
ret void
}

LLVM IR (-O2):
@ACS_HLINE = global i32 0
@ACS_VLINE = global i32 0
@ACS_ULCORNER = global i32 0
@ACS_LLCORNER = global i32 0
@ACS_URCORNER = global i32 0
@ACS_LRCORNER = global i32 0
define void @drawDie(i32 %0, i32 %1, i32 %2) {
%4 = load i32, i32* @ACS_HLINE
%5 = tail call i32 @mvhline(i32 %0, i32 %1, i32 %4, i32 12)
%6 = add nsw i32 %0, 6
%7 = load i32, i32* @ACS_HLINE
%8 = tail call i32 @mvhline(i32 %6, i32 %1, i32 %7, i32 12)
%9 = add nsw i32 %1, 12
%10 = load i32, i32* @ACS_VLINE
%11 = tail call i32 @mvvline(i32 %0, i32 %9, i32 %10, i32 6)
%12 = load i32, i32* @ACS_VLINE
%13 = tail call i32 @mvvline(i32 %0, i32 %1, i32 %12, i32 6)
%14 = load i32, i32* @ACS_ULCORNER
%15 = tail call i32 @mvaddch(i32 %0, i32 %1, i32 %14)
%16 = load i32, i32* @ACS_LLCORNER
%17 = tail call i32 @mvaddch(i32 %6, i32 %1, i32 %16)
%18 = load i32, i32* @ACS_URCORNER
%19 = tail call i32 @mvaddch(i32 %0, i32 %9, i32 %18)
%20 = load i32, i32* @ACS_LRCORNER
%21 = tail call i32 @mvaddch(i32 %6, i32 %9, i32 %20)
switch i32 %2, label %34 [
i32 1, label %22
i32 2, label %24
i32 3, label %26
i32 4, label %28
i32 5, label %30
i32 6, label %32
]
22: ; preds = %3
%23 = tail call i32 @drawOne(i32 %0, i32 %1)
br label %34
24: ; preds = %3
%25 = tail call i32 @drawTwo(i32 %0, i32 %1)
br label %34
26: ; preds = %3
%27 = tail call i32 @drawThree(i32 %0, i32 %1)
br label %34
28: ; preds = %3
%29 = tail call i32 @drawFour(i32 %0, i32 %1)
br label %34
30: ; preds = %3
%31 = tail call i32 @drawFive(i32 %0, i32 %1)
br label %34
32: ; preds = %3
%33 = tail call i32 @drawSix(i32 %0, i32 %1)
br label %34
34: ; preds = %3, %32, %30, %28, %26, %24, %22
ret void
}