#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ URegularExpression;
struct TYPE_3__ {
  int offset;
};
typedef TYPE_1__ UParseError;
typedef int /*<<< orphan*/ UErrorCode;
typedef int /*<<< orphan*/ UChar;
typedef scalar_t__ UBool;

/* Variables and functions */
scalar_t__ TRUE;
scalar_t__ U_FAILURE(int /*<<< orphan*/);
int /*<<< orphan*/ U_ZERO_ERROR;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *, ...);
int /*<<< orphan*/ strlen(char *);
char *u_errorName(int /*<<< orphan*/);
int /*<<< orphan*/ u_strlen(int /*<<< orphan*/ *);
int /*<<< orphan*/ u_uastrcpy(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ uregex_close(int /*<<< orphan*/ *);
scalar_t__ uregex_matches64(int /*<<< orphan*/ *, int /*<<< orphan*/,
                            int /*<<< orphan*/ *);
int /*<<< orphan*/ *uregex_openC(char *, int /*<<< orphan*/, TYPE_1__ *,
                                 int /*<<< orphan*/ *);
int /*<<< orphan*/ uregex_setText(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                  int /*<<< orphan*/, int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  UErrorCode status = U_ZERO_ERROR;
  UParseError parseErr;
  char *pattern = "\\p{script=han}{1}";
  URegularExpression *reExp = uregex_openC(pattern, 0, &parseErr, &status);
  if (U_FAILURE(status)) {
    printf("error in pattern: \"%s\" at position %d\n", u_errorName(status),
           parseErr.offset);
    exit(-1);
  }
  char *input = "哈哈";
  UChar stringToExamine[strlen(input) + 1];
  u_uastrcpy(stringToExamine, input);
  status = U_ZERO_ERROR;
  uregex_setText(reExp, stringToExamine, u_strlen(stringToExamine), &status);
  if (U_FAILURE(status)) {
    printf("uregex_setUText error: %s\n", u_errorName(status));
    exit(1);
  }
  status = U_ZERO_ERROR;
  UBool doMatch = uregex_matches64(reExp, 0, &status);
  if (U_FAILURE(status)) {
    printf("uregex_matches64 error: %s\n", u_errorName(status));
    exit(1);
  }
  printf("uregex_matches64 %s\n", doMatch == TRUE ? "TRUE" : "FALSE");
  uregex_close(reExp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e1b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
lea    0xe27(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
xor    %esi,%esi
lea    -0x18(%rbp),%rdx
lea    -0x14(%rbp),%rcx
call   10b0 <uregex_openC@plt>
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
call   1070 <U_FAILURE@plt>
cmp    $0x0,%rax
je     122c <main+0x7c>
mov    -0x14(%rbp),%edi
call   1030 <u_errorName@plt>
mov    %rax,%rsi
mov    -0x18(%rbp),%edx
lea    0xdf7(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    $0xffffffff,%edi
call   10d0 <exit@plt>
lea    0xe06(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   1080 <strlen@plt>
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x38(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x50(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rsi
call   1040 <u_uastrcpy@plt>
mov    -0x50(%rbp),%rdi
mov    0x2d6d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x58(%rbp)
call   10c0 <u_strlen@plt>
mov    -0x58(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    %eax,%edx
lea    -0x14(%rbp),%rcx
call   1060 <uregex_setText@plt>
mov    -0x14(%rbp),%edi
call   1070 <U_FAILURE@plt>
cmp    $0x0,%rax
je     12d5 <main+0x125>
mov    -0x14(%rbp),%edi
call   1030 <u_errorName@plt>
mov    %rax,%rsi
lea    0xd7c(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0x2d0c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x28(%rbp),%rdi
xor    %esi,%esi
lea    -0x14(%rbp),%rdx
call   10a0 <uregex_matches64@plt>
mov    %rax,-0x48(%rbp)
mov    -0x14(%rbp),%edi
call   1070 <U_FAILURE@plt>
cmp    $0x0,%rax
je     1329 <main+0x179>
mov    -0x14(%rbp),%edi
call   1030 <u_errorName@plt>
mov    %rax,%rsi
lea    0xd43(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x48(%rbp),%rcx
mov    0x2cac(%rip),%rax
mov    (%rax),%rdx
lea    0xd53(%rip),%rsi
lea    0xd47(%rip),%rax
cmp    %rdx,%rcx
cmove  %rax,%rsi
lea    0xd24(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1050 <uregex_close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2e23(%rip),%r13
mov    0x0(%r13),%eax
mov    %eax,-0x2c(%rbp)
lea    0xe2d(%rip),%rdi
lea    -0x30(%rbp),%rdx
lea    -0x2c(%rbp),%rcx
xor    %esi,%esi
call   10b0 <uregex_openC@plt>
mov    %rax,%r14
mov    -0x2c(%rbp),%edi
call   1070 <U_FAILURE@plt>
test   %rax,%rax
jne    12c7 <main+0x117>
lea    0xe3c(%rip),%r15
mov    %r15,%rdi
call   1080 <strlen@plt>
mov    %rsp,%r12
add    $0x1,%eax
mov    %rsp,%rbx
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <u_uastrcpy@plt>
mov    0x0(%r13),%eax
mov    %eax,-0x2c(%rbp)
mov    %rbx,%rdi
call   10c0 <u_strlen@plt>
lea    -0x2c(%rbp),%rcx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1060 <uregex_setText@plt>
mov    -0x2c(%rbp),%edi
call   1070 <U_FAILURE@plt>
test   %rax,%rax
jne    12ed <main+0x13d>
mov    0x0(%r13),%eax
mov    %eax,-0x2c(%rbp)
lea    -0x2c(%rbp),%rdx
mov    %r14,%rdi
xor    %esi,%esi
call   10a0 <uregex_matches64@plt>
mov    %rax,%rbx
mov    -0x2c(%rbp),%edi
call   1070 <U_FAILURE@plt>
test   %rax,%rax
jne    12fe <main+0x14e>
mov    0x2d58(%rip),%rax
cmp    (%rax),%rbx
lea    0xdfa(%rip),%rax
lea    0xdf8(%rip),%rsi
cmove  %rax,%rsi
lea    0xdd3(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %r14,%rdi
call   1050 <uregex_close@plt>
mov    %r12,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    -0x2c(%rbp),%edi
call   1030 <u_errorName@plt>
mov    -0x30(%rbp),%edx
lea    0xd39(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0xffffffff,%edi
call   10d0 <exit@plt>
mov    -0x2c(%rbp),%edi
call   1030 <u_errorName@plt>
lea    0xd44(%rip),%rdi
jmp    130d <main+0x15d>
mov    -0x2c(%rbp),%edi
call   1030 <u_errorName@plt>
lea    0xd4e(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32 }
@U_ZERO_ERROR = global i32 0
@.str = [18 x i8] c"\\p{script=han}{1}\00"
@.str.1 = [39 x i8] c"error in pattern: \22%s\22 at position %d\0A\00"
@.str.2 = [7 x i8] c"\E5\93\88\E5\93\88\00"
@.str.3 = [27 x i8] c"uregex_setUText error: %s\0A\00"
@.str.4 = [28 x i8] c"uregex_matches64 error: %s\0A\00"
@.str.5 = [21 x i8] c"uregex_matches64 %s\0A\00"
@TRUE = global i64 0
@.str.6 = [5 x i8] c"TRUE\00"
@.str.7 = [6 x i8] c"FALSE\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.TYPE_3__
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* @U_ZERO_ERROR
store i32 %14, i32* %6
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %8
%15 = load i8*, i8** %8
%16 = call i32* @uregex_openC(i8* %15, i32 0, %struct.TYPE_3__* %7, i32* %6)
store i32* %16, i32** %9
%17 = load i32, i32* %6
%18 = call i64 @U_FAILURE(i32 %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %27
20: ; preds = %2
%21 = load i32, i32* %6
%22 = call i8* @u_errorName(i32 %21)
%23 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %7, i32 0, i32 0
%24 = load i32, i32* %23
%25 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %22, i32 %24)
%26 = call i32 @exit(i32 -1)
unreachable
27: ; preds = %2
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8** %10
%28 = load i8*, i8** %10
%29 = call i32 @strlen(i8* %28)
%30 = add nsw i32 %29, 1
%31 = zext i32 %30 to i64
%32 = call i8* @llvm.stacksave()
store i8* %32, i8** %11
%33 = alloca i32, i64 %31
store i64 %31, i64* %12
%34 = load i8*, i8** %10
%35 = call i32 @u_uastrcpy(i32* %33, i8* %34)
%36 = load i32, i32* @U_ZERO_ERROR
store i32 %36, i32* %6
%37 = load i32*, i32** %9
%38 = call i32 @u_strlen(i32* %33)
%39 = call i32 @uregex_setText(i32* %37, i32* %33, i32 %38, i32* %6)
%40 = load i32, i32* %6
%41 = call i64 @U_FAILURE(i32 %40)
%42 = icmp ne i64 %41, 0
br i1 %42, label %43, label %48
43: ; preds = %27
%44 = load i32, i32* %6
%45 = call i8* @u_errorName(i32 %44)
%46 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %45)
%47 = call i32 @exit(i32 1)
unreachable
48: ; preds = %27
%49 = load i32, i32* @U_ZERO_ERROR
store i32 %49, i32* %6
%50 = load i32*, i32** %9
%51 = call i64 @uregex_matches64(i32* %50, i32 0, i32* %6)
store i64 %51, i64* %13
%52 = load i32, i32* %6
%53 = call i64 @U_FAILURE(i32 %52)
%54 = icmp ne i64 %53, 0
br i1 %54, label %55, label %60
55: ; preds = %48
%56 = load i32, i32* %6
%57 = call i8* @u_errorName(i32 %56)
%58 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i8* %57)
%59 = call i32 @exit(i32 1)
unreachable
60: ; preds = %48
%61 = load i64, i64* %13
%62 = load i64, i64* @TRUE
%63 = icmp eq i64 %61, %62
%64 = zext i1 %63 to i64
%65 = select i1 %63, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0)
%66 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %65)
%67 = load i32*, i32** %9
%68 = call i32 @uregex_close(i32* %67)
store i32 0, i32* %3
%69 = load i8*, i8** %11
%70 = load i32, i32* %3
ret i32 %70
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32 }
@U_ZERO_ERROR = global i32 0
@.str = [18 x i8] c"\\p{script=han}{1}\00"
@.str.1 = [39 x i8] c"error in pattern: \22%s\22 at position %d\0A\00"
@.str.2 = [7 x i8] c"\E5\93\88\E5\93\88\00"
@.str.3 = [27 x i8] c"uregex_setUText error: %s\0A\00"
@.str.4 = [28 x i8] c"uregex_matches64 error: %s\0A\00"
@.str.5 = [21 x i8] c"uregex_matches64 %s\0A\00"
@TRUE = global i64 0
@.str.6 = [5 x i8] c"TRUE\00"
@.str.7 = [6 x i8] c"FALSE\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_3__
%5 = bitcast i32* %3 to i8*
%6 = load i32, i32* @U_ZERO_ERROR
store i32 %6, i32* %3
%7 = bitcast %struct.TYPE_3__* %4 to i8*
%8 = call i32* @uregex_openC(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 0, %struct.TYPE_3__* %4, i32* %3)
%9 = load i32, i32* %3
%10 = call i64 @U_FAILURE(i32 %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %19, label %12
12: ; preds = %2
%13 = load i32, i32* %3
%14 = call i8* @u_errorName(i32 %13)
%15 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %4, i64 0, i32 0
%16 = load i32, i32* %15
%17 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %14, i32 %16)
%18 = call i32 @exit(i32 -1)
unreachable
19: ; preds = %2
%20 = call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%21 = add nsw i32 %20, 1
%22 = zext i32 %21 to i64
%23 = call i8* @llvm.stacksave()
%24 = alloca i32, i64 %22
%25 = call i32 @u_uastrcpy(i32* %24, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%26 = load i32, i32* @U_ZERO_ERROR
store i32 %26, i32* %3
%27 = call i32 @u_strlen(i32* %24)
%28 = call i32 @uregex_setText(i32* %8, i32* %24, i32 %27, i32* %3)
%29 = load i32, i32* %3
%30 = call i64 @U_FAILURE(i32 %29)
%31 = icmp eq i64 %30, 0
br i1 %31, label %37, label %32
32: ; preds = %19
%33 = load i32, i32* %3
%34 = call i8* @u_errorName(i32 %33)
%35 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %34)
%36 = call i32 @exit(i32 1)
unreachable
37: ; preds = %19
%38 = load i32, i32* @U_ZERO_ERROR
store i32 %38, i32* %3
%39 = call i64 @uregex_matches64(i32* %8, i32 0, i32* %3)
%40 = load i32, i32* %3
%41 = call i64 @U_FAILURE(i32 %40)
%42 = icmp eq i64 %41, 0
br i1 %42, label %48, label %43
43: ; preds = %37
%44 = load i32, i32* %3
%45 = call i8* @u_errorName(i32 %44)
%46 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i8* %45)
%47 = call i32 @exit(i32 1)
unreachable
48: ; preds = %37
%49 = load i64, i64* @TRUE
%50 = icmp eq i64 %39, %49
%51 = select i1 %50, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0)
%52 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %51)
%53 = call i32 @uregex_close(i32* %8)
ret i32 0
}