#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ isspace(char);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ system(char *);
int main(int argc, char **argv) {
  char *ptr;
  char buff[256];
  char command[512];
  FILE *in;
  if (argc < 3) {
    fprintf(stderr, "Usage: %s BaseCommandString FileWithList\n", argv[0]);
    exit(1);
  }
  if ((in = fopen(argv[2], "r")) == NULL) {
    fprintf(stderr, "%s: Couldn't open \"%s\"\n", argv[0], argv[2]);
    exit(2);
  }
  while (!feof(in)) {
    fgets(buff, 256, in);
    for (ptr = buff; (*ptr != '\0') && (!isspace(*ptr)); ptr++)
      ;
    *ptr = '\0';
    printf("\nFILE = \"%s\"\n\n", buff);
    if (*buff != '\0') {
      sprintf(command, "%s %s", argv[1], buff);
      system(command);
    }
  }
  fclose(in);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x330,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11eb <main+0x4b>
mov    0x2e16(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe26(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe30(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x328(%rbp)
cmp    $0x0,%rax
jne    1240 <main+0xa0>
mov    0x2dc9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
lea    0xdfd(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x2,%edi
call   10c0 <exit@plt>
jmp    1245 <main+0xa5>
mov    -0x328(%rbp),%rdi
call   1090 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1266 <main+0xc6>
jmp    1341 <main+0x1a1>
lea    -0x120(%rbp),%rdi
mov    -0x328(%rbp),%rdx
mov    $0x100,%esi
call   1070 <fgets@plt>
lea    -0x120(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x329(%rbp)
je     12bb <main+0x11b>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1060 <isspace@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x329(%rbp)
mov    -0x329(%rbp),%al
test   $0x1,%al
jne    12ce <main+0x12e>
jmp    12e4 <main+0x144>
jmp    12d3 <main+0x133>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1289 <main+0xe9>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x120(%rbp),%rsi
lea    0xd4b(%rip),%rdi
call   1050 <printf@plt>
movsbl -0x120(%rbp),%eax
cmp    $0x0,%eax
je     133c <main+0x19c>
lea    -0x320(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    -0x120(%rbp),%rcx
lea    0xd28(%rip),%rsi
call   10b0 <sprintf@plt>
lea    -0x320(%rbp),%rdi
call   1040 <system@plt>
jmp    1245 <main+0xa5>
mov    -0x328(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x330,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x308,%rsp
mov    %rsi,%r14
cmp    $0x2,%edi
jle    129c <main+0xfc>
mov    0x10(%r14),%rdi
lea    0xe62(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     12c0 <main+0x120>
mov    %rax,%r15
mov    %rax,%rdi
call   1090 <feof@plt>
test   %eax,%eax
je     1201 <main+0x61>
mov    %r15,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x308,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsp,%r13
lea    0xe39(%rip),%r12
lea    0x100(%rsp),%rbp
jmp    122c <main+0x8c>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
call   1090 <feof@plt>
test   %eax,%eax
jne    11e5 <main+0x45>
mov    %r13,%rdi
mov    $0x100,%esi
mov    %r15,%rdx
call   1070 <fgets@plt>
mov    (%rsp),%al
mov    %r13,%rbx
test   %al,%al
je     1268 <main+0xc8>
mov    %r13,%rbx
nopl   0x0(%rax)
movsbl %al,%edi
call   1060 <isspace@plt>
test   %eax,%eax
jne    1268 <main+0xc8>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1250 <main+0xb0>
movb   $0x0,(%rbx)
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <printf@plt>
cmpb   $0x0,(%rsp)
je     1220 <main+0x80>
mov    0x8(%r14),%rdx
mov    %rbp,%rdi
lea    0xdc9(%rip),%rsi
mov    %r13,%rcx
call   10b0 <sprintf@plt>
mov    %rbp,%rdi
call   1040 <system@plt>
jmp    1220 <main+0x80>
mov    0x2d3d(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xd51(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    0x2d19(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
mov    0x10(%r14),%rcx
lea    0xd55(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x2,%edi
call   10c0 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [42 x i8] c"Usage: %s BaseCommandString FileWithList\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [24 x i8] c"%s: Couldn't open \22%s\22\0A\00"
@.str.3 = [15 x i8] c"\0AFILE = \22%s\22\0A\0A\00"
@.str.4 = [6 x i8] c"%s %s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%7 = icmp slt i32 %0, 3
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %1
%11 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = tail call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = tail call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i32* %16, null
br i1 %17, label %23, label %18
18: ; preds = %13
%19 = call i32 @feof(i32* %16)
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %54
21: ; preds = %18
%22 = getelementptr inbounds i8*, i8** %1, i64 1
br label %29
23: ; preds = %13
%24 = load i32, i32* @stderr
%25 = load i8*, i8** %1
%26 = load i8*, i8** %14
%27 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %25, i8* %26)
%28 = tail call i32 @exit(i32 2)
unreachable
29: ; preds = %21, %51
%30 = call i32 @fgets(i8* %5, i32 256, i32* %16)
%31 = load i8, i8* %5
%32 = icmp eq i8 %31, 0
br i1 %32, label %42, label %33
33: ; preds = %29, %38
%34 = phi i8 [ %40, %38 ], [ %31, %29 ]
%35 = phi i8* [ %39, %38 ], [ %5, %29 ]
%36 = call i32 @isspace(i8 signext %34)
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %42
38: ; preds = %33
%39 = getelementptr inbounds i8, i8* %35, i64 1
%40 = load i8, i8* %39
%41 = icmp eq i8 %40, 0
br i1 %41, label %42, label %33
42: ; preds = %33, %38, %29
%43 = phi i8* [ %5, %29 ], [ %39, %38 ], [ %35, %33 ]
store i8 0, i8* %43
%44 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %5)
%45 = load i8, i8* %5
%46 = icmp eq i8 %45, 0
br i1 %46, label %51, label %47
47: ; preds = %42
%48 = load i8*, i8** %22
%49 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %48, i8* %5)
%50 = call i32 @system(i8* %6)
br label %51
51: ; preds = %47, %42
%52 = call i32 @feof(i32* %16)
%53 = icmp eq i32 %52, 0
br i1 %53, label %29, label %54
54: ; preds = %51, %18
%55 = call i32 @fclose(i32* %16)
ret i32 0
}