#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 EXIT_FAILURE;
int EXIT_SUCCESS;
scalar_t__ daemonize(char **);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ usage(int /*<<< orphan*/, char *);
int main(int argc, char *argv[]) {
  int i;
  if (argc < 1) {
    usage(stdout, argv[0]);
    fprintf(stderr, "Error: Too few arguments!\n");
    exit(EXIT_FAILURE);
  }
  for (i = 0; i < (argc - 1); i++)
    argv[i] = argv[i + 1];
  argv[i] = NULL;
  return daemonize(&argv[0]) == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}


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   $0x1,-0x8(%rbp)
jge    1198 <main+0x58>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1050 <usage@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
lea    0xe7b(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11db <main+0x9b>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    119f <main+0x5f>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rdi
call   1030 <daemonize@plt>
cmp    $0x0,%rax
jne    120f <main+0xcf>
mov    0x2dc3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
jmp    121b <main+0xdb>
mov    0x2dc2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
test   %edi,%edi
jle    11ac <main+0x5c>
mov    %edi,%ebx
cmp    $0x1,%edi
jne    1166 <main+0x16>
xor    %ebx,%ebx
jmp    117d <main+0x2d>
add    $0xffffffff,%ebx
lea    0x8(%r14),%rsi
lea    0x0(,%rbx,8),%rdx
mov    %r14,%rdi
call   1060 <memmove@plt>
movq   $0x0,(%r14,%rbx,8)
mov    %r14,%rdi
call   1030 <daemonize@plt>
test   %rax,%rax
jne    119b <main+0x4b>
mov    0x2e2f(%rip),%rax
jmp    11a2 <main+0x52>
mov    0x2e36(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e1d(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rsi
call   1050 <usage@plt>
mov    0x2e1c(%rip),%rax
mov    (%rax),%edi
lea    0xe33(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2dff(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@stderr = global i32 0
@.str = [27 x i8] c"Error: Too few arguments!\0A\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
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 = icmp slt i32 %7, 1
br i1 %8, label %9, label %19
9: ; preds = %2
%10 = load i32, i32* @stdout
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @usage(i32 %10, i8* %13)
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%17 = load i32, i32* @EXIT_FAILURE
%18 = call i32 @exit(i32 %17)
unreachable
19: ; preds = %2
store i32 0, i32* %6
br label %20
20: ; preds = %36, %19
%21 = load i32, i32* %6
%22 = load i32, i32* %4
%23 = sub nsw i32 %22, 1
%24 = icmp slt i32 %21, %23
br i1 %24, label %25, label %39
25: ; preds = %20
%26 = load i8**, i8*** %5
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %26, i64 %29
%31 = load i8*, i8** %30
%32 = load i8**, i8*** %5
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %32, i64 %34
store i8* %31, i8** %35
br label %36
36: ; preds = %25
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
br label %20
39: ; preds = %20
%40 = load i8**, i8*** %5
%41 = load i32, i32* %6
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %40, i64 %42
store i8* null, i8** %43
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 0
%46 = call i64 @daemonize(i8** %45)
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %39
%49 = load i32, i32* @EXIT_SUCCESS
br label %52
50: ; preds = %39
%51 = load i32, i32* @EXIT_FAILURE
br label %52
52: ; preds = %50, %48
%53 = phi i32 [ %49, %48 ], [ %51, %50 ]
ret i32 %53
}

LLVM IR (-O2):
@stdout = global i32 0
@stderr = global i32 0
@.str = [27 x i8] c"Error: Too few arguments!\0A\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = bitcast i8** %1 to i8*
%4 = icmp slt i32 %0, 1
br i1 %4, label %15, label %5
5: ; preds = %2
%6 = icmp eq i32 %0, 1
br i1 %6, label %23, label %7
7: ; preds = %5
%8 = add nsw i32 %0, -1
%9 = getelementptr i8*, i8** %1, i64 1
%10 = bitcast i8** %9 to i8*
%11 = zext i32 %8 to i64
%12 = shl nuw nsw i64 %11, 3
%13 = add nsw i32 %0, -1
%14 = zext i32 %13 to i64
br label %23
15: ; preds = %2
%16 = load i32, i32* @stdout
%17 = load i8*, i8** %1
%18 = tail call i32 @usage(i32 %16, i8* %17)
%19 = load i32, i32* @stderr
%20 = tail call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%21 = load i32, i32* @EXIT_FAILURE
%22 = tail call i32 @exit(i32 %21)
unreachable
23: ; preds = %7, %5
%24 = phi i64 [ 0, %5 ], [ %14, %7 ]
%25 = getelementptr inbounds i8*, i8** %1, i64 %24
store i8* null, i8** %25
%26 = tail call i64 @daemonize(i8** %1)
%27 = icmp eq i64 %26, 0
%28 = load i32, i32* @EXIT_SUCCESS
%29 = load i32, i32* @EXIT_FAILURE
%30 = select i1 %27, i32 %28, i32 %29
ret i32 %30
}