#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 atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ process(char *, int);
char *strchr(char *, char);
int main(int argc, char **argv) {
  FILE *ff = fopen("all_string_files", "r");
  char buffer[128];
  int width = (argc == 1 ? 85 : atoi(argv[1]));
  if (ff == NULL) {
    printf("No list of files\n");
    exit(1);
  }
  while (1) {
    char *p;
    if (fgets(buffer, 127, ff) == NULL)
      break;
    p = strchr(buffer, '\n');
    if (p)
      *p = '\0';
    process(buffer, width);
  }
  fclose(ff);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe60(%rip),%rdi
lea    0xe6a(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    11ca <main+0x4a>
mov    $0x55,%eax
mov    %eax,-0xb4(%rbp)
jmp    11dd <main+0x5d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0xb4(%rbp)
mov    -0xb4(%rbp),%eax
mov    %eax,-0xa4(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    120a <main+0x8a>
lea    0xe18(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
jmp    120f <main+0x8f>
lea    -0xa0(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x7f,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
jne    1233 <main+0xb3>
jmp    127a <main+0xfa>
lea    -0xa0(%rbp),%rdi
mov    $0xa,%esi
call   1040 <strchr@plt>
mov    %rax,-0xb0(%rbp)
cmpq   $0x0,-0xb0(%rbp)
je     1263 <main+0xe3>
mov    -0xb0(%rbp),%rax
movb   $0x0,(%rax)
lea    -0xa0(%rbp),%rdi
mov    -0xa4(%rbp),%esi
call   1060 <process@plt>
jmp    120f <main+0x8f>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %rsi,%r15
mov    %edi,%ebp
lea    0xe67(%rip),%rdi
lea    0xe71(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
mov    $0x55,%r14d
cmp    $0x1,%ebp
je     11bf <main+0x3f>
mov    0x8(%r15),%rdi
call   1090 <atoi@plt>
mov    %eax,%r14d
test   %rbx,%rbx
je     122f <main+0xaf>
mov    %rsp,%rdi
mov    $0x7f,%esi
mov    %rbx,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     1217 <main+0x97>
mov    %rsp,%rbp
jmp    1200 <main+0x80>
xchg   %ax,%ax
mov    %rbp,%rdi
mov    %r14d,%esi
call   1060 <process@plt>
mov    %rbp,%rdi
mov    $0x7f,%esi
mov    %rbx,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     1217 <main+0x97>
mov    %rbp,%rdi
mov    $0xa,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     11e0 <main+0x60>
movb   $0x0,(%rax)
jmp    11e0 <main+0x60>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xddd(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"all_string_files\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [18 x i8] c"No list of files\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [128 x i8]
%8 = alloca i32
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %10, i32** %6
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %14
13: ; preds = %2
br label %19
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @atoi(i8* %17)
br label %19
19: ; preds = %14, %13
%20 = phi i32 [ 85, %13 ], [ %18, %14 ]
store i32 %20, i32* %8
%21 = load i32*, i32** %6
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %19
br label %27
27: ; preds = %26, %40
%28 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%29 = load i32*, i32** %6
%30 = call i32* @fgets(i8* %28, i32 127, i32* %29)
%31 = icmp eq i32* %30, null
br i1 %31, label %32, label %33
32: ; preds = %27
br label %44
33: ; preds = %27
%34 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%35 = call i8* @strchr(i8* %34, i8 signext 10)
store i8* %35, i8** %9
%36 = load i8*, i8** %9
%37 = icmp ne i8* %36, null
br i1 %37, label %38, label %40
38: ; preds = %33
%39 = load i8*, i8** %9
store i8 0, i8* %39
br label %40
40: ; preds = %38, %33
%41 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%42 = load i32, i32* %8
%43 = call i32 @process(i8* %41, i32 %42)
br label %27
44: ; preds = %32
%45 = load i32*, i32** %6
%46 = call i32 @fclose(i32* %45)
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
@.str = [17 x i8] c"all_string_files\00"
@.str.1 = [2 x i8] c"r\00"
@str = [17 x i8] c"No list of files\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [128 x i8]
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%6 = icmp eq i32 %0, 1
br i1 %6, label %11, label %7
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
br label %11
11: ; preds = %2, %7
%12 = phi i32 [ %10, %7 ], [ 85, %2 ]
%13 = icmp eq i32* %4, null
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = call i32* @fgets(i8* %5, i32 127, i32* %4)
%16 = icmp eq i32* %15, null
br i1 %16, label %28, label %20
17: ; preds = %11
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%19 = tail call i32 @exit(i32 1)
unreachable
20: ; preds = %14, %24
%21 = call i8* @strchr(i8* %5, i8 signext 10)
%22 = icmp eq i8* %21, null
br i1 %22, label %24, label %23
23: ; preds = %20
store i8 0, i8* %21
br label %24
24: ; preds = %20, %23
%25 = call i32 @process(i8* %5, i32 %12)
%26 = call i32* @fgets(i8* %5, i32 127, i32* %4)
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %20
28: ; preds = %24, %14
%29 = call i32 @fclose(i32* %4)
ret i32 0
}