#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*/ mask_32byte(char *, int);
int /*<<< orphan*/ printf(char *);
void draw_korean(int cho, int jung, int jong) {
  int CHO_IDX = 0;
  int JUNG_IDX = CHO_IDX + 32 * 19 * 8;
  int JONG_IDX = JUNG_IDX + 32 * 21 * 4;
  int CHO_MAP[] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 3,
                   3, 1, 2, 4, 4, 4, 2, 1, 3, 0};
  int JONG_MAP[] = {0, 2, 0, 2, 1, 2, 1, 2, 3, 0, 2,
                    1, 3, 3, 1, 2, 1, 3, 3, 1, 1};
  int CHO_TYPE = -1;
  int JUNG_TYPE = -1;
  int JONG_TYPE = -1;
  char out[256] = {
      0,
  };
  int i;
  CHO_TYPE = CHO_MAP[jung];
  if (jong != 0) {
    if (CHO_TYPE == 0)
      CHO_TYPE = 5;
    else if (CHO_TYPE == 1)
      CHO_TYPE = 6;
    else if (CHO_TYPE == 2)
      CHO_TYPE = 6;
    else if (CHO_TYPE == 3)
      CHO_TYPE = 7;
    else if (CHO_TYPE == 4)
      CHO_TYPE = 7;
  }
  JUNG_TYPE = (cho == 0 || cho == 16) ? 0 : 1;
  JUNG_TYPE += (jong != 0) ? 2 : 0;
  JONG_TYPE = JONG_MAP[jung];
  mask_32byte(out, CHO_IDX + (32 * 19 * CHO_TYPE) + (32 * cho));
  mask_32byte(out, JUNG_IDX + (32 * 21 * JUNG_TYPE) + (32 * jung));
  if (jong != 0)
    mask_32byte(out, JONG_IDX + (32 * 27 * JONG_TYPE) + (32 * (jong - 1)));
  for (i = 0; i < 256; i++) {
    if (out[i] == 1)
      printf(" *");
    else
      printf("  ");
    if (i % 16 == 15)
      printf("\n");
  }
}


