#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*/ O_RDWR;
int /*<<< orphan*/ err_sys(char *);
int /*<<< orphan*/ execlp(char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int fork();
int getpgrp();
int getpid();
int getsid(int /*<<< orphan*/);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ print();
int /*<<< orphan*/ printf(char *, ...);
int setpgid(int, int);
int setsid();
int main(int argc, char *argv[]) {
  if (argc < 3) {
    printf("Usage: tty ttyname grpid\n");
    return -1;
  }
  if (setsid() == -1)
    perror("setsid");
  int ret = 0;
  pid_t pid = getpid();
  pid_t grp = getpgrp();
  pid_t sid = getsid(0);
  printf("parent %u: %u, %u\n", sid, pid, grp);
  pid_t cid = fork();
  if (cid < 0)
    err_sys("fork");
  else if (cid == 0) {
    if (setsid() == -1)
      err_sys("setsid");
    pid = getpid();
    grp = getpgrp();
    sid = getsid(0);
    printf("session %u: %u, %u\n", sid, pid, grp);
  } else
    exit(0);
  int fd = open(argv[1], O_RDWR);
  if (fd == -1)
    err_sys("open tty");
  printf("open tty %d\n", fd);
  cid = fork();
  if (cid < 0)
    err_sys("fork");
  else if (cid == 0) {
    pid_t pid = getpid();
    pid_t grp = getpgrp();
    pid_t sid = getsid(0);
    printf("child %u: %u, %u\n", sid, pid, grp);
    ret = setpgid(0, 0);
    if (ret == -1)
      err_sys("setpgid child");
    execlp(argv[2], argv[2], NULL);
    exit(-1);
  }
  ret = setpgid(cid, cid);
  if (ret == -1)
    err_sys("setpgid 1");
  ret = setpgid(0, cid);
  if (ret == -1)
    err_sys("setpgid 2");
  print();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    120a <main+0x3a>
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1436 <main+0x266>
mov    $0x0,%al
call   1070 <setsid@plt>
cmp    $0xffffffff,%eax
jne    1226 <main+0x56>
lea    0xdf9(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1090 <getpgrp@plt>
mov    %eax,-0x1c(%rbp)
xor    %edi,%edi
call   1060 <getsid@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xdc6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   10f0 <fork@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    1287 <main+0xb7>
lea    0xdb7(%rip),%rdi
call   1030 <err_sys@plt>
jmp    12f3 <main+0x123>
cmpl   $0x0,-0x24(%rbp)
jne    12e7 <main+0x117>
mov    $0x0,%al
call   1070 <setsid@plt>
cmp    $0xffffffff,%eax
jne    12ad <main+0xdd>
lea    0xd72(%rip),%rdi
call   1030 <err_sys@plt>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1090 <getpgrp@plt>
mov    %eax,-0x1c(%rbp)
xor    %edi,%edi
call   1060 <getsid@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xd5e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12ee <main+0x11e>
xor    %edi,%edi
call   10d0 <exit@plt>
jmp    12f3 <main+0x123>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2ce6(%rip),%rax
mov    (%rax),%esi
call   10a0 <open@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0xffffffff,-0x28(%rbp)
jne    1322 <main+0x152>
lea    0xd30(%rip),%rdi
call   1030 <err_sys@plt>
mov    -0x28(%rbp),%esi
lea    0xd2a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   10f0 <fork@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    1358 <main+0x188>
lea    0xce6(%rip),%rdi
call   1030 <err_sys@plt>
jmp    13e1 <main+0x211>
cmpl   $0x0,-0x24(%rbp)
jne    13dc <main+0x20c>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,-0x2c(%rbp)
mov    $0x0,%al
call   1090 <getpgrp@plt>
mov    %eax,-0x30(%rbp)
xor    %edi,%edi
call   1060 <getsid@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x30(%rbp),%ecx
lea    0xcd3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %esi,%esi
mov    %esi,%edi
call   10c0 <setpgid@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    13b9 <main+0x1e9>
lea    0xcc1(%rip),%rdi
call   1030 <err_sys@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   10e0 <execlp@plt>
mov    $0xffffffff,%edi
call   10d0 <exit@plt>
jmp    13e1 <main+0x211>
mov    -0x24(%rbp),%edi
mov    -0x24(%rbp),%esi
call   10c0 <setpgid@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1405 <main+0x235>
lea    0xc83(%rip),%rdi
call   1030 <err_sys@plt>
mov    -0x24(%rbp),%esi
xor    %edi,%edi
call   10c0 <setpgid@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1428 <main+0x258>
lea    0xc6a(%rip),%rdi
call   1030 <err_sys@plt>
mov    $0x0,%al
call   1080 <print@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x2,%edi
jg     11ff <main+0x1f>
lea    0xe8d(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
jmp    138f <main+0x1af>
mov    %rsi,%r14
xor    %eax,%eax
call   1080 <setsid@plt>
cmp    $0xffffffff,%eax
je     1396 <main+0x1b6>
xor    %eax,%eax
call   1050 <getpid@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   10a0 <getpgrp@plt>
mov    %eax,%ebx
xor    %edi,%edi
call   1070 <getsid@plt>
lea    0xdd5(%rip),%rdi
mov    %eax,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1100 <fork@plt>
test   %eax,%eax
js     1297 <main+0xb7>
jne    13a7 <main+0x1c7>
xor    %eax,%eax
call   1080 <setsid@plt>
cmp    $0xffffffff,%eax
jne    1268 <main+0x88>
lea    0xd9d(%rip),%rdi
call   1040 <err_sys@plt>
xor    %eax,%eax
call   1050 <getpid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   10a0 <getpgrp@plt>
mov    %eax,%ebp
xor    %edi,%edi
call   1070 <getsid@plt>
lea    0xd97(%rip),%rdi
mov    %eax,%esi
mov    %ebx,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
jmp    12a3 <main+0xc3>
lea    0xd7c(%rip),%rdi
call   1040 <err_sys@plt>
mov    0x8(%r14),%rdi
mov    0x2d3a(%rip),%rax
mov    (%rax),%esi
call   10b0 <open@plt>
mov    %eax,%ebp
cmp    $0xffffffff,%eax
jne    12c8 <main+0xe8>
lea    0xd70(%rip),%rdi
call   1040 <err_sys@plt>
lea    0xd6d(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1100 <fork@plt>
mov    %eax,%ebp
test   %eax,%eax
js     1346 <main+0x166>
jne    1352 <main+0x172>
xor    %eax,%eax
call   1050 <getpid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   10a0 <getpgrp@plt>
mov    %eax,%ebp
xor    %edi,%edi
call   1070 <getsid@plt>
lea    0xd42(%rip),%rdi
mov    %eax,%esi
mov    %ebx,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
xor    %esi,%esi
call   10d0 <setpgid@plt>
cmp    $0xffffffff,%eax
jne    132e <main+0x14e>
lea    0xd32(%rip),%rdi
call   1040 <err_sys@plt>
mov    0x10(%r14),%rdi
mov    %rdi,%rsi
xor    %edx,%edx
call   10f0 <execlp@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
lea    0xccd(%rip),%rdi
call   1040 <err_sys@plt>
mov    %ebp,%edi
mov    %ebp,%esi
call   10d0 <setpgid@plt>
cmp    $0xffffffff,%eax
jne    136c <main+0x18c>
lea    0xd02(%rip),%rdi
call   1040 <err_sys@plt>
xor    %ebx,%ebx
xor    %edi,%edi
mov    %ebp,%esi
call   10d0 <setpgid@plt>
cmp    $0xffffffff,%eax
jne    1388 <main+0x1a8>
lea    0xcf0(%rip),%rdi
call   1040 <err_sys@plt>
xor    %eax,%eax
call   1090 <print@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xc63(%rip),%rdi
call   10c0 <perror@plt>
jmp    1212 <main+0x32>
xor    %edi,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"Usage: tty ttyname grpid\0A\00"
@.str.1 = [7 x i8] c"setsid\00"
@.str.2 = [19 x i8] c"parent %u: %u, %u\0A\00"
@.str.3 = [5 x i8] c"fork\00"
@.str.4 = [20 x i8] c"session %u: %u, %u\0A\00"
@O_RDWR = global i32 0
@.str.5 = [9 x i8] c"open tty\00"
@.str.6 = [13 x i8] c"open tty %d\0A\00"
@.str.7 = [18 x i8] c"child %u: %u, %u\0A\00"
@.str.8 = [14 x i8] c"setpgid child\00"
@.str.9 = [10 x i8] c"setpgid 1\00"
@.str.10 = [10 x i8] c"setpgid 2\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 3
br i1 %16, label %17, label %19
17: ; preds = %2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %117
19: ; preds = %2
%20 = call i32 (...) @setsid()
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %24
24: ; preds = %22, %19
store i32 0, i32* %6
%25 = call i32 (...) @getpid()
store i32 %25, i32* %7
%26 = call i32 (...) @getpgrp()
store i32 %26, i32* %8
%27 = call i32 @getsid(i32 0)
store i32 %27, i32* %9
%28 = load i32, i32* %9
%29 = load i32, i32* %7
%30 = load i32, i32* %8
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %28, i32 %29, i32 %30)
%32 = call i32 (...) @fork()
store i32 %32, i32* %10
%33 = load i32, i32* %10
%34 = icmp slt i32 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %24
%36 = call i32 @err_sys(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %56
37: ; preds = %24
%38 = load i32, i32* %10
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %53
40: ; preds = %37
%41 = call i32 (...) @setsid()
%42 = icmp eq i32 %41, -1
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call i32 @err_sys(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %45
45: ; preds = %43, %40
%46 = call i32 (...) @getpid()
store i32 %46, i32* %7
%47 = call i32 (...) @getpgrp()
store i32 %47, i32* %8
%48 = call i32 @getsid(i32 0)
store i32 %48, i32* %9
%49 = load i32, i32* %9
%50 = load i32, i32* %7
%51 = load i32, i32* %8
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %49, i32 %50, i32 %51)
br label %55
53: ; preds = %37
%54 = call i32 @exit(i32 0)
unreachable
55: ; preds = %45
br label %56
56: ; preds = %55, %35
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 1
%59 = load i8*, i8** %58
%60 = load i32, i32* @O_RDWR
%61 = call i32 @open(i8* %59, i32 %60)
store i32 %61, i32* %11
%62 = load i32, i32* %11
%63 = icmp eq i32 %62, -1
br i1 %63, label %64, label %66
64: ; preds = %56
%65 = call i32 @err_sys(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
br label %66
66: ; preds = %64, %56
%67 = load i32, i32* %11
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 %67)
%69 = call i32 (...) @fork()
store i32 %69, i32* %10
%70 = load i32, i32* %10
%71 = icmp slt i32 %70, 0
br i1 %71, label %72, label %74
72: ; preds = %66
%73 = call i32 @err_sys(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %100
74: ; preds = %66
%75 = load i32, i32* %10
%76 = icmp eq i32 %75, 0
br i1 %76, label %77, label %99
77: ; preds = %74
%78 = call i32 (...) @getpid()
store i32 %78, i32* %12
%79 = call i32 (...) @getpgrp()
store i32 %79, i32* %13
%80 = call i32 @getsid(i32 0)
store i32 %80, i32* %14
%81 = load i32, i32* %14
%82 = load i32, i32* %12
%83 = load i32, i32* %13
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i32 %81, i32 %82, i32 %83)
%85 = call i32 @setpgid(i32 0, i32 0)
store i32 %85, i32* %6
%86 = load i32, i32* %6
%87 = icmp eq i32 %86, -1
br i1 %87, label %88, label %90
88: ; preds = %77
%89 = call i32 @err_sys(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
br label %90
90: ; preds = %88, %77
%91 = load i8**, i8*** %5
%92 = getelementptr inbounds i8*, i8** %91, i64 2
%93 = load i8*, i8** %92
%94 = load i8**, i8*** %5
%95 = getelementptr inbounds i8*, i8** %94, i64 2
%96 = load i8*, i8** %95
%97 = call i32 @execlp(i8* %93, i8* %96, i32* null)
%98 = call i32 @exit(i32 -1)
unreachable
99: ; preds = %74
br label %100
100: ; preds = %99, %72
%101 = load i32, i32* %10
%102 = load i32, i32* %10
%103 = call i32 @setpgid(i32 %101, i32 %102)
store i32 %103, i32* %6
%104 = load i32, i32* %6
%105 = icmp eq i32 %104, -1
br i1 %105, label %106, label %108
106: ; preds = %100
%107 = call i32 @err_sys(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
br label %108
108: ; preds = %106, %100
%109 = load i32, i32* %10
%110 = call i32 @setpgid(i32 0, i32 %109)
store i32 %110, i32* %6
%111 = load i32, i32* %6
%112 = icmp eq i32 %111, -1
br i1 %112, label %113, label %115
113: ; preds = %108
%114 = call i32 @err_sys(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
br label %115
115: ; preds = %113, %108
%116 = call i32 (...) @print()
store i32 0, i32* %3
br label %117
117: ; preds = %115, %17
%118 = load i32, i32* %3
ret i32 %118
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"setsid\00"
@.str.2 = [19 x i8] c"parent %u: %u, %u\0A\00"
@.str.3 = [5 x i8] c"fork\00"
@.str.4 = [20 x i8] c"session %u: %u, %u\0A\00"
@O_RDWR = global i32 0
@.str.5 = [9 x i8] c"open tty\00"
@.str.6 = [13 x i8] c"open tty %d\0A\00"
@.str.7 = [18 x i8] c"child %u: %u, %u\0A\00"
@.str.8 = [14 x i8] c"setpgid child\00"
@.str.9 = [10 x i8] c"setpgid 1\00"
@.str.10 = [10 x i8] c"setpgid 2\00"
@str = [25 x i8] c"Usage: tty ttyname grpid\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
br label %76
6: ; preds = %2
%7 = tail call i32 (...) @setsid()
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %6
%12 = tail call i32 (...) @getpid()
%13 = tail call i32 (...) @getpgrp()
%14 = tail call i32 @getsid(i32 0)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %14, i32 %12, i32 %13)
%16 = tail call i32 (...) @fork()
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %11
%19 = tail call i32 @err_sys(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %34
20: ; preds = %11
%21 = icmp eq i32 %16, 0
br i1 %21, label %22, label %32
22: ; preds = %20
%23 = tail call i32 (...) @setsid()
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = tail call i32 @err_sys(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %27
27: ; preds = %25, %22
%28 = tail call i32 (...) @getpid()
%29 = tail call i32 (...) @getpgrp()
%30 = tail call i32 @getsid(i32 0)
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %30, i32 %28, i32 %29)
br label %34
32: ; preds = %20
%33 = tail call i32 @exit(i32 0)
unreachable
34: ; preds = %27, %18
%35 = getelementptr inbounds i8*, i8** %1, i64 1
%36 = load i8*, i8** %35
%37 = load i32, i32* @O_RDWR
%38 = tail call i32 @open(i8* %36, i32 %37)
%39 = icmp eq i32 %38, -1
br i1 %39, label %40, label %42
40: ; preds = %34
%41 = tail call i32 @err_sys(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
br label %42
42: ; preds = %40, %34
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 %38)
%44 = tail call i32 (...) @fork()
%45 = icmp slt i32 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %42
%47 = tail call i32 @err_sys(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %64
48: ; preds = %42
%49 = icmp eq i32 %44, 0
br i1 %49, label %50, label %64
50: ; preds = %48
%51 = tail call i32 (...) @getpid()
%52 = tail call i32 (...) @getpgrp()
%53 = tail call i32 @getsid(i32 0)
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i32 %53, i32 %51, i32 %52)
%55 = tail call i32 @setpgid(i32 0, i32 0)
%56 = icmp eq i32 %55, -1
br i1 %56, label %57, label %59
57: ; preds = %50
%58 = tail call i32 @err_sys(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
br label %59
59: ; preds = %57, %50
%60 = getelementptr inbounds i8*, i8** %1, i64 2
%61 = load i8*, i8** %60
%62 = tail call i32 @execlp(i8* %61, i8* %61, i32* null)
%63 = tail call i32 @exit(i32 -1)
unreachable
64: ; preds = %48, %46
%65 = tail call i32 @setpgid(i32 %44, i32 %44)
%66 = icmp eq i32 %65, -1
br i1 %66, label %67, label %69
67: ; preds = %64
%68 = tail call i32 @err_sys(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
br label %69
69: ; preds = %67, %64
%70 = tail call i32 @setpgid(i32 0, i32 %44)
%71 = icmp eq i32 %70, -1
br i1 %71, label %72, label %74
72: ; preds = %69
%73 = tail call i32 @err_sys(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
br label %74
74: ; preds = %72, %69
%75 = tail call i32 (...) @print()
br label %76
76: ; preds = %74, %4
%77 = phi i32 [ -1, %4 ], [ 0, %74 ]
ret i32 %77
}