#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*/ printf(char *, char *);
void help() {
  int i;
  char *help[] = {
      "USAGE",
      "shepherd [-d] [COMMAND [ARGUMENTS] ---]... COMMAND [ARGUMENTS]",
      "Runs each COMMAND with ARGUMENTS in the background, restarting them "
      "when they die for any reason.",
      "",
      "OPTIONS",
      "-d\t\tDaemonize",
      "",
      "SIGNALS",
      "HUP\t\tRestart all processes",
      "KILL, INT\tKill all processes and exit",
      NULL};
  for (i = 0; help[i]; i++)
    printf("%s\n", help[i]);
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x60(%rbp),%rdi
lea    0x2c8d(%rip),%rsi
mov    $0x58,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x4(%rbp)
movslq -0x4(%rbp),%rax
cmpq   $0x0,-0x60(%rbp,%rax,8)
je     1177 <help+0x57>
movslq -0x4(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rsi
lea    0xfa2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1144 <help+0x24>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<help>:
push   %r14
push   %rbx
push   %rax
lea    0xfeb(%rip),%rbx
lea    0xede(%rip),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xed5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xf05(%rip),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xfba(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
lea    0xf46(%rip),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xf3f(%rip),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
lea    0xf33(%rip),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xf2c(%rip),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xf38(%rip),%rsi
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"USAGE\00"
@.str.1 = [63 x i8] c"shepherd [-d] [COMMAND [ARGUMENTS] ---]... COMMAND [ARGUMENTS]\00"
@.str.2 = [98 x i8] c"Runs each COMMAND with ARGUMENTS in the background, restarting them when they die for any reason.\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [8 x i8] c"OPTIONS\00"
@.str.5 = [14 x i8] c"-d\09\09Daemonize\00"
@.str.6 = [8 x i8] c"SIGNALS\00"
@.str.7 = [27 x i8] c"HUP\09\09Restart all processes\00"
@.str.8 = [38 x i8] c"KILL, INT\09Kill all processes and exit\00"
@__const.help.help = [11 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i32 0, i32 0), i8* null]
@.str.9 = [4 x i8] c"%s\0A\00"
define void @help() {
%1 = alloca i32
%2 = alloca [11 x i8*]
%3 = bitcast [11 x i8*]* %2 to i8*
store i32 0, i32* %1
br label %4
4: ; preds = %16, %0
%5 = load i32, i32* %1
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [11 x i8*], [11 x i8*]* %2, i64 0, i64 %6
%8 = load i8*, i8** %7
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %19
10: ; preds = %4
%11 = load i32, i32* %1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [11 x i8*], [11 x i8*]* %2, i64 0, i64 %12
%14 = load i8*, i8** %13
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %14)
br label %16
16: ; preds = %10
%17 = load i32, i32* %1
%18 = add nsw i32 %17, 1
store i32 %18, i32* %1
br label %4
19: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"USAGE\00"
@.str.1 = [63 x i8] c"shepherd [-d] [COMMAND [ARGUMENTS] ---]... COMMAND [ARGUMENTS]\00"
@.str.2 = [98 x i8] c"Runs each COMMAND with ARGUMENTS in the background, restarting them when they die for any reason.\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [8 x i8] c"OPTIONS\00"
@.str.5 = [14 x i8] c"-d\09\09Daemonize\00"
@.str.6 = [8 x i8] c"SIGNALS\00"
@.str.7 = [27 x i8] c"HUP\09\09Restart all processes\00"
@.str.8 = [38 x i8] c"KILL, INT\09Kill all processes and exit\00"
@.str.9 = [4 x i8] c"%s\0A\00"
define void @help() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0))
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0))
ret void
}