#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*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, int, char *);
FILE *openOutput(int page, char *author) {
  char fileoutName[100 + 1] = "";
  FILE *fp;
  sprintf(fileoutName, "%3.3d-%s.tmp_single_comment", page, author);
  fp = fopen(fileoutName, "a");
  fprintf(fp, "----------------------------------------");
  fprintf(fp, "----------------------------------------\n");
  fprintf(fp, "(%s)\n", author);
  fflush(fp);
  return fp;
}


x86 assembly (clang, -O0):
<openOutput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x65,%edx
call   1030 <memset@plt>
lea    -0x80(%rbp),%rdi
mov    -0x4(%rbp),%edx
mov    -0x10(%rbp),%rcx
lea    0xe7c(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x80(%rbp),%rdi
lea    0xe88(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rdi
lea    0xe70(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x88(%rbp),%rdi
lea    0xe84(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x88(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe95(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x88(%rbp),%rdi
call   1050 <fflush@plt>
mov    -0x88(%rbp),%rax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<openOutput>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%r14
mov    %edi,%edx
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x5d(%rsp)
lea    0xe74(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rcx
call   1060 <sprintf@plt>
lea    0xe7b(%rip),%rsi
mov    %rbx,%rdi
call   1050 <fopen@plt>
mov    %rax,%rbx
lea    0xe6b(%rip),%rdi
mov    $0x28,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1070 <fwrite@plt>
lea    0xe7b(%rip),%rdi
mov    $0x29,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1070 <fwrite@plt>
lea    0xe8c(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <fflush@plt>
mov    %rbx,%rax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [28 x i8] c"%3.3d-%s.tmp_single_comment\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [41 x i8] c"----------------------------------------\00"
@.str.3 = [42 x i8] c"----------------------------------------\0A\00"
@.str.4 = [6 x i8] c"(%s)\0A\00"
define i32* @openOutput(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [101 x i8]
%6 = alloca i32*
store i32 %0, i32* %3
store i8* %1, i8** %4
%7 = bitcast [101 x i8]* %5 to i8*
%8 = getelementptr inbounds [101 x i8], [101 x i8]* %5, i64 0, i64 0
%9 = load i32, i32* %3
%10 = load i8*, i8** %4
%11 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %9, i8* %10)
%12 = getelementptr inbounds [101 x i8], [101 x i8]* %5, i64 0, i64 0
%13 = call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %13, i32** %6
%14 = load i32*, i32** %6
%15 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%16 = load i32*, i32** %6
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
%18 = load i32*, i32** %6
%19 = load i8*, i8** %4
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %19)
%21 = load i32*, i32** %6
%22 = call i32 @fflush(i32* %21)
%23 = load i32*, i32** %6
ret i32* %23
}

LLVM IR (-O2):
@.str = [28 x i8] c"%3.3d-%s.tmp_single_comment\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [41 x i8] c"----------------------------------------\00"
@.str.3 = [42 x i8] c"----------------------------------------\0A\00"
@.str.4 = [6 x i8] c"(%s)\0A\00"
define noalias i32* @openOutput(i32 %0, i8* %1) {
%3 = alloca [101 x i8]
%4 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %1)
%6 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i64 40, i64 1, i32* %6)
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i64 41, i64 1, i32* %6)
%9 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %1)
%10 = tail call i32 @fflush(i32* %6)
ret i32* %6
}