#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*/ fputc(char, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void show_usage() {
  fputs("Usage: execfd [OPTIONS] [argi]* -- [arg|fd]*", stderr);
  fputc('\n', stderr);
  ;
  fputs("  Each argi is an index that has a file descriptor in it.", stderr);
  fputc('\n', stderr);
  ;
  fputs("  Index zero is the executable name.", stderr);
  fputc('\n', stderr);
  ;
  fputs(" OPTIONS:", stderr);
  fputc('\n', stderr);
  ;
  fputs("  -exe filename -- Name of executable to write. Only used when index "
        "0 is present.",
        stderr);
  fputc('\n', stderr);
  ;
  fputs("  -stdin filename -- Standard input for the spawned process.", stderr);
  fputc('\n', stderr);
  ;
  fputs("  -stdout filename -- Standard output for the spawned process.",
        stderr);
  fputc('\n', stderr);
  ;
  fputs("  -inheritfd fd -- File descriptor for spawned process to inherit.",
        stderr);
  fputc('\n', stderr);
  ;
  fputs("    Only useful when invoked as builtin.", stderr);
  fputc('\n', stderr);
  ;
  fputs("  -waitfd fd -- Wait on this file descriptor to close.", stderr);
  fputc('\n', stderr);
  ;
  fputs("  -exitfd fd -- Close this file descriptor on exit.", stderr);
  fputc('\n', stderr);
  ;
}


