#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 EXIT_SUCCESS;
int /*<<< orphan*/ cut_input(char *, char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ free(char *);
int getopt(int, char **, char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ optarg;
int optopt;
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(int /*<<< orphan*/);
int main(int argc, char **argv) {
  if (argc != 7) {
    fprintf(stderr, "Usage:\n%s -j dict_jieba -h dict_hmm -u dict_user\n",
            argv[0]);
    return 1;
  }
  char *DICT_PATH;
  char *HMM_PATH;
  char *USER_DICT;
  int opt = 0;
  while ((opt = getopt(argc, argv, "j:h:u:")) != -1) {
    switch (opt) {
    case 'j':
      DICT_PATH = (char *)malloc(sizeof(char) * (strlen(optarg) + 1));
      strcpy(DICT_PATH, optarg);
      break;
    case 'h':
      HMM_PATH = (char *)malloc(sizeof(char) * (strlen(optarg) + 1));
      strcpy(HMM_PATH, optarg);
      break;
    case 'u':
      USER_DICT = (char *)malloc(sizeof(char) * (strlen(optarg) + 1));
      strcpy(USER_DICT, optarg);
      break;
    case '?':
      printf("Unknow option：%c/n", optopt);
      break;
    }
  }
  cut_input(DICT_PATH, HMM_PATH, USER_DICT);
  free(DICT_PATH);
  free(HMM_PATH);
  free(USER_DICT);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x7,-0x8(%rbp)
je     11c8 <main+0x48>
mov    0x2e29(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe49(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1332 <main+0x1b2>
movl   $0x0,-0x2c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe55(%rip),%rdx
call   1090 <getopt@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0xffffffff,%eax
je     12fa <main+0x17a>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
sub    $0x3f,%eax
je     12e0 <main+0x160>
jmp    1202 <main+0x82>
mov    -0x30(%rbp),%eax
sub    $0x68,%eax
je     126e <main+0xee>
jmp    1213 <main+0x93>
mov    -0x30(%rbp),%eax
sub    $0x6a,%eax
je     1235 <main+0xb5>
jmp    1224 <main+0xa4>
mov    -0x30(%rbp),%eax
sub    $0x75,%eax
je     12a7 <main+0x127>
jmp    12f5 <main+0x175>
mov    0x2dbc(%rip),%rax
mov    (%rax),%edi
call   1050 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2d96(%rip),%rax
mov    (%rax),%esi
call   1040 <strcpy@plt>
jmp    12f5 <main+0x175>
mov    0x2d83(%rip),%rax
mov    (%rax),%edi
call   1050 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    0x2d5d(%rip),%rax
mov    (%rax),%esi
call   1040 <strcpy@plt>
jmp    12f5 <main+0x175>
mov    0x2d4a(%rip),%rax
mov    (%rax),%edi
call   1050 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    0x2d24(%rip),%rax
mov    (%rax),%esi
call   1040 <strcpy@plt>
jmp    12f5 <main+0x175>
mov    0x2cf9(%rip),%rax
mov    (%rax),%esi
lea    0xd49(%rip),%rdi
call   1060 <printf@plt>
jmp    11cf <main+0x4f>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   10a0 <cut_input@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    0x2c9b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
cmp    $0x7,%edi
jne    126d <main+0xed>
lea    0xe91(%rip),%r14
mov    0x2e38(%rip),%r15
lea    0xe8a(%rip),%r12
jmp    11cb <main+0x4b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r15),%esi
mov    %r12,%rdi
call   1060 <printf@plt>
mov    $0x7,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1090 <getopt@plt>
cmp    $0x67,%eax
jg     11f0 <main+0x70>
cmp    $0x3f,%eax
je     11c0 <main+0x40>
cmp    $0xffffffff,%eax
jne    11cb <main+0x4b>
jmp    128c <main+0x10c>
nop
cmp    $0x68,%eax
je     1220 <main+0xa0>
cmp    $0x75,%eax
je     1241 <main+0xc1>
cmp    $0x6a,%eax
jne    11cb <main+0x4b>
mov    0x2df2(%rip),%r13
mov    0x0(%r13),%edi
call   1050 <strlen@plt>
lea    0x1(%rax),%edi
call   1080 <malloc@plt>
mov    0x0(%r13),%esi
mov    %rax,%r13
jmp    1260 <main+0xe0>
mov    0x2dd1(%rip),%rbp
mov    0x0(%rbp),%edi
call   1050 <strlen@plt>
lea    0x1(%rax),%edi
call   1080 <malloc@plt>
mov    0x0(%rbp),%esi
mov    %rax,0x8(%rsp)
jmp    1260 <main+0xe0>
mov    0x2db0(%rip),%rbp
mov    0x0(%rbp),%edi
call   1050 <strlen@plt>
lea    0x1(%rax),%edi
call   1080 <malloc@plt>
mov    0x0(%rbp),%esi
mov    %rax,0x10(%rsp)
mov    %rax,%rdi
call   1040 <strcpy@plt>
jmp    11cb <main+0x4b>
mov    0x2d5c(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xd80(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%eax
jmp    12c5 <main+0x145>
mov    %r13,%rdi
mov    0x8(%rsp),%rbp
mov    %rbp,%rsi
mov    0x10(%rsp),%rbx
mov    %rbx,%rdx
call   10a0 <cut_input@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x2d05(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [50 x i8] c"Usage:\0A%s -j dict_jieba -h dict_hmm -u dict_user\0A\00"
@.str.1 = [7 x i8] c"j:h:u:\00"
@optarg = global i32 0
@.str.2 = [21 x i8] c"Unknow option\EF\BC\9A%c/n\00"
@optopt = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 7
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %16)
store i32 1, i32* %3
br label %78
18: ; preds = %2
store i32 0, i32* %9
br label %19
19: ; preds = %65, %18
%20 = load i32, i32* %4
%21 = load i8**, i8*** %5
%22 = call i32 @getopt(i32 %20, i8** %21, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
store i32 %22, i32* %9
%23 = icmp ne i32 %22, -1
br i1 %23, label %24, label %66
24: ; preds = %19
%25 = load i32, i32* %9
switch i32 %25, label %65 [
i32 106, label %26
i32 104, label %38
i32 117, label %50
i32 63, label %62
]
26: ; preds = %24
%27 = load i32, i32* @optarg
%28 = call i32 @strlen(i32 %27)
%29 = add nsw i32 %28, 1
%30 = sext i32 %29 to i64
%31 = mul i64 1, %30
%32 = trunc i64 %31 to i32
%33 = call i64 @malloc(i32 %32)
%34 = inttoptr i64 %33 to i8*
store i8* %34, i8** %6
%35 = load i8*, i8** %6
%36 = load i32, i32* @optarg
%37 = call i32 @strcpy(i8* %35, i32 %36)
br label %65
38: ; preds = %24
%39 = load i32, i32* @optarg
%40 = call i32 @strlen(i32 %39)
%41 = add nsw i32 %40, 1
%42 = sext i32 %41 to i64
%43 = mul i64 1, %42
%44 = trunc i64 %43 to i32
%45 = call i64 @malloc(i32 %44)
%46 = inttoptr i64 %45 to i8*
store i8* %46, i8** %7
%47 = load i8*, i8** %7
%48 = load i32, i32* @optarg
%49 = call i32 @strcpy(i8* %47, i32 %48)
br label %65
50: ; preds = %24
%51 = load i32, i32* @optarg
%52 = call i32 @strlen(i32 %51)
%53 = add nsw i32 %52, 1
%54 = sext i32 %53 to i64
%55 = mul i64 1, %54
%56 = trunc i64 %55 to i32
%57 = call i64 @malloc(i32 %56)
%58 = inttoptr i64 %57 to i8*
store i8* %58, i8** %8
%59 = load i8*, i8** %8
%60 = load i32, i32* @optarg
%61 = call i32 @strcpy(i8* %59, i32 %60)
br label %65
62: ; preds = %24
%63 = load i32, i32* @optopt
%64 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %63)
br label %65
65: ; preds = %24, %62, %50, %38, %26
br label %19
66: ; preds = %19
%67 = load i8*, i8** %6
%68 = load i8*, i8** %7
%69 = load i8*, i8** %8
%70 = call i32 @cut_input(i8* %67, i8* %68, i8* %69)
%71 = load i8*, i8** %6
%72 = call i32 @free(i8* %71)
%73 = load i8*, i8** %7
%74 = call i32 @free(i8* %73)
%75 = load i8*, i8** %8
%76 = call i32 @free(i8* %75)
%77 = load i32, i32* @EXIT_SUCCESS
store i32 %77, i32* %3
br label %78
78: ; preds = %66, %12
%79 = load i32, i32* %3
ret i32 %79
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [50 x i8] c"Usage:\0A%s -j dict_jieba -h dict_hmm -u dict_user\0A\00"
@.str.1 = [7 x i8] c"j:h:u:\00"
@optarg = global i32 0
@.str.2 = [21 x i8] c"Unknow option\EF\BC\9A%c/n\00"
@optopt = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = icmp eq i32 %0, 7
br i1 %3, label %19, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %53
8: ; preds = %10, %42
%9 = tail call i32 @getopt(i32 7, i8** %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
switch i32 %9, label %10 [
i32 -1, label %47
i32 106, label %11
i32 104, label %23
i32 117, label %34
i32 63, label %44
]
10: ; preds = %8, %44
br label %8
11: ; preds = %8
%12 = load i32, i32* @optarg
%13 = tail call i32 @strlen(i32 %12)
%14 = add nsw i32 %13, 1
%15 = tail call i64 @malloc(i32 %14)
%16 = inttoptr i64 %15 to i8*
%17 = load i32, i32* @optarg
%18 = tail call i32 @strcpy(i8* %16, i32 %17)
br label %19
19: ; preds = %2, %11
%20 = phi i8* [ %16, %11 ], [ undef, %2 ]
%21 = phi i8* [ %32, %11 ], [ undef, %2 ]
%22 = phi i8* [ %43, %11 ], [ undef, %2 ]
br label %31
23: ; preds = %8
%24 = load i32, i32* @optarg
%25 = tail call i32 @strlen(i32 %24)
%26 = add nsw i32 %25, 1
%27 = tail call i64 @malloc(i32 %26)
%28 = inttoptr i64 %27 to i8*
%29 = load i32, i32* @optarg
%30 = tail call i32 @strcpy(i8* %28, i32 %29)
br label %31
31: ; preds = %19, %23
%32 = phi i8* [ %21, %19 ], [ %28, %23 ]
%33 = phi i8* [ %22, %19 ], [ %43, %23 ]
br label %42
34: ; preds = %8
%35 = load i32, i32* @optarg
%36 = tail call i32 @strlen(i32 %35)
%37 = add nsw i32 %36, 1
%38 = tail call i64 @malloc(i32 %37)
%39 = inttoptr i64 %38 to i8*
%40 = load i32, i32* @optarg
%41 = tail call i32 @strcpy(i8* %39, i32 %40)
br label %42
42: ; preds = %31, %34
%43 = phi i8* [ %33, %31 ], [ %39, %34 ]
br label %8
44: ; preds = %8
%45 = load i32, i32* @optopt
%46 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %45)
br label %10
47: ; preds = %8
%48 = tail call i32 @cut_input(i8* %20, i8* %32, i8* %43)
%49 = tail call i32 @free(i8* %20)
%50 = tail call i32 @free(i8* %32)
%51 = tail call i32 @free(i8* %43)
%52 = load i32, i32* @EXIT_SUCCESS
br label %53
53: ; preds = %47, %4
%54 = phi i32 [ 1, %4 ], [ %52, %47 ]
ret i32 %54
}