#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int convert_yang2yin(int /*<<< orphan*/ *, int /*<<< orphan*/ *, char const *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ *stdout;
int /*<<< orphan*/ strcmp(char *, char *);
char *strerror(int /*<<< orphan*/);
char *strrchr(char const *, char);
int main(int argc, char **argv) {
  const char *in_file = NULL, *out_file = NULL, *search_dir = ".";
  char *ptr;
  FILE *input = NULL, *output = NULL;
  int ret = 1;
  switch (argc) {
  case 1:
    break;
  case 2:
    if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) {
      fprintf(stdout, "Usage:\n\t%s [input-file] [output-file]\n", argv[0]);
      return 0;
    }
    in_file = argv[1];
    break;
  case 3:
    in_file = argv[1];
    out_file = argv[2];
    break;
  default:
    fprintf(stderr, "Invalid arguments.\n");
    return 1;
  }
  if (in_file) {
    input = fopen(in_file, "r");
    if (!input) {
      fprintf(stderr, "Failed to open \"%s\" for reading (%s).\n", in_file,
              strerror(errno));
      goto cleanup;
    }
    if ((ptr = strrchr(in_file, '/'))) {
      *ptr = '\0';
      search_dir = in_file;
    }
  }
  if (out_file) {
    output = fopen(out_file, "w");
    if (!input) {
      fprintf(stderr, "Failed to open \"%s\" for writing (%s).\n", out_file,
              strerror(errno));
      goto cleanup;
    }
  }
  ret = convert_yang2yin(output ? output : stdout, input ? input : stdin,
                         search_dir);
