#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*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ system(char *);
int main02(void) {
  FILE *fp = NULL;
  char *p = "1234353454364"
            "lgkjfdljhlkfdjhlfdjk";
  printf("%s\n", p);
  fp = fopen("./03.txt", "r+");
  if (fp == NULL) {
    perror("fopen");
    system("pause");
    return -1;
  }
  if (fp != NULL) {
    fclose(fp);
    fp = NULL;
  }
  printf("\n");
  system("pause");
  return 0;
}


x86 assembly (clang, -O0):
<main02>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x0,-0x10(%rbp)
lea    0xe99(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xea2(%rip),%rdi
lea    0xea4(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11c3 <main02+0x73>
lea    0xe8c(%rip),%rdi
call   1070 <perror@plt>
lea    0xe86(%rip),%rdi
call   1040 <system@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1200 <main02+0xb0>
cmpq   $0x0,-0x10(%rbp)
je     11df <main02+0x8f>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
movq   $0x0,-0x10(%rbp)
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe44(%rip),%rdi
call   1040 <system@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main02>:
push   %rbx
lea    0xe98(%rip),%rdi
call   1040 <puts@plt>
lea    0xeae(%rip),%rdi
lea    0xeb0(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     11a9 <main02+0x49>
mov    %rax,%rdi
call   1050 <fclose@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %ebx,%ebx
lea    0xe94(%rip),%rdi
call   1060 <system@plt>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xe7e(%rip),%rdi
call   1080 <perror@plt>
mov    $0xffffffff,%ebx
jmp    1199 <main02+0x39>

LLVM IR (-O0):
@.str = [34 x i8] c"1234353454364lgkjfdljhlkfdjhlfdjk\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [9 x i8] c"./03.txt\00"
@.str.3 = [3 x i8] c"r+\00"
@.str.4 = [6 x i8] c"fopen\00"
@.str.5 = [6 x i8] c"pause\00"
@.str.6 = [2 x i8] c"\0A\00"
define i32 @main02() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i8*
store i32* null, i32** %2
store i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %3
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %6, i32** %2
%7 = load i32*, i32** %2
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %1
br label %21
12: ; preds = %0
%13 = load i32*, i32** %2
%14 = icmp ne i32* %13, null
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32*, i32** %2
%17 = call i32 @fclose(i32* %16)
store i32* null, i32** %2
br label %18
18: ; preds = %15, %12
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%20 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %1
br label %21
21: ; preds = %18, %9
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@.str = [34 x i8] c"1234353454364lgkjfdljhlkfdjhlfdjk\00"
@.str.2 = [9 x i8] c"./03.txt\00"
@.str.3 = [3 x i8] c"r+\00"
@.str.4 = [6 x i8] c"fopen\00"
@.str.5 = [6 x i8] c"pause\00"
define i32 @main02() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %9
6: ; preds = %0
%7 = tail call i32 @fclose(i32* %2)
%8 = tail call i32 @putchar(i32 10)
br label %9
9: ; preds = %6, %4
%10 = phi i32 [ -1, %4 ], [ 0, %6 ]
%11 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret i32 %10
}