#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*/ fputc(char, int /*<<< orphan*/ *);
main() {
  FILE *fp1, *fp2;
  fp1 = fopen("one", "w");
  fp2 = fopen("one", "w");
  fputc('A', fp1);
  fputc('B', fp2);
  fclose(fp1);
  fclose(fp2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xebe(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x8(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xea7(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x41,%edi
call   1040 <fputc@plt>
mov    -0x10(%rbp),%rsi
mov    $0x42,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xec1(%rip),%r15
lea    0xebe(%rip),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <fopen@plt>
mov    %rax,%r12
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    $0x41,%edi
mov    %r12,%rsi
call   1040 <fputc@plt>
mov    $0x42,%edi
mov    %rbx,%rsi
call   1040 <fputc@plt>
mov    %r12,%rdi
call   1030 <fclose@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"one\00"
@.str.1 = [2 x i8] c"w\00"
define i32 @main() {
%1 = alloca i32*
%2 = alloca i32*
%3 = call i32* @fopen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %1
%4 = call i32* @fopen(i8* getelementptr inbounds ([4 x i8], [4 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** %2
%5 = load i32*, i32** %1
%6 = call i32 @fputc(i8 signext 65, i32* %5)
%7 = load i32*, i32** %2
%8 = call i32 @fputc(i8 signext 66, i32* %7)
%9 = load i32*, i32** %1
%10 = call i32 @fclose(i32* %9)
%11 = load i32*, i32** %2
%12 = call i32 @fclose(i32* %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"one\00"
@.str.1 = [2 x i8] c"w\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([4 x i8], [4 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* @fopen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @fputc(i8 signext 65, i32* %1)
%4 = tail call i32 @fputc(i8 signext 66, i32* %2)
%5 = tail call i32 @fclose(i32* %1)
%6 = tail call i32 @fclose(i32* %2)
ret i32 0
}