#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*/ var;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, int);
int system(char *);
int main(int argc, char *argv[]) {
  char var[4096], *p;
  FILE *file;
  int i, c;
  p = var;
  *p = '\0';
  for (i = 1; i < argc; i++) {
    if (argv[i][0] == '@') {
      if ((file = fopen(argv[i] + 1, "r")) == NULL) {
        fprintf(stderr, "runnergw: Unable to open '%s'.\n", argv[i]);
        exit(EXIT_FAILURE);
      }
      while ((c = fgetc(file)) != EOF) {
        if (c != '\n')
          *p++ = c;
      }
      fclose(file);
    } else {
      strncat(var, argv[i], sizeof(var) - 1);
      p = var + strlen(var);
    }
    *p++ = ' ';
    *p = '\0';
  }
  return system(var);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1030,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x1010(%rbp),%rax
mov    %rax,-0x1018(%rbp)
mov    -0x1018(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x1,-0x1024(%rbp)
mov    -0x1024(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1335 <main+0x1b5>
mov    -0x10(%rbp),%rax
movslq -0x1024(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x40,%eax
jne    12af <main+0x12f>
mov    -0x10(%rbp),%rax
movslq -0x1024(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
add    $0x1,%rdi
lea    0xe01(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x1020(%rbp)
cmp    $0x0,%rax
jne    1247 <main+0xc7>
mov    0x2dbc(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x1024(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xdce(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x2d90(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
jmp    124c <main+0xcc>
mov    -0x1020(%rbp),%rdi
call   1070 <fgetc@plt>
mov    %eax,-0x1028(%rbp)
mov    0x2d83(%rip),%rcx
cmp    (%rcx),%eax
je     129e <main+0x11e>
cmpl   $0xa,-0x1028(%rbp)
je     1299 <main+0x119>
mov    -0x1028(%rbp),%eax
mov    %al,%cl
mov    -0x1018(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x1018(%rbp)
mov    %cl,(%rax)
jmp    124c <main+0xcc>
mov    -0x1020(%rbp),%rdi
call   1030 <fclose@plt>
jmp    12ff <main+0x17f>
lea    -0x1010(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x1024(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    $0xfff,%edx
call   1060 <strncat@plt>
lea    -0x1010(%rbp),%rax
mov    %rax,-0x1030(%rbp)
lea    -0x1010(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x1030(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x1018(%rbp)
mov    -0x1018(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x1018(%rbp)
movb   $0x20,(%rax)
mov    -0x1018(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x1024(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1024(%rbp)
jmp    11bb <main+0x3b>
lea    -0x1010(%rbp),%rdi
call   1050 <system@plt>
add    $0x1030,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1008,%rsp
movb   $0x0,(%rsp)
cmp    $0x2,%edi
jl     124a <main+0xca>
mov    %rsi,%r12
mov    %rsp,%r14
mov    %edi,%ebp
mov    $0x1,%r13d
mov    0x2e35(%rip),%r15
jmp    11f1 <main+0x71>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xfff,%edx
call   1060 <strncat@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
lea    (%rsp,%rax,1),%r14
movw   $0x20,(%r14)
add    $0x1,%r14
add    $0x1,%r13
cmp    %rbp,%r13
je     124a <main+0xca>
mov    (%r12,%r13,8),%rsi
cmpb   $0x40,(%rsi)
jne    11c0 <main+0x40>
add    $0x1,%rsi
mov    %rsi,%rdi
lea    0xdf8(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     1264 <main+0xe4>
mov    %rax,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1070 <fgetc@plt>
cmp    (%r15),%eax
je     1240 <main+0xc0>
cmp    $0xa,%eax
je     1220 <main+0xa0>
mov    %al,(%r14)
add    $0x1,%r14
jmp    1220 <main+0xa0>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <fclose@plt>
jmp    11de <main+0x5e>
mov    %rsp,%rdi
call   1050 <system@plt>
add    $0x1008,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r13d,%eax
mov    0x2d6a(%rip),%rcx
mov    (%rcx),%edi
mov    (%r12,%rax,8),%rdx
lea    0xd87(%rip),%rsi
call   1080 <fprintf@plt>
mov    0x2d49(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [32 x i8] c"runnergw: Unable to open '%s'.\0A\00"
@EXIT_FAILURE = global i32 0
@EOF = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4096 x i8]
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
store i8* %11, i8** %7
%12 = load i8*, i8** %7
store i8 0, i8* %12
store i32 1, i32* %9
br label %13
13: ; preds = %81, %2
%14 = load i32, i32* %9
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %84
17: ; preds = %13
%18 = load i8**, i8*** %5
%19 = load i32, i32* %9
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = getelementptr inbounds i8, i8* %22, i64 0
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 64
br i1 %26, label %27, label %64
27: ; preds = %17
%28 = load i8**, i8*** %5
%29 = load i32, i32* %9
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
%33 = getelementptr inbounds i8, i8* %32, i64 1
%34 = call i32* @fopen(i8* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %34, i32** %8
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %46
36: ; preds = %27
%37 = load i32, i32* @stderr
%38 = load i8**, i8*** %5
%39 = load i32, i32* %9
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8*, i8** %38, i64 %40
%42 = load i8*, i8** %41
%43 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %42)
%44 = load i32, i32* @EXIT_FAILURE
%45 = call i32 @exit(i32 %44)
unreachable
46: ; preds = %27
br label %47
47: ; preds = %60, %46
%48 = load i32*, i32** %8
%49 = call i32 @fgetc(i32* %48)
store i32 %49, i32* %10
%50 = load i32, i32* @EOF
%51 = icmp ne i32 %49, %50
br i1 %51, label %52, label %61
52: ; preds = %47
%53 = load i32, i32* %10
%54 = icmp ne i32 %53, 10
br i1 %54, label %55, label %60
55: ; preds = %52
%56 = load i32, i32* %10
%57 = trunc i32 %56 to i8
%58 = load i8*, i8** %7
%59 = getelementptr inbounds i8, i8* %58, i32 1
store i8* %59, i8** %7
store i8 %57, i8* %58
br label %60
60: ; preds = %55, %52
br label %47
61: ; preds = %47
%62 = load i32*, i32** %8
%63 = call i32 @fclose(i32* %62)
br label %77
64: ; preds = %17
%65 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%66 = load i8**, i8*** %5
%67 = load i32, i32* %9
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8*, i8** %66, i64 %68
%70 = load i8*, i8** %69
%71 = call i32 @strncat(i8* %65, i8* %70, i32 4095)
%72 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%73 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%74 = call i32 @strlen(i8* %73)
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i8, i8* %72, i64 %75
store i8* %76, i8** %7
br label %77
77: ; preds = %64, %61
%78 = load i8*, i8** %7
%79 = getelementptr inbounds i8, i8* %78, i32 1
store i8* %79, i8** %7
store i8 32, i8* %78
%80 = load i8*, i8** %7
store i8 0, i8* %80
br label %81
81: ; preds = %77
%82 = load i32, i32* %9
%83 = add nsw i32 %82, 1
store i32 %83, i32* %9
br label %13
84: ; preds = %13
%85 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%86 = call i32 @system(i8* %85)
ret i32 %86
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [32 x i8] c"runnergw: Unable to open '%s'.\0A\00"
@EXIT_FAILURE = global i32 0
@EOF = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4096 x i8]
%4 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
store i8 0, i8* %4
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %56
6: ; preds = %2
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %6, %51
%9 = phi i64 [ 1, %6 ], [ %54, %51 ]
%10 = phi i8* [ %4, %6 ], [ %53, %51 ]
%11 = getelementptr inbounds i8*, i8** %1, i64 %9
%12 = load i8*, i8** %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 64
br i1 %14, label %15, label %46
15: ; preds = %8
%16 = getelementptr inbounds i8, i8* %12, i64 1
%17 = call i32* @fopen(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%18 = icmp eq i32* %17, null
br i1 %18, label %23, label %19
19: ; preds = %15
%20 = call i32 @fgetc(i32* %17)
%21 = load i32, i32* @EOF
%22 = icmp eq i32 %20, %21
br i1 %22, label %43, label %31
23: ; preds = %15
%24 = and i64 %9, 4294967295
%25 = getelementptr inbounds i8*, i8** %1, i64 %24
%26 = load i32, i32* @stderr
%27 = load i8*, i8** %25
%28 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %27)
%29 = load i32, i32* @EXIT_FAILURE
%30 = call i32 @exit(i32 %29)
unreachable
31: ; preds = %19, %38
%32 = phi i32 [ %40, %38 ], [ %20, %19 ]
%33 = phi i8* [ %39, %38 ], [ %10, %19 ]
%34 = icmp eq i32 %32, 10
br i1 %34, label %38, label %35
35: ; preds = %31
%36 = trunc i32 %32 to i8
%37 = getelementptr inbounds i8, i8* %33, i64 1
store i8 %36, i8* %33
br label %38
38: ; preds = %35, %31
%39 = phi i8* [ %37, %35 ], [ %33, %31 ]
%40 = call i32 @fgetc(i32* %17)
%41 = load i32, i32* @EOF
%42 = icmp eq i32 %40, %41
br i1 %42, label %43, label %31
43: ; preds = %38, %19
%44 = phi i8* [ %10, %19 ], [ %39, %38 ]
%45 = call i32 @fclose(i32* %17)
br label %51
46: ; preds = %8
%47 = call i32 @strncat(i8* %4, i8* %12, i32 4095)
%48 = call i32 @strlen(i8* %4)
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 %49
br label %51
51: ; preds = %46, %43
%52 = phi i8* [ %44, %43 ], [ %50, %46 ]
%53 = getelementptr inbounds i8, i8* %52, i64 1
store i8 32, i8* %52
store i8 0, i8* %53
%54 = add nuw nsw i64 %9, 1
%55 = icmp eq i64 %54, %7
br i1 %55, label %56, label %8
56: ; preds = %51, %2
%57 = call i32 @system(i8* %4)
ret i32 %57
}