#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 /*<<< orphan*/ pid_t;

/* Variables and functions */
scalar_t__ WIFEXITED(int);
int /*<<< orphan*/ daemon(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ execvp(char const *, char *const *);
int /*<<< orphan*/ fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ wait(int *);
int main(int argc, const char *argv[]) {
  if (argc != 2) {
    fprintf(stderr, "FUCK AWf\n");
    return 1;
  }
  daemon(0, 0);
  pid_t ffdf;
  int f;
  ffdf = fork();
  if (!ffdf) {
    execvp(argv[1], (char *const *)argv[1]);
  } else {
    do {
      wait(&f);
      if (WIFEXITED(f)) {
        main(argc, argv);
      }
    } while (1);
  }
  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)
cmpl   $0x2,-0x8(%rbp)
je     11b1 <main+0x41>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
lea    0xe60(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1234 <main+0xc4>
xor    %esi,%esi
mov    %esi,%edi
call   1040 <daemon@plt>
mov    $0x0,%al
call   1090 <fork@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11e8 <main+0x78>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1060 <execvp@plt>
jmp    122d <main+0xbd>
jmp    11ed <main+0x7d>
lea    -0x18(%rbp),%rdi
call   1080 <wait@plt>
mov    -0x18(%rbp),%edi
call   1070 <WIFEXITED@plt>
cmp    $0x0,%rax
je     1214 <main+0xa4>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <main@plt>
jmp    1219 <main+0xa9>
mov    $0x1,%al
test   $0x1,%al
jne    11ed <main+0x7d>
jmp    1228 <main+0xb8>
jmp    122d <main+0xbd>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    11c5 <main+0x55>
mov    %rsi,%rbx
xor    %ebp,%ebp
xor    %edi,%edi
xor    %esi,%esi
call   1040 <daemon@plt>
xor    %eax,%eax
call   1090 <fork@plt>
test   %eax,%eax
je     11e1 <main+0x71>
lea    0x4(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1080 <wait@plt>
mov    0x4(%rsp),%edi
call   1070 <WIFEXITED@plt>
test   %rax,%rax
je     11a0 <main+0x30>
mov    $0x2,%edi
mov    %rbx,%rsi
call   1050 <main@plt>
jmp    11a0 <main+0x30>
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
lea    0xe2b(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%ebp
jmp    11ed <main+0x7d>
mov    0x8(%rbx),%rdi
mov    %rdi,%rsi
call   1060 <execvp@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [10 x i8] c"FUCK AWf\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %41
13: ; preds = %2
%14 = call i32 @daemon(i32 0, i32 0)
%15 = call i32 (...) @fork()
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = icmp ne i32 %16, 0
br i1 %17, label %27, label %18
18: ; preds = %13
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = bitcast i8* %24 to i8**
%26 = call i32 @execvp(i8* %21, i8** %25)
br label %40
27: ; preds = %13
br label %28
28: ; preds = %38, %27
%29 = call i32 @wait(i32* %7)
%30 = load i32, i32* %7
%31 = call i64 @WIFEXITED(i32 %30)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %37
33: ; preds = %28
%34 = load i32, i32* %4
%35 = load i8**, i8*** %5
%36 = call i32 @main(i32 %34, i8** %35)
br label %37
37: ; preds = %33, %28
br label %38
38: ; preds = %37
br i1 true, label %28, label %39
39: ; preds = %38
br label %40
40: ; preds = %39, %18
store i32 0, i32* %3
br label %41
41: ; preds = %40, %10
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [10 x i8] c"FUCK AWf\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = icmp eq i32 %0, 2
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %26
8: ; preds = %2
%9 = tail call i32 @daemon(i32 0, i32 0)
%10 = bitcast i32* %3 to i8*
%11 = tail call i32 (...) @fork()
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %8
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = bitcast i8* %15 to i8**
%17 = tail call i32 @execvp(i8* %15, i8** %16)
br label %26
18: ; preds = %8, %23
%19 = call i32 @wait(i32* %3)
%20 = load i32, i32* %3
%21 = call i64 @WIFEXITED(i32 %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %18, %24
br label %18
24: ; preds = %18
%25 = call i32 @main(i32 2, i8** %1)
br label %23
26: ; preds = %13, %5
%27 = phi i32 [ 1, %5 ], [ 0, %13 ]
ret i32 %27
}