#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*/ perror(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, int /*<<< orphan*/, char *);
FILE *outputConfCreate(void) {
  char filename[20];
  FILE *fp, *fopen();
  sprintf(filename, "%s%d%s", "output_", 0, ".conf");
  if ((fp = fopen(filename, "w")) == NULL)
    perror(filename);
  return fp;
}


x86 assembly (clang, -O0):
<outputConfCreate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x20(%rbp),%rdi
lea    0xebd(%rip),%rsi
lea    0xebd(%rip),%rdx
xor    %ecx,%ecx
lea    0xebc(%rip),%r8
call   1050 <sprintf@plt>
lea    -0x20(%rbp),%rdi
lea    0xeb2(%rip),%rsi
call   1030 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    117f <outputConfCreate+0x4f>
lea    -0x20(%rbp),%rdi
call   1040 <perror@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outputConfCreate>:
push   %rbx
sub    $0x20,%rsp
lea    0xec4(%rip),%rsi
lea    0xec4(%rip),%rdx
lea    0xec5(%rip),%r8
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %ecx,%ecx
call   1050 <sprintf@plt>
lea    0xeb7(%rip),%rsi
mov    %rbx,%rdi
call   1030 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1177 <outputConfCreate+0x47>
mov    %rbx,%rax
add    $0x20,%rsp
pop    %rbx
ret
mov    %rsp,%rdi
call   1040 <perror@plt>
jmp    116e <outputConfCreate+0x3e>

LLVM IR (-O0):
@.str = [7 x i8] c"%s%d%s\00"
@.str.1 = [8 x i8] c"output_\00"
@.str.2 = [6 x i8] c".conf\00"
@.str.3 = [2 x i8] c"w\00"
define i32* @outputConfCreate() {
%1 = alloca [20 x i8]
%2 = alloca i32*
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %6, i32** %2
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%10 = call i32 @perror(i8* %9)
br label %11
11: ; preds = %8, %0
%12 = load i32*, i32** %2
ret i32* %12
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s%d%s\00"
@.str.1 = [8 x i8] c"output_\00"
@.str.2 = [6 x i8] c".conf\00"
@.str.3 = [2 x i8] c"w\00"
define noalias i32* @outputConfCreate() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32* @fopen(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @perror(i8* %2)
br label %8
8: ; preds = %6, %0
ret i32* %4
}