#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*/ DumpAscii(int /*<<< orphan*/ *);
int /*<<< orphan*/ DumpRange(int /*<<< orphan*/ *, unsigned short);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ perror(char *);
void DumpGB2312(void) {
  unsigned short i = 0;
  FILE *fp = fopen("gb.txt", "wb+");
  if (fp != NULL) {
    DumpAscii(fp);
    for (i = 1; i <= 9; i++)
      DumpRange(fp, i);
    for (i = 16; i <= 55; i++)
      DumpRange(fp, i);
    for (i = 56; i <= 87; i++)
      DumpRange(fp, i);
    fclose(fp);
  } else {
    perror("fopen");
  }
  return;
}


x86 assembly (clang, -O0):
<DumpGB2312>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movw   $0x0,-0x2(%rbp)
lea    0xe9b(%rip),%rdi
lea    0xe9b(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     122a <DumpGB2312+0xda>
mov    -0x10(%rbp),%rdi
call   1070 <DumpAscii@plt>
movw   $0x1,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
cmp    $0x9,%eax
jg     11ba <DumpGB2312+0x6a>
mov    -0x10(%rbp),%rdi
movzwl -0x2(%rbp),%esi
call   1040 <DumpRange@plt>
mov    -0x2(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x2(%rbp)
jmp    118f <DumpGB2312+0x3f>
movw   $0x10,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
cmp    $0x37,%eax
jg     11eb <DumpGB2312+0x9b>
mov    -0x10(%rbp),%rdi
movzwl -0x2(%rbp),%esi
call   1040 <DumpRange@plt>
mov    -0x2(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x2(%rbp)
jmp    11c0 <DumpGB2312+0x70>
movw   $0x38,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
cmp    $0x57,%eax
jg     121c <DumpGB2312+0xcc>
mov    -0x10(%rbp),%rdi
movzwl -0x2(%rbp),%esi
call   1040 <DumpRange@plt>
mov    -0x2(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x2(%rbp)
jmp    11f1 <DumpGB2312+0xa1>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
jmp    1236 <DumpGB2312+0xe6>
lea    0xdda(%rip),%rdi
call   1060 <perror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DumpGB2312>:
push   %rbp
push   %rbx
push   %rax
lea    0xea6(%rip),%rdi
lea    0xea6(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     13c4 <DumpGB2312+0x274>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <DumpAscii@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1040 <DumpRange@plt>
mov    $0x10,%bp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzwl %bp,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
call   1040 <DumpRange@plt>
add    $0x1,%ebp
cmp    $0x38,%bp
jne    1200 <DumpGB2312+0xb0>
mov    %rbx,%rdi
mov    $0x38,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x39,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x3a,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x3b,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x3c,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x3d,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x3e,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x3f,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x40,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x41,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x42,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x43,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x44,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x45,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x46,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x47,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x48,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x49,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x4a,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x4b,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x4c,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x4d,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x4e,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x4f,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x50,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x51,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x52,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x53,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x54,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x55,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x56,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
mov    $0x57,%esi
call   1040 <DumpRange@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fclose@plt>
lea    0xc40(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <perror@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"gb.txt\00"
@.str.1 = [4 x i8] c"wb+\00"
@.str.2 = [6 x i8] c"fopen\00"
define void @DumpGB2312() {
%1 = alloca i16
%2 = alloca i32*
store i16 0, i16* %1
%3 = call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %2
%4 = load i32*, i32** %2
%5 = icmp ne i32* %4, null
br i1 %5, label %6, label %47
6: ; preds = %0
%7 = load i32*, i32** %2
%8 = call i32 @DumpAscii(i32* %7)
store i16 1, i16* %1
br label %9
9: ; preds = %17, %6
%10 = load i16, i16* %1
%11 = zext i16 %10 to i32
%12 = icmp sle i32 %11, 9
br i1 %12, label %13, label %20
13: ; preds = %9
%14 = load i32*, i32** %2
%15 = load i16, i16* %1
%16 = call i32 @DumpRange(i32* %14, i16 zeroext %15)
br label %17
17: ; preds = %13
%18 = load i16, i16* %1
%19 = add i16 %18, 1
store i16 %19, i16* %1
br label %9
20: ; preds = %9
store i16 16, i16* %1
br label %21
21: ; preds = %29, %20
%22 = load i16, i16* %1
%23 = zext i16 %22 to i32
%24 = icmp sle i32 %23, 55
br i1 %24, label %25, label %32
25: ; preds = %21
%26 = load i32*, i32** %2
%27 = load i16, i16* %1
%28 = call i32 @DumpRange(i32* %26, i16 zeroext %27)
br label %29
29: ; preds = %25
%30 = load i16, i16* %1
%31 = add i16 %30, 1
store i16 %31, i16* %1
br label %21
32: ; preds = %21
store i16 56, i16* %1
br label %33
33: ; preds = %41, %32
%34 = load i16, i16* %1
%35 = zext i16 %34 to i32
%36 = icmp sle i32 %35, 87
br i1 %36, label %37, label %44
37: ; preds = %33
%38 = load i32*, i32** %2
%39 = load i16, i16* %1
%40 = call i32 @DumpRange(i32* %38, i16 zeroext %39)
br label %41
41: ; preds = %37
%42 = load i16, i16* %1
%43 = add i16 %42, 1
store i16 %43, i16* %1
br label %33
44: ; preds = %33
%45 = load i32*, i32** %2
%46 = call i32 @fclose(i32* %45)
br label %49
47: ; preds = %0
%48 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %49
49: ; preds = %47, %44
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"gb.txt\00"
@.str.1 = [4 x i8] c"wb+\00"
@.str.2 = [6 x i8] c"fopen\00"
define void @DumpGB2312() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %53, label %3
3: ; preds = %0
%4 = tail call i32 @DumpAscii(i32* %1)
%5 = tail call i32 @DumpRange(i32* %1, i16 zeroext 1)
%6 = tail call i32 @DumpRange(i32* %1, i16 zeroext 2)
%7 = tail call i32 @DumpRange(i32* %1, i16 zeroext 3)
%8 = tail call i32 @DumpRange(i32* %1, i16 zeroext 4)
%9 = tail call i32 @DumpRange(i32* %1, i16 zeroext 5)
%10 = tail call i32 @DumpRange(i32* %1, i16 zeroext 6)
%11 = tail call i32 @DumpRange(i32* %1, i16 zeroext 7)
%12 = tail call i32 @DumpRange(i32* %1, i16 zeroext 8)
%13 = tail call i32 @DumpRange(i32* %1, i16 zeroext 9)
br label %14
14: ; preds = %3, %14
%15 = phi i16 [ %17, %14 ], [ 16, %3 ]
%16 = tail call i32 @DumpRange(i32* %1, i16 zeroext %15)
%17 = add nuw nsw i16 %15, 1
%18 = icmp eq i16 %17, 56
br i1 %18, label %19, label %14
19: ; preds = %14
%20 = tail call i32 @DumpRange(i32* %1, i16 zeroext 56)
%21 = tail call i32 @DumpRange(i32* %1, i16 zeroext 57)
%22 = tail call i32 @DumpRange(i32* %1, i16 zeroext 58)
%23 = tail call i32 @DumpRange(i32* %1, i16 zeroext 59)
%24 = tail call i32 @DumpRange(i32* %1, i16 zeroext 60)
%25 = tail call i32 @DumpRange(i32* %1, i16 zeroext 61)
%26 = tail call i32 @DumpRange(i32* %1, i16 zeroext 62)
%27 = tail call i32 @DumpRange(i32* %1, i16 zeroext 63)
%28 = tail call i32 @DumpRange(i32* %1, i16 zeroext 64)
%29 = tail call i32 @DumpRange(i32* %1, i16 zeroext 65)
%30 = tail call i32 @DumpRange(i32* %1, i16 zeroext 66)
%31 = tail call i32 @DumpRange(i32* %1, i16 zeroext 67)
%32 = tail call i32 @DumpRange(i32* %1, i16 zeroext 68)
%33 = tail call i32 @DumpRange(i32* %1, i16 zeroext 69)
%34 = tail call i32 @DumpRange(i32* %1, i16 zeroext 70)
%35 = tail call i32 @DumpRange(i32* %1, i16 zeroext 71)
%36 = tail call i32 @DumpRange(i32* %1, i16 zeroext 72)
%37 = tail call i32 @DumpRange(i32* %1, i16 zeroext 73)
%38 = tail call i32 @DumpRange(i32* %1, i16 zeroext 74)
%39 = tail call i32 @DumpRange(i32* %1, i16 zeroext 75)
%40 = tail call i32 @DumpRange(i32* %1, i16 zeroext 76)
%41 = tail call i32 @DumpRange(i32* %1, i16 zeroext 77)
%42 = tail call i32 @DumpRange(i32* %1, i16 zeroext 78)
%43 = tail call i32 @DumpRange(i32* %1, i16 zeroext 79)
%44 = tail call i32 @DumpRange(i32* %1, i16 zeroext 80)
%45 = tail call i32 @DumpRange(i32* %1, i16 zeroext 81)
%46 = tail call i32 @DumpRange(i32* %1, i16 zeroext 82)
%47 = tail call i32 @DumpRange(i32* %1, i16 zeroext 83)
%48 = tail call i32 @DumpRange(i32* %1, i16 zeroext 84)
%49 = tail call i32 @DumpRange(i32* %1, i16 zeroext 85)
%50 = tail call i32 @DumpRange(i32* %1, i16 zeroext 86)
%51 = tail call i32 @DumpRange(i32* %1, i16 zeroext 87)
%52 = tail call i32 @fclose(i32* %1)
br label %55
53: ; preds = %0
%54 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %55
55: ; preds = %53, %19
ret void
}