#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 /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ gen_ascii(int /*<<< orphan*/ *);
int /*<<< orphan*/ gen_cjk(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  FILE *fp = fopen("ascii.txt", "wb+");
  if (fp != NULL) {
    gen_ascii(fp);
    fclose(fp);
  }
  fp = fopen("unicode.txt", "wb+");
  if (fp != NULL) {
    gen_ascii(fp);
    gen_cjk(fp);
    fclose(fp);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
lea    0xea6(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     118a <main+0x4a>
mov    -0x18(%rbp),%rdi
call   1030 <gen_ascii@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xe7d(%rip),%rdi
lea    0xe72(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11c7 <main+0x87>
mov    -0x18(%rbp),%rdi
call   1030 <gen_ascii@plt>
mov    -0x18(%rbp),%rdi
call   1050 <gen_cjk@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xeb8(%rip),%rdi
lea    0xebb(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     116c <main+0x2c>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <gen_ascii@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xe9b(%rip),%rdi
lea    0xe90(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     119f <main+0x5f>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <gen_ascii@plt>
mov    %rbx,%rdi
call   1050 <gen_cjk@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"ascii.txt\00"
@.str.1 = [4 x i8] c"wb+\00"
@.str.2 = [12 x i8] c"unicode.txt\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %6
%8 = load i32*, i32** %6
%9 = icmp ne i32* %8, null
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i32*, i32** %6
%12 = call i32 @gen_ascii(i32* %11)
%13 = load i32*, i32** %6
%14 = call i32 @fclose(i32* %13)
br label %15
15: ; preds = %10, %2
%16 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32* %16, i32** %6
%17 = load i32*, i32** %6
%18 = icmp ne i32* %17, null
br i1 %18, label %19, label %26
19: ; preds = %15
%20 = load i32*, i32** %6
%21 = call i32 @gen_ascii(i32* %20)
%22 = load i32*, i32** %6
%23 = call i32 @gen_cjk(i32* %22)
%24 = load i32*, i32** %6
%25 = call i32 @fclose(i32* %24)
br label %26
26: ; preds = %19, %15
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"ascii.txt\00"
@.str.1 = [4 x i8] c"wb+\00"
@.str.2 = [12 x i8] c"unicode.txt\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @gen_ascii(i32* %3)
%7 = tail call i32 @fclose(i32* %3)
br label %8
8: ; preds = %5, %2
%9 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i32* %9, null
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = tail call i32 @gen_ascii(i32* %9)
%13 = tail call i32 @gen_cjk(i32* %9)
%14 = tail call i32 @fclose(i32* %9)
br label %15
15: ; preds = %11, %8
ret i32 0
}