#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_programset_file(int /*<<< orphan*/ *);
int /*<<< orphan*/ dump_set_file(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) {
  int i;
  dump_set_file(stdout);
  if (argc > 1) {
    for (i = 1; i < argc; i++) {
      FILE *fp;
      fp = fopen(argv[i], "r");
      if (!fp) {
        fprintf(stderr, "Couldn't open %s\n", argv[i]);
        return -1;
      }
      dump_group_start(argv[i]);
      dump_programset_file(fp);
      dump_group_end();
    }
  } else {
    dump_group_start("stdin");
    dump_programset_file(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    0x2e53(%rip),%rax
mov    (%rax),%edi
call   1080 <dump_set_file@plt>
cmpl   $0x1,-0x8(%rbp)
jle    1229 <main+0xc9>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1224 <main+0xc4>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe4c(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11f5 <main+0x95>
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe1e(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1252 <main+0xf2>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <dump_group_start@plt>
mov    -0x20(%rbp),%rdi
call   1040 <dump_programset_file@plt>
mov    $0x0,%al
call   1030 <dump_group_end@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1195 <main+0x35>
jmp    124b <main+0xeb>
lea    0xde4(%rip),%rdi
call   1060 <dump_group_start@plt>
mov    0x2dac(%rip),%rax
mov    (%rax),%rdi
call   1040 <dump_programset_file@plt>
mov    $0x0,%al
call   1030 <dump_group_end@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r15
mov    %edi,%ebp
mov    0x2e5c(%rip),%rax
mov    (%rax),%edi
call   1080 <dump_set_file@plt>
cmp    $0x2,%ebp
jl     11c9 <main+0x69>
mov    %ebp,%r12d
mov    $0x1,%ebx
lea    0xe71(%rip),%r14
nop
mov    (%r15,%rbx,8),%rdi
mov    %r14,%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     11ef <main+0x8f>
mov    %rax,%rbp
mov    (%r15,%rbx,8),%rdi
call   1060 <dump_group_start@plt>
mov    %rbp,%rdi
call   1040 <dump_programset_file@plt>
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <dump_group_end@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1190 <main+0x30>
jmp    120d <main+0xad>
lea    0xe44(%rip),%rdi
call   1060 <dump_group_start@plt>
mov    0x2e0c(%rip),%rax
mov    (%rax),%rdi
call   1040 <dump_programset_file@plt>
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <dump_group_end@plt>
jmp    120d <main+0xad>
mov    0x2de2(%rip),%rax
mov    (%rax),%edi
mov    (%r15,%rbx,8),%rdx
lea    0xdff(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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* null
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 %48
12: ; preds = %2
store i32 1, i32* %6
br label %13
13: ; preds = %44, %12
%14 = load i32, i32* %6
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %47
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 %34, 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)
store i32 -1, i32* %3
br label %54
34: ; preds = %17
%35 = load i8**, i8*** %5
%36 = load i32, i32* %6
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8*, i8** %35, i64 %37
%39 = load i8*, i8** %38
%40 = call i32 @dump_group_start(i8* %39)
%41 = load i32*, i32** %7
%42 = call i32 @dump_programset_file(i32* %41)
%43 = call i32 (...) @dump_group_end()
br label %44
44: ; preds = %34
%45 = load i32, i32* %6
%46 = add nsw i32 %45, 1
store i32 %46, i32* %6
br label %13
47: ; preds = %13
br label %53
48: ; preds = %2
%49 = call i32 @dump_group_start(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%50 = load i32*, i32** @stdin
%51 = call i32 @dump_programset_file(i32* %50)
%52 = call i32 (...) @dump_group_end()
br label %53
53: ; preds = %48, %47
store i32 0, i32* %3
br label %54
54: ; preds = %53, %26
%55 = load i32, i32* %3
ret i32 %55
}

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* null
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 %25
6: ; preds = %2
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %6, %18
%9 = phi i64 [ 1, %6 ], [ %23, %18 ]
%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 %18
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)
br label %30
18: ; preds = %8
%19 = load i8*, i8** %10
%20 = tail call i32 @dump_group_start(i8* %19)
%21 = tail call i32 @dump_programset_file(i32* %12)
%22 = tail call i32 (...) @dump_group_end()
%23 = add nuw nsw i64 %9, 1
%24 = icmp eq i64 %23, %7
br i1 %24, label %30, label %8
25: ; preds = %2
%26 = tail call i32 @dump_group_start(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%27 = load i32*, i32** @stdin
%28 = tail call i32 @dump_programset_file(i32* %27)
%29 = tail call i32 (...) @dump_group_end()
br label %30
30: ; preds = %18, %14, %25
%31 = phi i32 [ 0, %25 ], [ -1, %14 ], [ 0, %18 ]
ret i32 %31
}