#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*/ dump_group_end();
int /*<<< orphan*/ dump_group_start(char *);
int /*<<< orphan*/ dump_guide(int /*<<< orphan*/ *);
int /*<<< orphan*/ dump_guide_parts(int /*<<< orphan*/);
int /*<<< orphan*/ dump_set_file(int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  dump_set_file(stdout);
  if (argc > 1) {
    int i;
    FILE *fp;
    for (i = 1; i < argc; i++) {
      fp = fopen(argv[i], "r");
      if (!fp) {
        fprintf(stderr, "Couldn't open %s\n", argv[i]);
        exit(-1);
      }
      dump_group_start(argv[i]);
      dump_guide(fp);
      dump_group_end();
      fclose(fp);
    }
  } else {
    dump_group_start("stdin");
    dump_guide_parts(stdin);
    dump_group_end();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e23(%rip),%rax
mov    (%rax),%edi
call   1090 <dump_set_file@plt>
cmpl   $0x1,-0x8(%rbp)
jle    1260 <main+0xd0>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    125b <main+0xcb>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe1c(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1223 <main+0x93>
mov    0x2dd9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xdee(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <dump_group_start@plt>
mov    -0x20(%rbp),%rdi
call   1080 <dump_guide@plt>
mov    $0x0,%al
call   1040 <dump_group_end@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c5 <main+0x35>
jmp    1281 <main+0xf1>
lea    0xdad(%rip),%rdi
call   1060 <dump_group_start@plt>
mov    0x2d75(%rip),%rax
mov    (%rax),%edi
call   10b0 <dump_guide_parts@plt>
mov    $0x0,%al
call   1040 <dump_group_end@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r15
mov    %edi,%ebx
mov    0x2e2b(%rip),%rax
mov    (%rax),%edi
call   1090 <dump_set_file@plt>
cmp    $0x2,%ebx
jl     120f <main+0x7f>
mov    %ebx,%r13d
mov    $0x1,%r12d
lea    0xe3f(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r15,%r12,8),%rdi
mov    %r14,%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     123c <main+0xac>
mov    %rax,%rbx
mov    (%r15,%r12,8),%rdi
call   1060 <dump_group_start@plt>
mov    %rbx,%rdi
call   1080 <dump_guide@plt>
xor    %eax,%eax
call   1040 <dump_group_end@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
add    $0x1,%r12
cmp    %r12,%r13
jne    11d0 <main+0x40>
jmp    1230 <main+0xa0>
lea    0xdfe(%rip),%rdi
call   1060 <dump_group_start@plt>
mov    0x2dc6(%rip),%rax
mov    (%rax),%edi
call   10b0 <dump_guide_parts@plt>
xor    %eax,%eax
call   1040 <dump_group_end@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    0x2d95(%rip),%rax
mov    (%rax),%edi
mov    (%r15,%r12,8),%rdx
lea    0xdb2(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [18 x i8] c"Couldn't open %s\0A\00"
@.str.2 = [6 x i8] c"stdin\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* @stdout
%9 = call i32 @dump_set_file(i32 %8)
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 1
br i1 %11, label %12, label %51
12: ; preds = %2
store i32 1, i32* %6
br label %13
13: ; preds = %47, %12
%14 = load i32, i32* %6
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %50
17: ; preds = %13
%18 = load i8**, i8*** %5
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %23, i32** %7
%24 = load i32*, i32** %7
%25 = icmp ne i32* %24, null
br i1 %25, label %35, label %26
26: ; preds = %17
%27 = load i32, i32* @stderr
%28 = load i8**, i8*** %5
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
%33 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %32)
%34 = call i32 @exit(i32 -1)
unreachable
35: ; preds = %17
%36 = load i8**, i8*** %5
%37 = load i32, i32* %6
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8*, i8** %36, i64 %38
%40 = load i8*, i8** %39
%41 = call i32 @dump_group_start(i8* %40)
%42 = load i32*, i32** %7
%43 = call i32 @dump_guide(i32* %42)
%44 = call i32 (...) @dump_group_end()
%45 = load i32*, i32** %7
%46 = call i32 @fclose(i32* %45)
br label %47
47: ; preds = %35
%48 = load i32, i32* %6
%49 = add nsw i32 %48, 1
store i32 %49, i32* %6
br label %13
50: ; preds = %13
br label %56
51: ; preds = %2
%52 = call i32 @dump_group_start(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%53 = load i32, i32* @stdin
%54 = call i32 @dump_guide_parts(i32 %53)
%55 = call i32 (...) @dump_group_end()
br label %56
56: ; preds = %51, %50
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [18 x i8] c"Couldn't open %s\0A\00"
@.str.2 = [6 x i8] c"stdin\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 @dump_set_file(i32 %3)
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %27
6: ; preds = %2
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %6, %19
%9 = phi i64 [ 1, %6 ], [ %25, %19 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %19
14: ; preds = %8
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %10
%17 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = tail call i32 @exit(i32 -1)
unreachable
19: ; preds = %8
%20 = load i8*, i8** %10
%21 = tail call i32 @dump_group_start(i8* %20)
%22 = tail call i32 @dump_guide(i32* %12)
%23 = tail call i32 (...) @dump_group_end()
%24 = tail call i32 @fclose(i32* %12)
%25 = add nuw nsw i64 %9, 1
%26 = icmp eq i64 %25, %7
br i1 %26, label %32, label %8
27: ; preds = %2
%28 = tail call i32 @dump_group_start(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%29 = load i32, i32* @stdin
%30 = tail call i32 @dump_guide_parts(i32 %29)
%31 = tail call i32 (...) @dump_group_end()
br label %32
32: ; preds = %19, %27
ret i32 0
}