#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*/ err_sys(char *);
int /*<<< orphan*/ execlp(char *, char *, char const *, int /*<<< orphan*/ *);
int fork();
int /*<<< orphan*/ printf(char *, int);
void create_uucp(char const *lock) {
  int pid = fork();
  if (pid < 0)
    err_sys("fork");
  else if (pid == 0) {
    execlp("./uucp", "./uucp", lock, NULL);
    err_sys("execlp");
  } else
    printf("create uucp %u\n", pid);
}


x86 assembly (clang, -O0):
<create_uucp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1060 <fork@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1171 <create_uucp+0x31>
lea    0xe99(%rip),%rdi
call   1030 <err_sys@plt>
jmp    11b7 <create_uucp+0x77>
cmpl   $0x0,-0xc(%rbp)
jne    11a3 <create_uucp+0x63>
mov    -0x8(%rbp),%rdx
lea    0xe7f(%rip),%rsi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rsi,%rdi
call   1050 <execlp@plt>
lea    0xe73(%rip),%rdi
call   1030 <err_sys@plt>
jmp    11b2 <create_uucp+0x72>
mov    -0xc(%rbp),%esi
lea    0xe66(%rip),%rdi
call   1040 <printf@plt>
jmp    11b7 <create_uucp+0x77>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_uucp>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1060 <fork@plt>
test   %eax,%eax
js     1160 <create_uucp+0x20>
je     116d <create_uucp+0x2d>
lea    0xebb(%rip),%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <printf@plt>
lea    0xe99(%rip),%rdi
pop    %rbx
jmp    1030 <err_sys@plt>
lea    0xe91(%rip),%rdi
mov    %rdi,%rsi
mov    %rbx,%rdx
xor    %ecx,%ecx
call   1050 <execlp@plt>
lea    0xe84(%rip),%rdi
pop    %rbx
jmp    1030 <err_sys@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"fork\00"
@.str.1 = [7 x i8] c"./uucp\00"
@.str.2 = [7 x i8] c"execlp\00"
@.str.3 = [16 x i8] c"create uucp %u\0A\00"
define void @create_uucp(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
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @err_sys(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %20
9: ; preds = %1
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load i8*, i8** %2
%14 = call i32 @execlp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %13, i32* null)
%15 = call i32 @err_sys(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %19
16: ; preds = %9
%17 = load i32, i32* %3
%18 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %16, %12
br label %20
20: ; preds = %19, %7
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"fork\00"
@.str.1 = [7 x i8] c"./uucp\00"
@.str.2 = [7 x i8] c"execlp\00"
@.str.3 = [16 x i8] c"create uucp %u\0A\00"
define void @create_uucp(i8* %0) {
%2 = tail call i32 (...) @fork()
%3 = icmp slt i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @err_sys(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %13
6: ; preds = %1
%7 = icmp eq i32 %2, 0
br i1 %7, label %8, label %11
8: ; preds = %6
%9 = tail call i32 @execlp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32* null)
%10 = tail call i32 @err_sys(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %13
11: ; preds = %6
%12 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %2)
br label %13
13: ; preds = %8, %11, %4
ret void
}