x86 assembly (clang, -O0):
<show_usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%esi
lea    0xecc(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2ea0(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    0x2e8d(%rip),%rax
mov    (%rax),%esi
lea    0xed1(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    0x2e65(%rip),%rax
mov    (%rax),%esi
lea    0xee3(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2e50(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    0x2e3d(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2e28(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    0x2e15(%rip),%rax
mov    (%rax),%esi
lea    0xec2(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2e00(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    0x2ded(%rip),%rax
mov    (%rax),%esi
lea    0xeed(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2dd8(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    0x2dc5(%rip),%rax
mov    (%rax),%esi
lea    0xf02(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2db0(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    0x2d9d(%rip),%rax
mov    (%rax),%esi
lea    0xf19(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2d88(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    0x2d75(%rip),%rax
mov    (%rax),%esi
lea    0xf34(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2d60(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    0x2d4d(%rip),%rax
mov    (%rax),%esi
lea    0xf35(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2d38(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    0x2d25(%rip),%rax
mov    (%rax),%esi
lea    0xf44(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2d10(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_usage>:
push   %rbx
mov    0x2eb8(%rip),%rbx
mov    (%rbx),%esi
lea    0xecf(%rip),%rdi
call   1030 <fputs@plt>
mov    (%rbx),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    (%rbx),%esi
lea    0xee2(%rip),%rdi
call   1030 <fputs@plt>
mov    (%rbx),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    (%rbx),%esi
lea    0xf02(%rip),%rdi
call   1030 <fputs@plt>
mov    (%rbx),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    (%rbx),%esi
lea    0xf0d(%rip),%rdi
call   1030 <fputs@plt>
mov    (%rbx),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    (%rbx),%esi
lea    0xefd(%rip),%rdi
call   1030 <fputs@plt>
mov    (%rbx),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    (%rbx),%esi
lea    0xf36(%rip),%rdi
call   1030 <fputs@plt>
mov    (%rbx),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    (%rbx),%esi
lea    0xf59(%rip),%rdi
call   1030 <fputs@plt>
mov    (%rbx),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    (%rbx),%esi
lea    0xf7e(%rip),%rdi
call   1030 <fputs@plt>
mov    (%rbx),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    (%rbx),%esi
lea    0xfa7(%rip),%rdi
call   1030 <fputs@plt>
mov    (%rbx),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    (%rbx),%esi
lea    0xfb6(%rip),%rdi
call   1030 <fputs@plt>
mov    (%rbx),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    (%rbx),%esi
lea    0xfd3(%rip),%rdi
call   1030 <fputs@plt>
mov    (%rbx),%esi
mov    $0xa,%edi
pop    %rbx
jmp    1040 <fputc@plt>

LLVM IR (-O0):
@.str = [45 x i8] c"Usage: execfd [OPTIONS] [argi]* -- [arg|fd]*\00"
@stderr = global i32 0
@.str.1 = [58 x i8] c" Each argi is an index that has a file descriptor in it.\00"
@.str.2 = [37 x i8] c" Index zero is the executable name.\00"
@.str.3 = [10 x i8] c" OPTIONS:\00"
@.str.4 = [83 x i8] c" -exe filename -- Name of executable to write. Only used when index 0 is present.\00"
@.str.5 = [61 x i8] c" -stdin filename -- Standard input for the spawned process.\00"
@.str.6 = [63 x i8] c" -stdout filename -- Standard output for the spawned process.\00"
@.str.7 = [67 x i8] c" -inheritfd fd -- File descriptor for spawned process to inherit.\00"
@.str.8 = [41 x i8] c" Only useful when invoked as builtin.\00"
@.str.9 = [55 x i8] c" -waitfd fd -- Wait on this file descriptor to close.\00"
@.str.10 = [52 x i8] c" -exitfd fd -- Close this file descriptor on exit.\00"
define void @show_usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @stderr
%4 = call i32 @fputc(i8 signext 10, i32 %3)
%5 = load i32, i32* @stderr
%6 = call i32 @fputs(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @stderr
%8 = call i32 @fputc(i8 signext 10, i32 %7)
%9 = load i32, i32* @stderr
%10 = call i32 @fputs(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = load i32, i32* @stderr
%12 = call i32 @fputc(i8 signext 10, i32 %11)
%13 = load i32, i32* @stderr
%14 = call i32 @fputs(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%15 = load i32, i32* @stderr
%16 = call i32 @fputc(i8 signext 10, i32 %15)
%17 = load i32, i32* @stderr
%18 = call i32 @fputs(i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.4, i64 0, i64 0), i32 %17)
%19 = load i32, i32* @stderr
%20 = call i32 @fputc(i8 signext 10, i32 %19)
%21 = load i32, i32* @stderr
%22 = call i32 @fputs(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0), i32 %21)
%23 = load i32, i32* @stderr
%24 = call i32 @fputc(i8 signext 10, i32 %23)
%25 = load i32, i32* @stderr
%26 = call i32 @fputs(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.6, i64 0, i64 0), i32 %25)
%27 = load i32, i32* @stderr
%28 = call i32 @fputc(i8 signext 10, i32 %27)
%29 = load i32, i32* @stderr
%30 = call i32 @fputs(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.7, i64 0, i64 0), i32 %29)
%31 = load i32, i32* @stderr
%32 = call i32 @fputc(i8 signext 10, i32 %31)
%33 = load i32, i32* @stderr
%34 = call i32 @fputs(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.8, i64 0, i64 0), i32 %33)
%35 = load i32, i32* @stderr
%36 = call i32 @fputc(i8 signext 10, i32 %35)
%37 = load i32, i32* @stderr
%38 = call i32 @fputs(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.9, i64 0, i64 0), i32 %37)
%39 = load i32, i32* @stderr
%40 = call i32 @fputc(i8 signext 10, i32 %39)
%41 = load i32, i32* @stderr
%42 = call i32 @fputs(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.10, i64 0, i64 0), i32 %41)
%43 = load i32, i32* @stderr
%44 = call i32 @fputc(i8 signext 10, i32 %43)
ret void
}

LLVM IR (-O2):
@.str = [45 x i8] c"Usage: execfd [OPTIONS] [argi]* -- [arg|fd]*\00"
@stderr = global i32 0
@.str.1 = [58 x i8] c" Each argi is an index that has a file descriptor in it.\00"
@.str.2 = [37 x i8] c" Index zero is the executable name.\00"
@.str.3 = [10 x i8] c" OPTIONS:\00"
@.str.4 = [83 x i8] c" -exe filename -- Name of executable to write. Only used when index 0 is present.\00"
@.str.5 = [61 x i8] c" -stdin filename -- Standard input for the spawned process.\00"
@.str.6 = [63 x i8] c" -stdout filename -- Standard output for the spawned process.\00"
@.str.7 = [67 x i8] c" -inheritfd fd -- File descriptor for spawned process to inherit.\00"
@.str.8 = [41 x i8] c" Only useful when invoked as builtin.\00"
@.str.9 = [55 x i8] c" -waitfd fd -- Wait on this file descriptor to close.\00"
@.str.10 = [52 x i8] c" -exitfd fd -- Close this file descriptor on exit.\00"
define void @show_usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @stderr
%4 = tail call i32 @fputc(i8 signext 10, i32 %3)
%5 = load i32, i32* @stderr
%6 = tail call i32 @fputs(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @stderr
%8 = tail call i32 @fputc(i8 signext 10, i32 %7)
%9 = load i32, i32* @stderr
%10 = tail call i32 @fputs(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = load i32, i32* @stderr
%12 = tail call i32 @fputc(i8 signext 10, i32 %11)
%13 = load i32, i32* @stderr
%14 = tail call i32 @fputs(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%15 = load i32, i32* @stderr
%16 = tail call i32 @fputc(i8 signext 10, i32 %15)
%17 = load i32, i32* @stderr
%18 = tail call i32 @fputs(i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.4, i64 0, i64 0), i32 %17)
%19 = load i32, i32* @stderr
%20 = tail call i32 @fputc(i8 signext 10, i32 %19)
%21 = load i32, i32* @stderr
%22 = tail call i32 @fputs(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0), i32 %21)
%23 = load i32, i32* @stderr
%24 = tail call i32 @fputc(i8 signext 10, i32 %23)
%25 = load i32, i32* @stderr
%26 = tail call i32 @fputs(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.6, i64 0, i64 0), i32 %25)
%27 = load i32, i32* @stderr
%28 = tail call i32 @fputc(i8 signext 10, i32 %27)
%29 = load i32, i32* @stderr
%30 = tail call i32 @fputs(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.7, i64 0, i64 0), i32 %29)
%31 = load i32, i32* @stderr
%32 = tail call i32 @fputc(i8 signext 10, i32 %31)
%33 = load i32, i32* @stderr
%34 = tail call i32 @fputs(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.8, i64 0, i64 0), i32 %33)
%35 = load i32, i32* @stderr
%36 = tail call i32 @fputc(i8 signext 10, i32 %35)
%37 = load i32, i32* @stderr
%38 = tail call i32 @fputs(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.9, i64 0, i64 0), i32 %37)
%39 = load i32, i32* @stderr
%40 = tail call i32 @fputc(i8 signext 10, i32 %39)
%41 = load i32, i32* @stderr
%42 = tail call i32 @fputs(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.10, i64 0, i64 0), i32 %41)
%43 = load i32, i32* @stderr
%44 = tail call i32 @fputc(i8 signext 10, i32 %43)
ret void
}