x86 assembly (clang, -O0):
<draw_korean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f0,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1300,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0xa80,%eax
mov    %eax,-0x18(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xe84(%rip),%rsi
mov    $0x54,%edx
call   1060 <memcpy@plt>
lea    -0xd0(%rbp),%rdi
lea    0xecc(%rip),%rsi
mov    $0x54,%edx
call   1060 <memcpy@plt>
movl   $0xffffffff,-0xd4(%rbp)
ff ff ff
movl   $0xffffffff,-0xd8(%rbp)
ff ff ff
movl   $0xffffffff,-0xdc(%rbp)
ff ff ff
lea    -0x1e0(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1050 <memset@plt>
movslq -0x8(%rbp),%rax
mov    -0x70(%rbp,%rax,4),%eax
mov    %eax,-0xd4(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1287 <draw_korean+0x147>
cmpl   $0x0,-0xd4(%rbp)
jne    1203 <draw_korean+0xc3>
movl   $0x5,-0xd4(%rbp)
jmp    1282 <draw_korean+0x142>
cmpl   $0x1,-0xd4(%rbp)
jne    121f <draw_korean+0xdf>
movl   $0x6,-0xd4(%rbp)
jmp    127d <draw_korean+0x13d>
cmpl   $0x2,-0xd4(%rbp)
jne    123b <draw_korean+0xfb>
movl   $0x6,-0xd4(%rbp)
jmp    1278 <draw_korean+0x138>
cmpl   $0x3,-0xd4(%rbp)
jne    1257 <draw_korean+0x117>
movl   $0x7,-0xd4(%rbp)
jmp    1273 <draw_korean+0x133>
cmpl   $0x4,-0xd4(%rbp)
jne    126e <draw_korean+0x12e>
movl   $0x7,-0xd4(%rbp)
jmp    1273 <draw_korean+0x133>
jmp    1278 <draw_korean+0x138>
jmp    127d <draw_korean+0x13d>
jmp    1282 <draw_korean+0x142>
jmp    1287 <draw_korean+0x147>
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x1e5(%rbp)
je     12a6 <draw_korean+0x166>
cmpl   $0x10,-0x4(%rbp)
sete   %al
mov    %al,-0x1e5(%rbp)
mov    -0x1e5(%rbp),%dl
mov    $0x1,%eax
xor    %ecx,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
mov    %eax,-0xd8(%rbp)
mov    -0xc(%rbp),%edx
xor    %eax,%eax
mov    $0x2,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
add    -0xd8(%rbp),%eax
mov    %eax,-0xd8(%rbp)
movslq -0x8(%rbp),%rax
mov    -0xd0(%rbp,%rax,4),%eax
mov    %eax,-0xdc(%rbp)
lea    -0x1e0(%rbp),%rdi
mov    -0x10(%rbp),%esi
imul   $0x260,-0xd4(%rbp),%eax
add    %eax,%esi
mov    -0x4(%rbp),%eax
shl    $0x5,%eax
add    %eax,%esi
call   1030 <mask_32byte@plt>
lea    -0x1e0(%rbp),%rdi
mov    -0x14(%rbp),%esi
imul   $0x2a0,-0xd8(%rbp),%eax
add    %eax,%esi
mov    -0x8(%rbp),%eax
shl    $0x5,%eax
add    %eax,%esi
call   1030 <mask_32byte@plt>
cmpl   $0x0,-0xc(%rbp)
je     1362 <draw_korean+0x222>
lea    -0x1e0(%rbp),%rdi
mov    -0x18(%rbp),%esi
imul   $0x360,-0xdc(%rbp),%eax
add    %eax,%esi
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
shl    $0x5,%eax
add    %eax,%esi
call   1030 <mask_32byte@plt>
movl   $0x0,-0x1e4(%rbp)
cmpl   $0x100,-0x1e4(%rbp)
jge    13ed <draw_korean+0x2ad>
movslq -0x1e4(%rbp),%rax
movsbl -0x1e0(%rbp,%rax,1),%eax
ff
cmp    $0x1,%eax
jne    13a5 <draw_korean+0x265>
lea    0xd19(%rip),%rdi
call   1040 <printf@plt>
jmp    13b1 <draw_korean+0x271>
lea    0xd0b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1e4(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
cmp    $0xf,%edx
jne    13d4 <draw_korean+0x294>
lea    0xceb(%rip),%rdi
call   1040 <printf@plt>
jmp    13d9 <draw_korean+0x299>
mov    -0x1e4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e4(%rbp)
jmp    136c <draw_korean+0x22c>
add    $0x1f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_korean>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x100,%rsp
mov    %edx,%r14d
mov    %esi,%r15d
mov    %edi,%esi
xorps  %xmm0,%xmm0
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movslq %r15d,%r12
lea    0xe45(%rip),%rax
mov    (%rax,%r12,4),%ecx
test   %edx,%edx
je     11da <draw_korean+0xaa>
lea    -0x14(%r12),%rdx
mov    $0x2,%eax
cmp    $0xfffffffffffffff4,%rdx
jae    11de <draw_korean+0xae>
mov    $0x5,%ecx
jmp    11fe <draw_korean+0xce>
xor    %eax,%eax
jmp    11fe <draw_korean+0xce>
mov    $0x41100,%edx
bt     %r12,%rdx
jb     11f9 <draw_korean+0xc9>
cmp    $0xd,%r15d
je     11f9 <draw_korean+0xc9>
cmp    $0x11,%r15d
jne    12c2 <draw_korean+0x192>
mov    $0x6,%ecx
xor    %ebp,%ebp
test   $0xffffffef,%esi
setne  %bpl
or     %eax,%ebp
imul   $0x260,%ecx,%eax
shl    $0x5,%esi
add    %eax,%esi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <mask_32byte@plt>
imul   $0x2a0,%ebp,%eax
shl    $0x5,%r15d
lea    (%r15,%rax,1),%esi
add    $0x1300,%esi
mov    %rbx,%rdi
call   1040 <mask_32byte@plt>
test   %r14d,%r14d
je     1268 <draw_korean+0x138>
lea    0xe16(%rip),%rax
imul   $0x360,(%rax,%r12,4),%eax
shl    $0x5,%r14d
lea    (%r14,%rax,1),%esi
add    $0x1d60,%esi
mov    %rsp,%rdi
call   1040 <mask_32byte@plt>
xor    %ebx,%ebx
lea    0xe43(%rip),%r14
lea    0xe3f(%rip),%r15
jmp    128d <draw_korean+0x15d>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    $0x100,%rbx
je     12b2 <draw_korean+0x182>
cmpb   $0x1,(%rsp,%rbx,1)
mov    %r14,%rdi
je     1299 <draw_korean+0x169>
mov    %r15,%rdi
call   1050 <printf@plt>
mov    %ebx,%eax
not    %eax
test   $0xf,%al
jne    1280 <draw_korean+0x150>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1280 <draw_korean+0x150>
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x80e00,%edx
bt     %r12,%rdx
jb     12e3 <draw_korean+0x1b3>
lea    -0xe(%r12),%rdx
cmp    $0x3,%rdx
mov    $0x7,%edx
cmovb  %edx,%ecx
jmp    11fe <draw_korean+0xce>
mov    $0x7,%ecx
jmp    11fe <draw_korean+0xce>

LLVM IR (-O0):
@__const.draw_korean.CHO_MAP = [21 x i32] [i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 3, i32 3, i32 3, i32 1, i32 2, i32 4, i32 4, i32 4, i32 2, i32 1, i32 3, i32 0]
@__const.draw_korean.JONG_MAP = [21 x i32] [i32 0, i32 2, i32 0, i32 2, i32 1, i32 2, i32 1, i32 2, i32 3, i32 0, i32 2, i32 1, i32 3, i32 3, i32 1, i32 2, i32 1, i32 3, i32 3, i32 1, i32 1]
@.str = [3 x i8] c" *\00"
@.str.1 = [3 x i8] c" \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @draw_korean(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [21 x i32]
%11 = alloca [21 x i32]
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca [256 x i8]
%16 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
%17 = load i32, i32* %7
%18 = add nsw i32 %17, 4864
store i32 %18, i32* %8
%19 = load i32, i32* %8
%20 = add nsw i32 %19, 2688
store i32 %20, i32* %9
%21 = bitcast [21 x i32]* %10 to i8*
%22 = bitcast [21 x i32]* %11 to i8*
store i32 -1, i32* %12
store i32 -1, i32* %13
store i32 -1, i32* %14
%23 = bitcast [256 x i8]* %15 to i8*
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [21 x i32], [21 x i32]* %10, i64 0, i64 %25
%27 = load i32, i32* %26
store i32 %27, i32* %12
%28 = load i32, i32* %6
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %55
30: ; preds = %3
%31 = load i32, i32* %12
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %30
store i32 5, i32* %12
br label %54
34: ; preds = %30
%35 = load i32, i32* %12
%36 = icmp eq i32 %35, 1
br i1 %36, label %37, label %38
37: ; preds = %34
store i32 6, i32* %12
br label %53
38: ; preds = %34
%39 = load i32, i32* %12
%40 = icmp eq i32 %39, 2
br i1 %40, label %41, label %42
41: ; preds = %38
store i32 6, i32* %12
br label %52
42: ; preds = %38
%43 = load i32, i32* %12
%44 = icmp eq i32 %43, 3
br i1 %44, label %45, label %46
45: ; preds = %42
store i32 7, i32* %12
br label %51
46: ; preds = %42
%47 = load i32, i32* %12
%48 = icmp eq i32 %47, 4
br i1 %48, label %49, label %50
49: ; preds = %46
store i32 7, i32* %12
br label %50
50: ; preds = %49, %46
br label %51
51: ; preds = %50, %45
br label %52
52: ; preds = %51, %41
br label %53
53: ; preds = %52, %37
br label %54
54: ; preds = %53, %33
br label %55
55: ; preds = %54, %3
%56 = load i32, i32* %4
%57 = icmp eq i32 %56, 0
br i1 %57, label %61, label %58
58: ; preds = %55
%59 = load i32, i32* %4
%60 = icmp eq i32 %59, 16
br label %61
61: ; preds = %58, %55
%62 = phi i1 [ true, %55 ], [ %60, %58 ]
%63 = zext i1 %62 to i64
%64 = select i1 %62, i32 0, i32 1
store i32 %64, i32* %13
%65 = load i32, i32* %6
%66 = icmp ne i32 %65, 0
%67 = zext i1 %66 to i64
%68 = select i1 %66, i32 2, i32 0
%69 = load i32, i32* %13
%70 = add nsw i32 %69, %68
store i32 %70, i32* %13
%71 = load i32, i32* %5
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [21 x i32], [21 x i32]* %11, i64 0, i64 %72
%74 = load i32, i32* %73
store i32 %74, i32* %14
%75 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%76 = load i32, i32* %7
%77 = load i32, i32* %12
%78 = mul nsw i32 608, %77
%79 = add nsw i32 %76, %78
%80 = load i32, i32* %4
%81 = mul nsw i32 32, %80
%82 = add nsw i32 %79, %81
%83 = call i32 @mask_32byte(i8* %75, i32 %82)
%84 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%85 = load i32, i32* %8
%86 = load i32, i32* %13
%87 = mul nsw i32 672, %86
%88 = add nsw i32 %85, %87
%89 = load i32, i32* %5
%90 = mul nsw i32 32, %89
%91 = add nsw i32 %88, %90
%92 = call i32 @mask_32byte(i8* %84, i32 %91)
%93 = load i32, i32* %6
%94 = icmp ne i32 %93, 0
br i1 %94, label %95, label %106
95: ; preds = %61
%96 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%97 = load i32, i32* %9
%98 = load i32, i32* %14
%99 = mul nsw i32 864, %98
%100 = add nsw i32 %97, %99
%101 = load i32, i32* %6
%102 = sub nsw i32 %101, 1
%103 = mul nsw i32 32, %102
%104 = add nsw i32 %100, %103
%105 = call i32 @mask_32byte(i8* %96, i32 %104)
br label %106
106: ; preds = %95, %61
store i32 0, i32* %16
br label %107
107: ; preds = %128, %106
%108 = load i32, i32* %16
%109 = icmp slt i32 %108, 256
br i1 %109, label %110, label %131
110: ; preds = %107
%111 = load i32, i32* %16
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 %112
%114 = load i8, i8* %113
%115 = sext i8 %114 to i32
%116 = icmp eq i32 %115, 1
br i1 %116, label %117, label %119
117: ; preds = %110
%118 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %121
119: ; preds = %110
%120 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %121
121: ; preds = %119, %117
%122 = load i32, i32* %16
%123 = srem i32 %122, 16
%124 = icmp eq i32 %123, 15
br i1 %124, label %125, label %127
125: ; preds = %121
%126 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %127
127: ; preds = %125, %121
br label %128
128: ; preds = %127
%129 = load i32, i32* %16
%130 = add nsw i32 %129, 1
store i32 %130, i32* %16
br label %107
131: ; preds = %107
ret void
}

LLVM IR (-O2):
@__const.draw_korean.CHO_MAP = [21 x i32] [i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 3, i32 3, i32 3, i32 1, i32 2, i32 4, i32 4, i32 4, i32 2, i32 1, i32 3, i32 0]
@__const.draw_korean.JONG_MAP = [21 x i32] [i32 0, i32 2, i32 0, i32 2, i32 1, i32 2, i32 1, i32 2, i32 3, i32 0, i32 2, i32 1, i32 3, i32 3, i32 1, i32 2, i32 1, i32 3, i32 3, i32 1, i32 1]
@.str = [3 x i8] c" *\00"
@.str.1 = [3 x i8] c" \00"
define void @draw_korean(i32 %0, i32 %1, i32 %2) {
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds [21 x i32], [21 x i32]* @__const.draw_korean.CHO_MAP, i64 0, i64 %6
%8 = load i32, i32* %7
%9 = icmp eq i32 %2, 0
br i1 %9, label %26, label %10
10: ; preds = %3
%11 = add nsw i64 %6, -20
%12 = icmp ult i64 %11, -12
br i1 %12, label %26, label %13
13: ; preds = %10
%14 = lshr i64 266496, %6
%15 = and i64 %14, 1
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %26
17: ; preds = %13
switch i32 %1, label %18 [
i32 17, label %26
i32 13, label %26
]
18: ; preds = %17
%19 = lshr i64 527872, %6
%20 = and i64 %19, 1
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = add nsw i64 %6, -14
%24 = icmp ult i64 %23, 3
%25 = select i1 %24, i32 7, i32 %8
br label %26
26: ; preds = %18, %17, %17, %13, %10, %22, %3
%27 = phi i32 [ 2, %22 ], [ 0, %3 ], [ 2, %10 ], [ 2, %13 ], [ 2, %17 ], [ 2, %17 ], [ 2, %18 ]
%28 = phi i32 [ %25, %22 ], [ %8, %3 ], [ 5, %10 ], [ 6, %13 ], [ 6, %17 ], [ 6, %17 ], [ 7, %18 ]
%29 = and i32 %0, -17
%30 = icmp ne i32 %29, 0
%31 = zext i1 %30 to i32
%32 = or i32 %27, %31
%33 = getelementptr inbounds [21 x i32], [21 x i32]* @__const.draw_korean.JONG_MAP, i64 0, i64 %6
%34 = load i32, i32* %33
%35 = mul nsw i32 %28, 608
%36 = shl nsw i32 %0, 5
%37 = add nsw i32 %35, %36
%38 = call i32 @mask_32byte(i8* %5, i32 %37)
%39 = mul nuw nsw i32 %32, 672
%40 = shl nsw i32 %1, 5
%41 = add i32 %40, 4864
%42 = add i32 %41, %39
%43 = call i32 @mask_32byte(i8* %5, i32 %42)
br i1 %9, label %50, label %44
44: ; preds = %26
%45 = mul nsw i32 %34, 864
%46 = shl i32 %2, 5
%47 = add i32 %46, 7520
%48 = add i32 %47, %45
%49 = call i32 @mask_32byte(i8* %5, i32 %48)
br label %50
50: ; preds = %44, %26
br label %51
51: ; preds = %50, %62
%52 = phi i64 [ %63, %62 ], [ 0, %50 ]
%53 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 %52
%54 = load i8, i8* %53
%55 = icmp eq i8 %54, 1
%56 = select i1 %55, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0)
%57 = call i32 @printf(i8* dereferenceable(1) %56)
%58 = and i64 %52, 15
%59 = icmp eq i64 %58, 15
br i1 %59, label %60, label %62
60: ; preds = %51
%61 = call i32 @putchar(i32 10)
br label %62
62: ; preds = %51, %60
%63 = add nuw nsw i64 %52, 1
%64 = icmp eq i64 %63, 256
br i1 %64, label %65, label %51
65: ; preds = %62
ret void
}