#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*/ eprintf(char *);
int /*<<< orphan*/ execlp(char *, char *, char *, char const *, char *);
int fork();
int /*<<< orphan*/ waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
void strip(const char *filename) {
  pid_t pid = fork();
  switch (pid) {
  case -1:
    eprintf("fork:");
  case 0:
    execlp("strip", "strip", "--", filename, (char *)0);
    eprintf("exec: strip:");
  default:
    waitpid(pid, NULL, 0);
    break;
  }
}


x86 assembly (clang, -O0):
<strip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
call   1060 <fork@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0xffffffff,%eax
je     117a <strip+0x3a>
jmp    116a <strip+0x2a>
mov    -0x10(%rbp),%eax
test   %eax,%eax
je     1186 <strip+0x46>
jmp    11b1 <strip+0x71>
lea    0xe7f(%rip),%rdi
call   1030 <eprintf@plt>
mov    -0x8(%rbp),%rcx
lea    0xe75(%rip),%rsi
lea    0xe74(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
mov    %rsi,%rdi
call   1050 <execlp@plt>
lea    0xe63(%rip),%rdi
call   1030 <eprintf@plt>
mov    -0xc(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1040 <waitpid@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strip>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1060 <fork@plt>
mov    %eax,%ebx
test   %eax,%eax
je     1165 <strip+0x25>
cmp    $0xffffffff,%ebx
jne    118d <strip+0x4d>
lea    0xea0(%rip),%rdi
call   1030 <eprintf@plt>
lea    0xe9a(%rip),%rdi
lea    0xe99(%rip),%rdx
mov    %rdi,%rsi
mov    %r14,%rcx
xor    %r8d,%r8d
call   1050 <execlp@plt>
lea    0xe87(%rip),%rdi
call   1030 <eprintf@plt>
mov    %ebx,%edi
xor    %esi,%esi
xor    %edx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <waitpid@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"fork:\00"
@.str.1 = [6 x i8] c"strip\00"
@.str.2 = [3 x i8] c"--\00"
@.str.3 = [13 x i8] c"exec: strip:\00"
define void @strip(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = call i32 (...) @fork()
store i32 %4, i32* %3
%5 = load i32, i32* %3
switch i32 %5, label %12 [
i32 -1, label %6
i32 0, label %8
]
6: ; preds = %1
%7 = call i32 @eprintf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %1, %6
%9 = load i8*, i8** %2
%10 = call i32 @execlp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %9, i8* null)
%11 = call i32 @eprintf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %12
12: ; preds = %1, %8
%13 = load i32, i32* %3
%14 = call i32 @waitpid(i32 %13, i32* null, i32 0)
br label %15
15: ; preds = %12
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"fork:\00"
@.str.1 = [6 x i8] c"strip\00"
@.str.2 = [3 x i8] c"--\00"
@.str.3 = [13 x i8] c"exec: strip:\00"
define void @strip(i8* %0) {
%2 = tail call i32 (...) @fork()
switch i32 %2, label %8 [
i32 -1, label %3
i32 0, label %5
]
3: ; preds = %1
%4 = tail call i32 @eprintf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %1, %3
%6 = tail call i32 @execlp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* null)
%7 = tail call i32 @eprintf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %8
8: ; preds = %1, %5
%9 = tail call i32 @waitpid(i32 %2, i32* null, i32 0)
ret void
}