#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 */

/* Variables and functions */
int /*<<< orphan*/ execl(char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int fork();
int /*<<< orphan*/ waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int pid;
  pid = fork();
  if (pid == 0) {
    if (argc == 1)
      execl("t-abc", "t-abc", NULL);
    else
      execl("t-openclose", "t-openclose", NULL);
    exit(2);
  }
  waitpid(pid, NULL, 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1060 <fork@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11a9 <main+0x69>
cmpl   $0x1,-0x8(%rbp)
jne    118c <main+0x4c>
lea    0xe85(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    %rsi,%rdi
call   1050 <execl@plt>
jmp    119f <main+0x5f>
lea    0xe73(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    %rsi,%rdi
call   1050 <execl@plt>
mov    $0x2,%edi
call   1040 <exit@plt>
mov    -0x14(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1030 <waitpid@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1060 <fork@plt>
test   %eax,%eax
je     115d <main+0x1d>
mov    %eax,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <waitpid@plt>
xor    %eax,%eax
pop    %rbx
ret
cmp    $0x1,%ebx
lea    0xe99(%rip),%rax
lea    0xe98(%rip),%rdi
cmove  %rax,%rdi
mov    %rdi,%rsi
xor    %edx,%edx
call   1050 <execl@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"t-abc\00"
@.str.1 = [12 x i8] c"t-openclose\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (...) @fork()
store i32 %7, i32* %6
%8 = load i32, i32* %6
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %19
10: ; preds = %2
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 @execl(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* null)
br label %17
15: ; preds = %10
%16 = call i32 @execl(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* null)
br label %17
17: ; preds = %15, %13
%18 = call i32 @exit(i32 2)
unreachable
19: ; preds = %2
%20 = load i32, i32* %6
%21 = call i32 @waitpid(i32 %20, i32* null, i32 0)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"t-abc\00"
@.str.1 = [12 x i8] c"t-openclose\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @fork()
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = icmp eq i32 %0, 1
%7 = select i1 %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0)
%8 = tail call i32 @execl(i8* %7, i8* %7, i32* null)
%9 = tail call i32 @exit(i32 2)
unreachable
10: ; preds = %2
%11 = tail call i32 @waitpid(i32 %3, i32* null, i32 0)
ret i32 0
}