#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(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int getopt(int, char **, char *);
int /*<<< orphan*/ optarg;
int optind;
int /*<<< orphan*/ slowcat(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ *stdin;
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  int opt, baud = 300;
  FILE *f;
  while ((opt = getopt(argc, argv, "b:")) != -1)
    if (opt == 'b')
      baud = atoi(optarg);
  if (optind >= argc)
    slowcat(stdin, baud);
  while (optind < argc) {
    if (strcmp(argv[optind], "-") == 0)
      slowcat(stdin, baud);
    else {
      if ((f = fopen(argv[optind], "rb")) != NULL) {
        slowcat(f, baud);
        fclose(f);
      }
    }
    ++optind;
  }
  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   $0x12c,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe75(%rip),%rdx
call   1070 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     11bc <main+0x5c>
cmpl   $0x62,-0x14(%rbp)
jne    11b7 <main+0x57>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
call   1080 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    117d <main+0x1d>
mov    0x2e15(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jl     11e0 <main+0x80>
mov    0x2e0b(%rip),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%esi
call   1050 <slowcat@plt>
jmp    11e5 <main+0x85>
mov    0x2dec(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    1296 <main+0x136>
mov    -0x10(%rbp),%rax
mov    0x2dd6(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdf3(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1236 <main+0xd6>
mov    0x2dba(%rip),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%esi
call   1050 <slowcat@plt>
jmp    127c <main+0x11c>
mov    -0x10(%rbp),%rax
mov    0x2d97(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdb6(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     1277 <main+0x117>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1050 <slowcat@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
jmp    127c <main+0x11c>
mov    0x2d55(%rip),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    0x2d49(%rip),%rax
mov    %ecx,(%rax)
jmp    11e5 <main+0x85>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%r13d
mov    $0x12c,%r14d
lea    0xe82(%rip),%r15
mov    0x2e73(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13d,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1070 <getopt@plt>
cmp    $0xffffffff,%eax
je     11b5 <main+0x55>
cmp    $0x62,%eax
jne    1190 <main+0x30>
mov    0x0(%rbp),%edi
call   1080 <atoi@plt>
mov    %eax,%r14d
jmp    1190 <main+0x30>
mov    0x2e1c(%rip),%r12
mov    (%r12),%eax
cmp    %r13d,%eax
jl     11db <main+0x7b>
mov    0x2e14(%rip),%rax
mov    (%rax),%rdi
mov    %r14d,%esi
call   1050 <slowcat@plt>
mov    (%r12),%eax
cmp    %r13d,%eax
jge    1256 <main+0xf6>
lea    0xe1c(%rip),%r15
jmp    1212 <main+0xb2>
nopl   0x0(%rax)
mov    0x2de9(%rip),%rax
mov    (%rax),%rdi
mov    %r14d,%esi
call   1050 <slowcat@plt>
mov    (%r12),%eax
add    $0x1,%eax
mov    %eax,(%r12)
cmp    %r13d,%eax
jge    1256 <main+0xf6>
cltq
mov    (%rbx,%rax,8),%rdi
mov    %r15,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11f0 <main+0x90>
movslq (%r12),%rax
mov    (%rbx,%rax,8),%rdi
lea    0xdd1(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     1202 <main+0xa2>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %r14d,%esi
call   1050 <slowcat@plt>
mov    %rbp,%rdi
call   1030 <fclose@plt>
jmp    1202 <main+0xa2>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"b:\00"
@optarg = global i32 0
@optind = global i32 0
@stdin = global i32* null
@.str.1 = [2 x i8] c"-\00"
@.str.2 = [3 x i8] c"rb\00"
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 300, i32* %7
br label %9
9: ; preds = %20, %2
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @getopt(i32 %10, i8** %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %12, i32* %6
%13 = icmp ne i32 %12, -1
br i1 %13, label %14, label %21
14: ; preds = %9
%15 = load i32, i32* %6
%16 = icmp eq i32 %15, 98
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* @optarg
%19 = call i32 @atoi(i32 %18)
store i32 %19, i32* %7
br label %20
20: ; preds = %17, %14
br label %9
21: ; preds = %9
%22 = load i32, i32* @optind
%23 = load i32, i32* %4
%24 = icmp sge i32 %22, %23
br i1 %24, label %25, label %29
25: ; preds = %21
%26 = load i32*, i32** @stdin
%27 = load i32, i32* %7
%28 = call i32 @slowcat(i32* %26, i32 %27)
br label %29
29: ; preds = %25, %21
br label %30
30: ; preds = %61, %29
%31 = load i32, i32* @optind
%32 = load i32, i32* %4
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %64
34: ; preds = %30
%35 = load i8**, i8*** %5
%36 = load i32, i32* @optind
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8*, i8** %35, i64 %37
%39 = load i8*, i8** %38
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %46
42: ; preds = %34
%43 = load i32*, i32** @stdin
%44 = load i32, i32* %7
%45 = call i32 @slowcat(i32* %43, i32 %44)
br label %61
46: ; preds = %34
%47 = load i8**, i8*** %5
%48 = load i32, i32* @optind
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8*, i8** %47, i64 %49
%51 = load i8*, i8** %50
%52 = call i32* @fopen(i8* %51, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %52, i32** %8
%53 = icmp ne i32* %52, null
br i1 %53, label %54, label %60
54: ; preds = %46
%55 = load i32*, i32** %8
%56 = load i32, i32* %7
%57 = call i32 @slowcat(i32* %55, i32 %56)
%58 = load i32*, i32** %8
%59 = call i32 @fclose(i32* %58)
br label %60
60: ; preds = %54, %46
br label %61
61: ; preds = %60, %42
%62 = load i32, i32* @optind
%63 = add nsw i32 %62, 1
store i32 %63, i32* @optind
br label %30
64: ; preds = %30
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"b:\00"
@optarg = global i32 0
@optind = global i32 0
@stdin = global i32* null
@.str.1 = [2 x i8] c"-\00"
@.str.2 = [3 x i8] c"rb\00"
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %7, %2
%4 = phi i32 [ %9, %7 ], [ 300, %2 ]
br label %5
5: ; preds = %3, %5
%6 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
switch i32 %6, label %5 [
i32 -1, label %10
i32 98, label %7
]
7: ; preds = %5
%8 = load i32, i32* @optarg
%9 = tail call i32 @atoi(i32 %8)
br label %3
10: ; preds = %5
%11 = load i32, i32* @optind
%12 = icmp slt i32 %11, %0
br i1 %12, label %17, label %13
13: ; preds = %10
%14 = load i32*, i32** @stdin
%15 = tail call i32 @slowcat(i32* %14, i32 %4)
%16 = load i32, i32* @optind
br label %17
17: ; preds = %13, %10
%18 = phi i32 [ %16, %13 ], [ %11, %10 ]
%19 = icmp slt i32 %18, %0
br i1 %19, label %20, label %44
20: ; preds = %17, %40
%21 = phi i32 [ %42, %40 ], [ %18, %17 ]
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %1, i64 %22
%24 = load i8*, i8** %23
%25 = tail call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %20
%28 = load i32*, i32** @stdin
%29 = tail call i32 @slowcat(i32* %28, i32 %4)
br label %40
30: ; preds = %20
%31 = load i32, i32* @optind
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %1, i64 %32
%34 = load i8*, i8** %33
%35 = tail call i32* @fopen(i8* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%36 = icmp eq i32* %35, null
br i1 %36, label %40, label %37
37: ; preds = %30
%38 = tail call i32 @slowcat(i32* %35, i32 %4)
%39 = tail call i32 @fclose(i32* %35)
br label %40
40: ; preds = %30, %37, %27
%41 = load i32, i32* @optind
%42 = add nsw i32 %41, 1
store i32 %42, i32* @optind
%43 = icmp slt i32 %42, %0
br i1 %43, label %20, label %44
44: ; preds = %40, %17
ret i32 0
}