#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 *);
void clear_files(void) {
  FILE *fin = fopen("variables.txt", "w");
  fclose(fin);
  FILE *fin2 = fopen("8086.txt", "w");
  fclose(fin2);
  FILE *fin3 = fopen("output.txt", "w");
  fclose(fin3);
}


x86 assembly (clang, -O0):
<clear_files>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rdi
lea    0xed8(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xec1(%rip),%rdi
lea    0xeb8(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xeaa(%rip),%rdi
lea    0xe98(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_files>:
push   %rbx
lea    0xed8(%rip),%rdi
lea    0xedf(%rip),%rbx
mov    %rbx,%rsi
call   1040 <fopen@plt>
mov    %rax,%rdi
call   1030 <fclose@plt>
lea    0xeca(%rip),%rdi
mov    %rbx,%rsi
call   1040 <fopen@plt>
mov    %rax,%rdi
call   1030 <fclose@plt>
lea    0xebc(%rip),%rdi
mov    %rbx,%rsi
call   1040 <fopen@plt>
mov    %rax,%rdi
pop    %rbx
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"variables.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [9 x i8] c"8086.txt\00"
@.str.3 = [11 x i8] c"output.txt\00"
define void @clear_files() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32*
%4 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %1
%5 = load i32*, i32** %1
%6 = call i32 @fclose(i32* %5)
%7 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %2
%8 = load i32*, i32** %2
%9 = call i32 @fclose(i32* %8)
%10 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %10, i32** %3
%11 = load i32*, i32** %3
%12 = call i32 @fclose(i32* %11)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"variables.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [9 x i8] c"8086.txt\00"
@.str.3 = [11 x i8] c"output.txt\00"
define void @clear_files() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @fclose(i32* %1)
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @fclose(i32* %3)
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @fclose(i32* %5)
ret void
}