#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 uint32_t;

/* Variables and functions */
int hangul_pair_compose(uint32_t *code, uint32_t a, uint32_t b) {
  if (a >= 0xAC00 && a < (0xAC00 + 11172) && b >= 0x11A7 && b < (0x11A7 + 28)) {
    *code = a + (b - 0x11A7);
    return 3;
  } else if (a >= 0x1100 && a < (0x1100 + 19) && b >= 0x1161 &&
             b < (0x1161 + 21)) {
    int li = a - 0x1100;
    int vi = b - 0x1161;
    *code = 0xAC00 + li * (21 * 28) + vi * 28;
    return 2;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<hangul_pair_compose>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
cmpl   $0xac00,-0x14(%rbp)
jl     1161 <hangul_pair_compose+0x61>
cmpl   $0xd7a4,-0x14(%rbp)
jge    1161 <hangul_pair_compose+0x61>
cmpl   $0x11a7,-0x18(%rbp)
jl     1161 <hangul_pair_compose+0x61>
cmpl   $0x11c3,-0x18(%rbp)
jge    1161 <hangul_pair_compose+0x61>
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%eax
sub    $0x11a7,%eax
add    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x3,-0x4(%rbp)
jmp    11d7 <hangul_pair_compose+0xd7>
cmpl   $0x1100,-0x14(%rbp)
jl     11d0 <hangul_pair_compose+0xd0>
cmpl   $0x1113,-0x14(%rbp)
jge    11d0 <hangul_pair_compose+0xd0>
cmpl   $0x1161,-0x18(%rbp)
jl     11d0 <hangul_pair_compose+0xd0>
cmpl   $0x1176,-0x18(%rbp)
jge    11d0 <hangul_pair_compose+0xd0>
mov    -0x14(%rbp),%eax
sub    $0x1100,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
sub    $0x1161,%eax
mov    %eax,-0x20(%rbp)
imul   $0x24c,-0x1c(%rbp),%ecx
add    $0xac00,%ecx
imul   $0x1c,-0x20(%rbp),%eax
add    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x2,-0x4(%rbp)
jmp    11d7 <hangul_pair_compose+0xd7>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hangul_pair_compose>:
lea    -0xac00(%rsi),%eax
cmp    $0x2ba3,%eax
ja     1121 <hangul_pair_compose+0x21>
lea    -0x11a7(%rdx),%ecx
cmp    $0x1b,%ecx
ja     1121 <hangul_pair_compose+0x21>
add    %esi,%ecx
mov    $0x3,%eax
jmp    1154 <hangul_pair_compose+0x54>
lea    -0x1100(%rsi),%ecx
xor    %eax,%eax
cmp    $0x12,%ecx
ja     1156 <hangul_pair_compose+0x56>
lea    -0x1161(%rdx),%ecx
cmp    $0x14,%ecx
ja     1156 <hangul_pair_compose+0x56>
imul   $0x24c,%esi,%eax
lea    (%rdx,%rdx,8),%ecx
lea    (%rcx,%rcx,2),%ecx
add    %edx,%ecx
add    %eax,%ecx
add    $0xffd7b964,%ecx
mov    $0x2,%eax
mov    %ecx,(%rdi)
ret

LLVM IR (-O0):
define i32 @hangul_pair_compose(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%10 = load i32, i32* %6
%11 = icmp sge i32 %10, 44032
br i1 %11, label %12, label %27
12: ; preds = %3
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, 55204
br i1 %14, label %15, label %27
15: ; preds = %12
%16 = load i32, i32* %7
%17 = icmp sge i32 %16, 4519
br i1 %17, label %18, label %27
18: ; preds = %15
%19 = load i32, i32* %7
%20 = icmp slt i32 %19, 4547
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = load i32, i32* %6
%23 = load i32, i32* %7
%24 = sub nsw i32 %23, 4519
%25 = add nsw i32 %22, %24
%26 = load i32*, i32** %5
store i32 %25, i32* %26
store i32 3, i32* %4
br label %52
27: ; preds = %18, %15, %12, %3
%28 = load i32, i32* %6
%29 = icmp sge i32 %28, 4352
br i1 %29, label %30, label %51
30: ; preds = %27
%31 = load i32, i32* %6
%32 = icmp slt i32 %31, 4371
br i1 %32, label %33, label %51
33: ; preds = %30
%34 = load i32, i32* %7
%35 = icmp sge i32 %34, 4449
br i1 %35, label %36, label %51
36: ; preds = %33
%37 = load i32, i32* %7
%38 = icmp slt i32 %37, 4470
br i1 %38, label %39, label %51
39: ; preds = %36
%40 = load i32, i32* %6
%41 = sub nsw i32 %40, 4352
store i32 %41, i32* %8
%42 = load i32, i32* %7
%43 = sub nsw i32 %42, 4449
store i32 %43, i32* %9
%44 = load i32, i32* %8
%45 = mul nsw i32 %44, 588
%46 = add nsw i32 44032, %45
%47 = load i32, i32* %9
%48 = mul nsw i32 %47, 28
%49 = add nsw i32 %46, %48
%50 = load i32*, i32** %5
store i32 %49, i32* %50
store i32 2, i32* %4
br label %52
51: ; preds = %36, %33, %30, %27
store i32 0, i32* %4
br label %52
52: ; preds = %51, %39, %21
%53 = load i32, i32* %4
ret i32 %53
}

LLVM IR (-O2):
define i32 @hangul_pair_compose(i32* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = add i32 %1, -44032
%5 = icmp ult i32 %4, 11172
%6 = add i32 %2, -4519
%7 = icmp ult i32 %6, 28
%8 = and i1 %5, %7
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = add nuw nsw i32 %6, %1
br label %22
11: ; preds = %3
%12 = add i32 %1, -4352
%13 = icmp ult i32 %12, 19
%14 = add i32 %2, -4449
%15 = icmp ult i32 %14, 21
%16 = and i1 %13, %15
br i1 %16, label %17, label %25
17: ; preds = %11
%18 = mul nuw nsw i32 %1, 588
%19 = mul nuw nsw i32 %2, 28
%20 = add nuw nsw i32 %18, -2639516
%21 = add nsw i32 %20, %19
br label %22
22: ; preds = %9, %17
%23 = phi i32 [ %21, %17 ], [ %10, %9 ]
%24 = phi i32 [ 2, %17 ], [ 3, %9 ]
store i32 %23, i32* %0
br label %25
25: ; preds = %22, %11
%26 = phi i32 [ 0, %11 ], [ %24, %22 ]
ret i32 %26
}