#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*/ unicode_to_cp949(long, int *, int *);
int unicode_to_ksx1001(long int unicode, int *r, int *c) {
  int rr, cc;
  if (!unicode_to_cp949(unicode, &rr, &cc))
    return 0;
  rr -= 0x21;
  cc -= 0x61;
  if (rr < 0 || rr >= 94 || cc < 0 || cc >= 94)
    return 0;
  *r = rr;
  *c = cc;
  return 1;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x24(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1030 <unicode_to_cp949@plt>
cmp    $0x0,%eax
jne    114a <unicode_to_ksx1001+0x3a>
movl   $0x0,-0x4(%rbp)
jmp    11a9 <unicode_to_ksx1001+0x99>
mov    -0x24(%rbp),%eax
sub    $0x21,%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
sub    $0x61,%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x24(%rbp)
jl     1184 <unicode_to_ksx1001+0x74>
cmpl   $0x5e,-0x24(%rbp)
jge    1184 <unicode_to_ksx1001+0x74>
cmpl   $0x0,-0x28(%rbp)
jl     1184 <unicode_to_ksx1001+0x74>
cmpl   $0x5e,-0x28(%rbp)
jl     1190 <unicode_to_ksx1001+0x80>
movl   $0x0,-0x4(%rbp)
jmp    11a9 <unicode_to_ksx1001+0x99>
mov    -0x24(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1030 <unicode_to_cp949@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
je     115b <unicode_to_ksx1001+0x4b>
mov    0x4(%rsp),%ecx
lea    -0x7f(%rcx),%edx
cmp    $0xffffffa2,%edx
jb     115b <unicode_to_ksx1001+0x4b>
mov    (%rsp),%edx
cmp    $0x61,%edx
jl     115b <unicode_to_ksx1001+0x4b>
cmp    $0xbe,%edx
jg     115b <unicode_to_ksx1001+0x4b>
add    $0xffffff9f,%edx
add    $0xffffffdf,%ecx
mov    %ecx,(%rbx)
mov    %edx,(%r14)
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @unicode_to_ksx1001(i64 %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
store i64 %0, i64* %5
store i32* %1, i32** %6
store i32* %2, i32** %7
%10 = load i64, i64* %5
%11 = call i32 @unicode_to_cp949(i64 %10, i32* %8, i32* %9)
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %3
store i32 0, i32* %4
br label %36
14: ; preds = %3
%15 = load i32, i32* %8
%16 = sub nsw i32 %15, 33
store i32 %16, i32* %8
%17 = load i32, i32* %9
%18 = sub nsw i32 %17, 97
store i32 %18, i32* %9
%19 = load i32, i32* %8
%20 = icmp slt i32 %19, 0
br i1 %20, label %30, label %21
21: ; preds = %14
%22 = load i32, i32* %8
%23 = icmp sge i32 %22, 94
br i1 %23, label %30, label %24
24: ; preds = %21
%25 = load i32, i32* %9
%26 = icmp slt i32 %25, 0
br i1 %26, label %30, label %27
27: ; preds = %24
%28 = load i32, i32* %9
%29 = icmp sge i32 %28, 94
br i1 %29, label %30, label %31
30: ; preds = %27, %24, %21, %14
store i32 0, i32* %4
br label %36
31: ; preds = %27
%32 = load i32, i32* %8
%33 = load i32*, i32** %6
store i32 %32, i32* %33
%34 = load i32, i32* %9
%35 = load i32*, i32** %7
store i32 %34, i32* %35
store i32 1, i32* %4
br label %36
36: ; preds = %31, %30, %13
%37 = load i32, i32* %4
ret i32 %37
}

LLVM IR (-O2):
define i32 @unicode_to_ksx1001(i64 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %4 to i8*
%7 = bitcast i32* %5 to i8*
%8 = call i32 @unicode_to_cp949(i64 %0, i32* %4, i32* %5)
%9 = icmp eq i32 %8, 0
br i1 %9, label %22, label %10
10: ; preds = %3
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = add i32 %11, -127
%14 = icmp ult i32 %13, -94
%15 = icmp slt i32 %12, 97
%16 = select i1 %14, i1 true, i1 %15
%17 = icmp sgt i32 %12, 190
%18 = select i1 %16, i1 true, i1 %17
br i1 %18, label %22, label %19
19: ; preds = %10
%20 = add nsw i32 %12, -97
%21 = add nsw i32 %11, -33
store i32 %21, i32* %1
store i32 %20, i32* %2
br label %22
22: ; preds = %10, %3, %19
%23 = phi i32 [ 1, %19 ], [ 0, %3 ], [ 0, %10 ]
ret i32 %23
}