#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 */
unsigned int hangul_join(unsigned int, unsigned int, unsigned int);
unsigned int utf8_decode(char const *, int /*<<< orphan*/ *);
unsigned int hangul_join_utf8char(const char *lead_utf8char,
                                  const char *vowel_utf8char,
                                  const char *tail_utf8char) {
  unsigned int lead = 0, vowel = 0, tail = 0;
  if (lead_utf8char)
    lead = utf8_decode(lead_utf8char, NULL);
  if (vowel_utf8char)
    vowel = utf8_decode(vowel_utf8char, NULL);
  if (tail_utf8char && tail_utf8char[0])
    tail = utf8_decode(tail_utf8char, NULL);
  return hangul_join(lead, vowel, tail);
}


x86 assembly (clang, -O0):
<hangul_join_utf8char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1164 <hangul_join_utf8char+0x44>
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <utf8_decode@plt>
mov    %eax,-0x1c(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     117f <hangul_join_utf8char+0x5f>
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <utf8_decode@plt>
mov    %eax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11aa <hangul_join_utf8char+0x8a>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11aa <hangul_join_utf8char+0x8a>
mov    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <utf8_decode@plt>
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1030 <hangul_join@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hangul_join_utf8char>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%rbp
xor    %r14d,%r14d
mov    $0x0,%r15d
test   %rdi,%rdi
je     1145 <hangul_join_utf8char+0x25>
xor    %esi,%esi
call   1040 <utf8_decode@plt>
mov    %eax,%r15d
test   %rbp,%rbp
je     1157 <hangul_join_utf8char+0x37>
mov    %rbp,%rdi
xor    %esi,%esi
call   1040 <utf8_decode@plt>
mov    %eax,%r14d
xor    %edx,%edx
test   %rbx,%rbx
je     116f <hangul_join_utf8char+0x4f>
cmpb   $0x0,(%rbx)
je     116f <hangul_join_utf8char+0x4f>
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <utf8_decode@plt>
mov    %eax,%edx
mov    %r15d,%edi
mov    %r14d,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <hangul_join@plt>

LLVM IR (-O0):
define i32 @hangul_join_utf8char(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
%10 = load i8*, i8** %4
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = load i8*, i8** %4
%14 = call i32 @utf8_decode(i8* %13, i32* null)
store i32 %14, i32* %7
br label %15
15: ; preds = %12, %3
%16 = load i8*, i8** %5
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i8*, i8** %5
%20 = call i32 @utf8_decode(i8* %19, i32* null)
store i32 %20, i32* %8
br label %21
21: ; preds = %18, %15
%22 = load i8*, i8** %6
%23 = icmp ne i8* %22, null
br i1 %23, label %24, label %33
24: ; preds = %21
%25 = load i8*, i8** %6
%26 = getelementptr inbounds i8, i8* %25, i64 0
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %24
%31 = load i8*, i8** %6
%32 = call i32 @utf8_decode(i8* %31, i32* null)
store i32 %32, i32* %9
br label %33
33: ; preds = %30, %24, %21
%34 = load i32, i32* %7
%35 = load i32, i32* %8
%36 = load i32, i32* %9
%37 = call i32 @hangul_join(i32 %34, i32 %35, i32 %36)
ret i32 %37
}

LLVM IR (-O2):
define i32 @hangul_join_utf8char(i8* %0, i8* %1, i8* %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @utf8_decode(i8* %0, i32* null)
br label %7
7: ; preds = %5, %3
%8 = phi i32 [ %6, %5 ], [ 0, %3 ]
%9 = icmp eq i8* %1, null
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i32 @utf8_decode(i8* %1, i32* null)
br label %12
12: ; preds = %10, %7
%13 = phi i32 [ %11, %10 ], [ 0, %7 ]
%14 = icmp eq i8* %2, null
br i1 %14, label %20, label %15
15: ; preds = %12
%16 = load i8, i8* %2
%17 = icmp eq i8 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = tail call i32 @utf8_decode(i8* %2, i32* null)
br label %20
20: ; preds = %18, %15, %12
%21 = phi i32 [ %19, %18 ], [ 0, %15 ], [ 0, %12 ]
%22 = tail call i32 @hangul_join(i32 %8, i32 %13, i32 %21)
ret i32 %22
}