#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 pid_t;

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ errno;
int /*<<< orphan*/ execvp(char *, char **);
int fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int create_file(char *func_name, int NbVal) {
  pid_t myproc;
  if ((myproc = fork()) != 0)
    return myproc;
  else {
    char *arglist[] = {func_name, NULL};
    execvp(arglist[0], arglist);
    fprintf(stderr, "ERROR %s\n", strerror(errno));
    abort();
  }
}


x86 assembly (clang, -O0):
<create_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1070 <fork@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
je     117b <create_file+0x2b>
mov    -0x10(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <execvp@plt>
mov    0x2e41(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    -0x24(%rbp),%edi
mov    %rax,%rdx
lea    0xe41(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<create_file>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
xor    %eax,%eax
call   1070 <fork@plt>
test   %eax,%eax
je     1169 <create_file+0x19>
add    $0x10,%rsp
pop    %rbx
ret
mov    %rbx,(%rsp)
movq   $0x0,0x8(%rsp)
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <execvp@plt>
mov    0x2e58(%rip),%rax
mov    (%rax),%ebx
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
lea    0xe61(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [10 x i8] c"ERROR %s\0A\00"
@errno = global i32 0
define i32 @create_file(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca [2 x i8*]
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = call i32 (...) @fork()
store i32 %7, i32* %5
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i32, i32* %5
ret i32 %10
11: ; preds = %2
%12 = getelementptr inbounds [2 x i8*], [2 x i8*]* %6, i64 0, i64 0
%13 = load i8*, i8** %3
store i8* %13, i8** %12
%14 = getelementptr inbounds i8*, i8** %12, i64 1
store i8* null, i8** %14
%15 = getelementptr inbounds [2 x i8*], [2 x i8*]* %6, i64 0, i64 0
%16 = load i8*, i8** %15
%17 = getelementptr inbounds [2 x i8*], [2 x i8*]* %6, i64 0, i64 0
%18 = call i32 @execvp(i8* %16, i8** %17)
%19 = load i32, i32* @stderr
%20 = load i32, i32* @errno
%21 = call i8* @strerror(i32 %20)
%22 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %21)
%23 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [10 x i8] c"ERROR %s\0A\00"
@errno = global i32 0
define i32 @create_file(i8* %0, i32 %1) {
%3 = alloca [2 x i8*]
%4 = tail call i32 (...) @fork()
%5 = icmp eq i32 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %2
ret i32 %4
7: ; preds = %2
%8 = bitcast [2 x i8*]* %3 to i8*
%9 = getelementptr inbounds [2 x i8*], [2 x i8*]* %3, i64 0, i64 0
store i8* %0, i8** %9
%10 = getelementptr inbounds [2 x i8*], [2 x i8*]* %3, i64 0, i64 1
store i8* null, i8** %10
%11 = call i32 @execvp(i8* %0, i8** %9)
%12 = load i32, i32* @stderr
%13 = load i32, i32* @errno
%14 = call i8* @strerror(i32 %13)
%15 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = call i32 (...) @abort()
unreachable
}