#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 _chroot(char *);
int _fork(char *);
int _getgroups(char *);
int _gethostname(char *);
int _sleep(char *, int);
int main(int argc, char *argv[]) {
  int ret;
  (void)argc;
  ret = _chroot(argv[0]);
  ret |= _fork(argv[0]);
  ret |= _getgroups(argv[0]);
  ret |= _gethostname(argv[0]);
  ret |= _sleep(argv[0], 0);
  ret |= _sleep(argv[0], 1);
  return ret;
}


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    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <_chroot@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <_fork@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <_getgroups@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <_gethostname@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
xor    %esi,%esi
call   1030 <_sleep@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x1,%esi
call   1030 <_sleep@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    (%rsi),%rdi
call   1060 <_chroot@plt>
mov    %eax,%r14d
mov    (%rbx),%rdi
call   1050 <_fork@plt>
mov    %eax,%r15d
or     %r14d,%r15d
mov    (%rbx),%rdi
call   1070 <_getgroups@plt>
mov    %eax,%r14d
mov    (%rbx),%rdi
call   1040 <_gethostname@plt>
mov    %eax,%ebp
or     %r14d,%ebp
or     %r15d,%ebp
mov    (%rbx),%rdi
xor    %esi,%esi
call   1030 <_sleep@plt>
mov    %eax,%r14d
mov    (%rbx),%rdi
mov    $0x1,%esi
call   1030 <_sleep@plt>
or     %r14d,%eax
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
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 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 0
%10 = load i8*, i8** %9
%11 = call i32 @_chroot(i8* %10)
store i32 %11, i32* %6
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 @_fork(i8* %14)
%16 = load i32, i32* %6
%17 = or i32 %16, %15
store i32 %17, i32* %6
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 @_getgroups(i8* %20)
%22 = load i32, i32* %6
%23 = or i32 %22, %21
store i32 %23, i32* %6
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 0
%26 = load i8*, i8** %25
%27 = call i32 @_gethostname(i8* %26)
%28 = load i32, i32* %6
%29 = or i32 %28, %27
store i32 %29, i32* %6
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 0
%32 = load i8*, i8** %31
%33 = call i32 @_sleep(i8* %32, i32 0)
%34 = load i32, i32* %6
%35 = or i32 %34, %33
store i32 %35, i32* %6
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 0
%38 = load i8*, i8** %37
%39 = call i32 @_sleep(i8* %38, i32 1)
%40 = load i32, i32* %6
%41 = or i32 %40, %39
store i32 %41, i32* %6
%42 = load i32, i32* %6
ret i32 %42
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = tail call i32 @_chroot(i8* %3)
%5 = load i8*, i8** %1
%6 = tail call i32 @_fork(i8* %5)
%7 = or i32 %6, %4
%8 = load i8*, i8** %1
%9 = tail call i32 @_getgroups(i8* %8)
%10 = or i32 %7, %9
%11 = load i8*, i8** %1
%12 = tail call i32 @_gethostname(i8* %11)
%13 = or i32 %10, %12
%14 = load i8*, i8** %1
%15 = tail call i32 @_sleep(i8* %14, i32 0)
%16 = or i32 %13, %15
%17 = load i8*, i8** %1
%18 = tail call i32 @_sleep(i8* %17, i32 1)
%19 = or i32 %16, %18
ret i32 %19
}