#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*/ build_sys_str(char *, int *, int, char **, char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ stderr;
scalar_t__ system(char *);
void xargs(int argc, char **argv, char *substitution_buffer) {
  char sys_str[4096];
  int trace_mode;
  if (!build_sys_str(sys_str, &trace_mode, argc, argv, substitution_buffer)) {
    fprintf(stderr, "ERROR: %s: buffer of size %d not big enough.\n", argv[0],
            4096);
    exit(1);
  } else {
    if (trace_mode)
      fprintf(stderr, "%s\n", sys_str);
    if (system(sys_str)) {
    };
  }
}


x86 assembly (clang, -O0):
<xargs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1030,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x1020(%rbp),%rdi
mov    -0x4(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    -0x1024(%rbp),%rsi
call   1050 <build_sys_str@plt>
cmp    $0x0,%eax
jne    11aa <xargs+0x6a>
mov    0x2e5c(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe6c(%rip),%rsi
mov    $0x1000,%ecx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
cmpl   $0x0,-0x1024(%rbp)
je     11d5 <xargs+0x95>
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
lea    -0x1020(%rbp),%rdx
lea    0xe60(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
lea    -0x1020(%rbp),%rdi
call   1030 <system@plt>
cmp    $0x0,%rax
je     11f0 <xargs+0xb0>
jmp    11f0 <xargs+0xb0>
jmp    11f5 <xargs+0xb5>
add    $0x1030,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xargs>:
push   %rbx
sub    $0x1010,%rsp
mov    %rdx,%r8
mov    %rsi,%rbx
mov    %edi,%edx
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rsi
mov    %rbx,%rcx
call   1050 <build_sys_str@plt>
test   %eax,%eax
je     119c <xargs+0x5c>
cmpl   $0x0,0xc(%rsp)
je     1189 <xargs+0x49>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
lea    0xeb1(%rip),%rsi
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0x10(%rsp),%rdi
call   1030 <system@plt>
add    $0x1010,%rsp
pop    %rbx
ret
mov    0x2e3d(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe51(%rip),%rsi
mov    $0x1000,%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [46 x i8] c"ERROR: %s: buffer of size %d not big enough.\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @xargs(i32 %0, i8** %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca [4096 x i8]
%8 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* %2, i8** %6
%9 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = load i8*, i8** %6
%13 = call i32 @build_sys_str(i8* %9, i32* %8, i32 %10, i8** %11, i8* %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %22, label %15
15: ; preds = %3
%16 = load i32, i32* @stderr
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %19, i32 4096)
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %3
%23 = load i32, i32* %8
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %22
%26 = load i32, i32* @stderr
%27 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%28 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %27)
br label %29
29: ; preds = %25, %22
%30 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%31 = call i64 @system(i8* %30)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %29
br label %34
34: ; preds = %33, %29
br label %35
35: ; preds = %34
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [46 x i8] c"ERROR: %s: buffer of size %d not big enough.\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @xargs(i32 %0, i8** %1, i8* %2) {
%4 = alloca [4096 x i8]
%5 = alloca i32
%6 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%7 = bitcast i32* %5 to i8*
%8 = call i32 @build_sys_str(i8* %6, i32* %5, i32 %0, i8** %1, i8* %2)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %3
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %1
%13 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %12, i32 4096)
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %3
%16 = load i32, i32* %5
%17 = icmp eq i32 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = load i32, i32* @stderr
%20 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %6)
br label %21
21: ; preds = %18, %15
%22 = call i64 @system(i8* %6)
ret void
}