#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_FAILURE;
int /*<<< orphan*/ do_more(int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ *stdin;
int main(int argc, char *argv[]) {
  FILE *fp;
  if (argc == 1) {
    do_more(stdin);
  } else {
    while (--argc) {
      if ((fp = fopen(*++argv, "r")) != NULL) {
        do_more(fp);
        fclose(fp);
      } else {
        exit(EXIT_FAILURE);
      }
    }
  }
  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)
cmpl   $0x1,-0x8(%rbp)
jne    1174 <main+0x34>
mov    0x2e81(%rip),%rax
mov    (%rax),%rdi
call   1040 <do_more@plt>
jmp    11e7 <main+0xa7>
jmp    1179 <main+0x39>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     11e2 <main+0xa2>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    0xe5b(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     11cf <main+0x8f>
mov    -0x18(%rbp),%rdi
call   1040 <do_more@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
jmp    11dd <main+0x9d>
mov    0x2e02(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
jmp    1179 <main+0x39>
jmp    11e7 <main+0xa7>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
cmp    $0x1,%edi
jne    115f <main+0x1f>
mov    0x2e93(%rip),%rax
mov    (%rax),%rdi
call   1040 <do_more@plt>
jmp    11ad <main+0x6d>
mov    %rsi,%r15
mov    %edi,%r12d
mov    $0x1,%r13d
lea    0xe8e(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r15,%r13,8),%rdi
mov    %r14,%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     11b9 <main+0x79>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <do_more@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
add    $0x1,%r13
cmp    %r13d,%r12d
jne    1180 <main+0x40>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stdin = global i32* null
@.str = [2 x i8] c"r\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i32*, i32** @stdin
%11 = call i32 @do_more(i32* %10)
br label %33
12: ; preds = %2
br label %13
13: ; preds = %31, %12
%14 = load i32, i32* %4
%15 = add nsw i32 %14, -1
store i32 %15, i32* %4
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %32
17: ; preds = %13
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i32 1
store i8** %19, i8*** %5
%20 = load i8*, i8** %19
%21 = call i32* @fopen(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %21, i32** %6
%22 = icmp ne i32* %21, null
br i1 %22, label %23, label %28
23: ; preds = %17
%24 = load i32*, i32** %6
%25 = call i32 @do_more(i32* %24)
%26 = load i32*, i32** %6
%27 = call i32 @fclose(i32* %26)
br label %31
28: ; preds = %17
%29 = load i32, i32* @EXIT_FAILURE
%30 = call i32 @exit(i32 %29)
unreachable
31: ; preds = %23
br label %13
32: ; preds = %13
br label %33
33: ; preds = %32, %9
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32* null
@.str = [2 x i8] c"r\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = add nsw i32 %0, -1
br label %9
6: ; preds = %2
%7 = load i32*, i32** @stdin
%8 = tail call i32 @do_more(i32* %7)
br label %24
9: ; preds = %4, %16
%10 = phi i32 [ %19, %16 ], [ %5, %4 ]
%11 = phi i8** [ %12, %16 ], [ %1, %4 ]
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32* @fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i32* %14, null
br i1 %15, label %21, label %16
16: ; preds = %9
%17 = tail call i32 @do_more(i32* %14)
%18 = tail call i32 @fclose(i32* %14)
%19 = add nsw i32 %10, -1
%20 = icmp eq i32 %19, 0
br i1 %20, label %24, label %9
21: ; preds = %9
%22 = load i32, i32* @EXIT_FAILURE
%23 = tail call i32 @exit(i32 %22)
unreachable
24: ; preds = %16, %6
ret i32 0
}