cleanup:
  if (input) {
    fclose(input);
  }
  if (output) {
    fclose(output);
  }
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
lea    0xe60(%rip),%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
movl   $0x1,-0x44(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x48(%rbp)
sub    $0x1,%eax
je     11f1 <main+0x81>
jmp    11cf <main+0x5f>
mov    -0x48(%rbp),%eax
sub    $0x2,%eax
je     11f6 <main+0x86>
jmp    11e0 <main+0x70>
mov    -0x48(%rbp),%eax
sub    $0x3,%eax
je     126e <main+0xfe>
jmp    128b <main+0x11b>
jmp    12ae <main+0x13e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdfd(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
je     1230 <main+0xc0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xde3(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    125d <main+0xed>
mov    0x2d91(%rip),%rax
mov    (%rax),%rax
mov    %eax,%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdc2(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    144b <main+0x2db>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    12ae <main+0x13e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    12ae <main+0x13e>
mov    0x2d46(%rip),%rax
mov    (%rax),%edi
lea    0xd98(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    144b <main+0x2db>
cmpq   $0x0,-0x18(%rbp)
je     1347 <main+0x1d7>
mov    -0x18(%rbp),%rdi
lea    0xd83(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1317 <main+0x1a7>
mov    0x2cf9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    0x2cdd(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    -0x54(%rbp),%edi
mov    -0x50(%rbp),%rdx
mov    %rax,%rcx
lea    0xd3e(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    141d <main+0x2ad>
mov    -0x18(%rbp),%rdi
mov    $0x2f,%esi
call   1040 <strrchr@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     1342 <main+0x1d2>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    1347 <main+0x1d7>
cmpq   $0x0,-0x20(%rbp)
je     13b5 <main+0x245>
mov    -0x20(%rbp),%rdi
lea    0xd13(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    13b0 <main+0x240>
mov    0x2c60(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    0x2c44(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    -0x64(%rbp),%edi
mov    -0x60(%rbp),%rdx
mov    %rax,%rcx
lea    0xcce(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    141d <main+0x2ad>
jmp    13b5 <main+0x245>
cmpq   $0x0,-0x40(%rbp)
je     13cd <main+0x25d>
mov    -0x40(%rbp),%rax
mov    %rax,-0x70(%rbp)
jmp    13db <main+0x26b>
mov    0x2bf4(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rax
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     13fb <main+0x28b>
mov    -0x38(%rbp),%rax
mov    %rax,-0x80(%rbp)
jmp    1409 <main+0x299>
mov    0x2be6(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x80(%rbp)
mov    -0x78(%rbp),%rdi
mov    -0x80(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1070 <convert_yang2yin@plt>
mov    %eax,-0x44(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     1431 <main+0x2c1>
mov    -0x38(%rbp),%rdi
call   1030 <fclose@plt>
cmpq   $0x0,-0x40(%rbp)
je     1445 <main+0x2d5>
mov    -0x40(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x44(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xe82(%rip),%r14
cmp    $0x1,%edi
je     12c4 <main+0x154>
mov    %rsi,%rbx
cmp    $0x3,%edi
je     11db <main+0x6b>
cmp    $0x2,%edi
jne    1231 <main+0xc1>
mov    0x8(%rbx),%rbp
lea    0xe5f(%rip),%rsi
mov    %rbp,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1252 <main+0xe2>
lea    0xe4b(%rip),%rsi
mov    %rbp,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1252 <main+0xe2>
xor    %r15d,%r15d
test   %rbp,%rbp
je     131f <main+0x1af>
mov    %rbp,%r14
jmp    11ef <main+0x7f>
mov    0x8(%rbx),%rax
mov    0x10(%rbx),%r15
test   %rax,%rax
je     1273 <main+0x103>
mov    %rax,%r14
lea    0xe51(%rip),%rsi
mov    %r14,%rdi
call   1080 <fopen@plt>
test   %rax,%rax
je     12cb <main+0x15b>
mov    %rax,%rbx
mov    %r14,%rdi
mov    $0x2f,%esi
call   1040 <strrchr@plt>
test   %rax,%rax
je     12ff <main+0x18f>
movb   $0x0,(%rax)
test   %r15,%r15
jne    130b <main+0x19b>
jmp    12c6 <main+0x156>
mov    0x2da0(%rip),%rax
mov    (%rax),%edi
lea    0xdf2(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%ebp
jmp    1369 <main+0x1f9>
mov    0x2d6f(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xda7(%rip),%rsi
xor    %ebp,%ebp
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    1369 <main+0x1f9>
test   %r15,%r15
je     12c4 <main+0x154>
lea    0xdf1(%rip),%rsi
mov    %r15,%rdi
call   1080 <fopen@plt>
mov    %rax,%rbx
mov    0x2d47(%rip),%rax
mov    (%rax),%ebp
mov    0x2d36(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
lea    0xdca(%rip),%rsi
mov    %ebp,%edi
mov    %r15,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%ebp
mov    %rbx,%r15
jmp    135c <main+0x1ec>
xor    %ebx,%ebx
xor    %r15d,%r15d
jmp    1321 <main+0x1b1>
mov    0x2d06(%rip),%rax
mov    (%rax),%ebx
mov    0x2cf5(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
lea    0xd60(%rip),%rsi
mov    %ebx,%edi
mov    %r14,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%ebp
jmp    1369 <main+0x1f9>
lea    0xcfa(%rip),%r14
test   %r15,%r15
je     12c6 <main+0x156>
lea    0xd5e(%rip),%rsi
mov    %r15,%rdi
call   1080 <fopen@plt>
mov    %rax,%r15
jmp    1321 <main+0x1b1>
xor    %ebx,%ebx
mov    %r15,%rdi
test   %r15,%r15
jne    1333 <main+0x1c3>
mov    0x2c98(%rip),%rax
mov    (%rax),%rdi
mov    %rbx,%rsi
test   %rbx,%rbx
jne    1345 <main+0x1d5>
mov    0x2ca6(%rip),%rax
mov    (%rax),%rsi
mov    %r14,%rdx
call   1070 <convert_yang2yin@plt>
mov    %eax,%ebp
test   %rbx,%rbx
je     135c <main+0x1ec>
mov    %rbx,%rdi
call   1030 <fclose@plt>
test   %r15,%r15
je     1369 <main+0x1f9>
mov    %r15,%rdi
call   1030 <fclose@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c".\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [7 x i8] c"--help\00"
@stdout = global i32* null
@.str.3 = [39 x i8] c"Usage:\0A\09%s [input-file] [output-file]\0A\00"
@stderr = global i32 0
@.str.4 = [20 x i8] c"Invalid arguments.\0A\00"
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [39 x i8] c"Failed to open \22%s\22 for reading (%s).\0A\00"
@errno = global i32 0
@.str.7 = [2 x i8] c"w\00"
@.str.8 = [39 x i8] c"Failed to open \22%s\22 for writing (%s).\0A\00"
@stdin = global i32* null
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 i8*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i8* null, i8** %7
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %8
store i32* null, i32** %10
store i32* null, i32** %11
store i32 1, i32* %12
%13 = load i32, i32* %4
switch i32 %13, label %45 [
i32 1, label %14
i32 2, label %15
i32 3, label %38
]
14: ; preds = %2
br label %48
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @strcmp(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %27
21: ; preds = %15
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @strcmp(i8* %24, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%26 = icmp ne i32 %25, 0
br i1 %26, label %34, label %27
27: ; preds = %21, %15
%28 = load i32*, i32** @stdout
%29 = ptrtoint i32* %28 to i32
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 0
%32 = load i8*, i8** %31
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i8* %32)
store i32 0, i32* %3
br label %118
34: ; preds = %21
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
store i8* %37, i8** %6
br label %48
38: ; preds = %2
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 1
%41 = load i8*, i8** %40
store i8* %41, i8** %6
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 2
%44 = load i8*, i8** %43
store i8* %44, i8** %7
br label %48
45: ; preds = %2
%46 = load i32, i32* @stderr
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %118
48: ; preds = %38, %34, %14
%49 = load i8*, i8** %6
%50 = icmp ne i8* %49, null
br i1 %50, label %51, label %70
51: ; preds = %48
%52 = load i8*, i8** %6
%53 = call i32* @fopen(i8* %52, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %53, i32** %10
%54 = load i32*, i32** %10
%55 = icmp ne i32* %54, null
br i1 %55, label %62, label %56
56: ; preds = %51
%57 = load i32, i32* @stderr
%58 = load i8*, i8** %6
%59 = load i32, i32* @errno
%60 = call i8* @strerror(i32 %59)
%61 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0), i8* %58, i8* %60)
br label %104
62: ; preds = %51
%63 = load i8*, i8** %6
%64 = call i8* @strrchr(i8* %63, i8 signext 47)
store i8* %64, i8** %9
%65 = icmp ne i8* %64, null
br i1 %65, label %66, label %69
66: ; preds = %62
%67 = load i8*, i8** %9
store i8 0, i8* %67
%68 = load i8*, i8** %6
store i8* %68, i8** %8
br label %69
69: ; preds = %66, %62
br label %70
70: ; preds = %69, %48
%71 = load i8*, i8** %7
%72 = icmp ne i8* %71, null
br i1 %72, label %73, label %85
73: ; preds = %70
%74 = load i8*, i8** %7
%75 = call i32* @fopen(i8* %74, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32* %75, i32** %11
%76 = load i32*, i32** %10
%77 = icmp ne i32* %76, null
br i1 %77, label %84, label %78
78: ; preds = %73
%79 = load i32, i32* @stderr
%80 = load i8*, i8** %7
%81 = load i32, i32* @errno
%82 = call i8* @strerror(i32 %81)
%83 = call i32 (i32, i8*, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0), i8* %80, i8* %82)
br label %104
84: ; preds = %73
br label %85
85: ; preds = %84, %70
%86 = load i32*, i32** %11
%87 = icmp ne i32* %86, null
br i1 %87, label %88, label %90
88: ; preds = %85
%89 = load i32*, i32** %11
br label %92
90: ; preds = %85
%91 = load i32*, i32** @stdout
br label %92
92: ; preds = %90, %88
%93 = phi i32* [ %89, %88 ], [ %91, %90 ]
%94 = load i32*, i32** %10
%95 = icmp ne i32* %94, null
br i1 %95, label %96, label %98
96: ; preds = %92
%97 = load i32*, i32** %10
br label %100
98: ; preds = %92
%99 = load i32*, i32** @stdin
br label %100
100: ; preds = %98, %96
%101 = phi i32* [ %97, %96 ], [ %99, %98 ]
%102 = load i8*, i8** %8
%103 = call i32 @convert_yang2yin(i32* %93, i32* %101, i8* %102)
store i32 %103, i32* %12
br label %104
104: ; preds = %100, %78, %56
%105 = load i32*, i32** %10
%106 = icmp ne i32* %105, null
br i1 %106, label %107, label %110
107: ; preds = %104
%108 = load i32*, i32** %10
%109 = call i32 @fclose(i32* %108)
br label %110
110: ; preds = %107, %104
%111 = load i32*, i32** %11
%112 = icmp ne i32* %111, null
br i1 %112, label %113, label %116
113: ; preds = %110
%114 = load i32*, i32** %11
%115 = call i32 @fclose(i32* %114)
br label %116
116: ; preds = %113, %110
%117 = load i32, i32* %12
store i32 %117, i32* %3
br label %118
118: ; preds = %116, %45, %27
%119 = load i32, i32* %3
ret i32 %119
}

LLVM IR (-O2):
@.str = [2 x i8] c".\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [7 x i8] c"--help\00"
@stdout = global i32* null
@.str.3 = [39 x i8] c"Usage:\0A\09%s [input-file] [output-file]\0A\00"
@stderr = global i32 0
@.str.4 = [20 x i8] c"Invalid arguments.\0A\00"
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [39 x i8] c"Failed to open \22%s\22 for reading (%s).\0A\00"
@errno = global i32 0
@.str.7 = [2 x i8] c"w\00"
@.str.8 = [39 x i8] c"Failed to open \22%s\22 for writing (%s).\0A\00"
@stdin = global i32* null
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %17 [
i32 1, label %55
i32 2, label %3
i32 3, label %20
]
3: ; preds = %2
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 @strcmp(i8* dereferenceable(1) %5, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %5, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %26
11: ; preds = %8, %3
%12 = load i32*, i32** @stdout
%13 = ptrtoint i32* %12 to i64
%14 = trunc i64 %13 to i32
%15 = load i8*, i8** %1
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i8* %15)
br label %74
17: ; preds = %2
%18 = load i32, i32* @stderr
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %74
20: ; preds = %2
%21 = getelementptr inbounds i8*, i8** %1, i64 1
%22 = load i8*, i8** %21
%23 = getelementptr inbounds i8*, i8** %1, i64 2
%24 = load i8*, i8** %23
%25 = icmp eq i8* %22, null
br i1 %25, label %45, label %28
26: ; preds = %8
%27 = icmp eq i8* %5, null
br i1 %27, label %55, label %28
28: ; preds = %26, %20
%29 = phi i8* [ null, %26 ], [ %24, %20 ]
%30 = phi i8* [ %5, %26 ], [ %22, %20 ]
%31 = tail call i32* @fopen(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%32 = icmp eq i32* %31, null
br i1 %32, label %33, label %38
33: ; preds = %28
%34 = load i32, i32* @stderr
%35 = load i32, i32* @errno
%36 = tail call i8* @strerror(i32 %35)
%37 = tail call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0), i8* %30, i8* %36)
br label %74
38: ; preds = %28
%39 = tail call i8* @strrchr(i8* %30, i8 signext 47)
%40 = icmp eq i8* %39, null
br i1 %40, label %42, label %41
41: ; preds = %38
store i8 0, i8* %39
br label %42
42: ; preds = %38, %41
%43 = phi i8* [ %30, %41 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %38 ]
%44 = icmp eq i8* %29, null
br i1 %44, label %55, label %47
45: ; preds = %20
%46 = icmp eq i8* %24, null
br i1 %46, label %55, label %49
47: ; preds = %42
%48 = tail call i32* @fopen(i8* %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %55
49: ; preds = %45
%50 = tail call i32* @fopen(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%51 = load i32, i32* @stderr
%52 = load i32, i32* @errno
%53 = tail call i8* @strerror(i32 %52)
%54 = tail call i32 (i32, i8*, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0), i8* %24, i8* %53)
br label %68
55: ; preds = %26, %2, %42, %45, %47
%56 = phi i32* [ %31, %47 ], [ %31, %42 ], [ null, %45 ], [ null, %2 ], [ null, %26 ]
%57 = phi i8* [ %43, %47 ], [ %43, %42 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %45 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %2 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %26 ]
%58 = phi i32* [ %48, %47 ], [ null, %42 ], [ null, %45 ], [ null, %2 ], [ null, %26 ]
%59 = icmp eq i32* %58, null
%60 = load i32*, i32** @stdout
%61 = select i1 %59, i32* %60, i32* %58
%62 = icmp eq i32* %56, null
%63 = load i32*, i32** @stdin
%64 = select i1 %62, i32* %63, i32* %56
%65 = tail call i32 @convert_yang2yin(i32* %61, i32* %64, i8* %57)
br i1 %62, label %68, label %66
66: ; preds = %55
%67 = tail call i32 @fclose(i32* %56)
br label %68
68: ; preds = %49, %66, %55
%69 = phi i32 [ %65, %66 ], [ %65, %55 ], [ 1, %49 ]
%70 = phi i32* [ %58, %66 ], [ %58, %55 ], [ %50, %49 ]
%71 = icmp eq i32* %70, null
br i1 %71, label %74, label %72
72: ; preds = %68
%73 = tail call i32 @fclose(i32* %70)
br label %74
74: ; preds = %33, %68, %72, %17, %11
%75 = phi i32 [ 1, %17 ], [ 0, %11 ], [ %69, %72 ], [ %69, %68 ], [ 1, %33 ]
ret i32 %75
}