#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*/ *fopen(char *, char *);
int /*<<< orphan*/ slow_cat(int /*<<< orphan*/ *);
int /*<<< orphan*/ *stdin;
int main(int argc, char *argv[]) {
  FILE *fip;
  int c, cntr = 1;
  if (argc > cntr)
    while (cntr < argc) {
      fip = fopen(argv[cntr++], "r");
      slow_cat(fip);
    }
  else
    slow_cat(stdin);
  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)
movl   $0x1,-0x20(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    1193 <main+0x73>
jmp    114e <main+0x2e>
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    118e <main+0x6e>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x20(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe89(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <slow_cat@plt>
jmp    114e <main+0x2e>
jmp    11a2 <main+0x82>
mov    0x2e4e(%rip),%rax
mov    (%rax),%rdi
call   1030 <slow_cat@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     115f <main+0x3f>
mov    %rsi,%r15
mov    %edi,%r12d
mov    $0x1,%ebx
lea    0xec1(%rip),%r14
nop
mov    (%r15,%rbx,8),%rdi
add    $0x1,%rbx
mov    %r14,%rsi
call   1040 <fopen@plt>
mov    %rax,%rdi
call   1030 <slow_cat@plt>
cmp    %rbx,%r12
jne    1140 <main+0x20>
jmp    116e <main+0x4e>
mov    0x2e82(%rip),%rax
mov    (%rax),%rdi
call   1030 <slow_cat@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\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
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %8
%9 = load i32, i32* %4
%10 = load i32, i32* %8
%11 = icmp sgt i32 %9, %10
br i1 %11, label %12, label %28
12: ; preds = %2
br label %13
13: ; preds = %17, %12
%14 = load i32, i32* %8
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %27
17: ; preds = %13
%18 = load i8**, i8*** %5
%19 = load i32, i32* %8
%20 = add nsw i32 %19, 1
store i32 %20, i32* %8
%21 = sext i32 %19 to i64
%22 = getelementptr inbounds i8*, i8** %18, i64 %21
%23 = load i8*, i8** %22
%24 = call i32* @fopen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %24, i32** %6
%25 = load i32*, i32** %6
%26 = call i32 @slow_cat(i32* %25)
br label %13
27: ; preds = %13
br label %31
28: ; preds = %2
%29 = load i32*, i32** @stdin
%30 = call i32 @slow_cat(i32* %29)
br label %31
31: ; preds = %28, %27
ret i32 0
}

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