#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 */

/* Variables and functions */
int EOF;
unsigned int atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int getopt(int, char **, char *);
int /*<<< orphan*/ init();
int /*<<< orphan*/ multi_read_to_normal_write(char *, unsigned int,
                                              unsigned int, unsigned int);
int /*<<< orphan*/ normal_read_to_multiple_write(char *, int, unsigned int,
                                                 unsigned int);
char *optarg;
scalar_t__ optopt;
int /*<<< orphan*/ show_version(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ usage(char *);
int main(int argc, char *argv[]) {
  signed int lu;
  int split_mode = 0;
  char *splitted_file = NULL;
  int sync_mode = 0;
  unsigned int bs = 0;
  unsigned int rate = 0;
  unsigned int count = 0;
  while ((lu = getopt(argc, argv, "-sb:hvr:c:")) != EOF) {
    switch (lu) {
    case 1:
      if (split_mode == 0) {
        if (strcmp("split_output", optarg) == 0)
          split_mode = 1;
        else if (strcmp("split_input", optarg) == 0)
          split_mode = 2;
        else {
          fprintf(stderr, "Unknown mode %s. Please use either %s or %s\n",
                  optarg, "split_output", "split_input");
          return 1;
        }
      } else
        splitted_file = optarg;
      break;
    case 's':
      sync_mode = 1;
      break;
    case 'b':
      bs = atoi(optarg);
      break;
    case 'r':
      rate = atoi(optarg);
      break;
    case 'c':
      count = atoi(optarg);
      break;
    case 'h':
      usage(argv[0]);
      return 0;
    case 'v':
      show_version(argv[0]);
      return 0;
    case ':':
      fprintf(stderr, "Missing parameter to option -%c\n", (char)optopt);
      return 1;
    case '?':
      fprintf(stderr, "Ignoring unknown option -%c\n", (char)optopt);
      return 1;
    }
  }
  if (splitted_file == NULL) {
    fprintf(stderr, "Missing filename argument\n");
    return 1;
  }
  if (count > 0 && split_mode != 2) {
    fprintf(stderr, "-c option is only available in split_input mode\n");
    return 1;
  }
  if (sync_mode == 1 && split_mode != 1) {
    fprintf(stderr, "-s option is only available in split_output mode\n");
    return 1;
  }
  if (!init())
    return 2;
  switch (split_mode) {
  case 1:
    normal_read_to_multiple_write(splitted_file, sync_mode, bs, rate);
    break;
  case 2:
    multi_read_to_normal_write(splitted_file, bs, rate, count);
    break;
  default:
    fprintf(stderr, "missing read mode argument. Please user either %s or %s\n",
            "split_output", "split_input");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe21(%rip),%rdx
call   10a0 <getopt@plt>
mov    %eax,-0x14(%rbp)
mov    0x2dea(%rip),%rcx
cmp    (%rcx),%eax
je     1430 <main+0x2a0>
mov    -0x14(%rbp),%eax
mov    %eax,-0x34(%rbp)
sub    $0x1,%eax
je     1292 <main+0x102>
jmp    120a <main+0x7a>
mov    -0x34(%rbp),%eax
sub    $0x3a,%eax
je     13cb <main+0x23b>
jmp    121b <main+0x8b>
mov    -0x34(%rbp),%eax
sub    $0x3f,%eax
je     13fb <main+0x26b>
jmp    122c <main+0x9c>
mov    -0x34(%rbp),%eax
sub    $0x62,%eax
je     1356 <main+0x1c6>
jmp    123d <main+0xad>
mov    -0x34(%rbp),%eax
sub    $0x63,%eax
je     1384 <main+0x1f4>
jmp    124e <main+0xbe>
mov    -0x34(%rbp),%eax
sub    $0x68,%eax
je     139b <main+0x20b>
jmp    125f <main+0xcf>
mov    -0x34(%rbp),%eax
sub    $0x72,%eax
je     136d <main+0x1dd>
jmp    1270 <main+0xe0>
mov    -0x34(%rbp),%eax
sub    $0x73,%eax
je     134a <main+0x1ba>
jmp    1281 <main+0xf1>
mov    -0x34(%rbp),%eax
sub    $0x76,%eax
je     13b3 <main+0x223>
jmp    142b <main+0x29b>
cmpl   $0x0,-0x18(%rbp)
jne    1337 <main+0x1a7>
mov    0x2d55(%rip),%rax
mov    (%rax),%rsi
lea    0xd5e(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    12c7 <main+0x137>
movl   $0x1,-0x18(%rbp)
jmp    1332 <main+0x1a2>
mov    0x2d2a(%rip),%rax
mov    (%rax),%rsi
lea    0xd40(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    12f2 <main+0x162>
movl   $0x2,-0x18(%rbp)
jmp    132d <main+0x19d>
mov    0x2ccf(%rip),%rax
mov    (%rax),%edi
mov    0x2cf6(%rip),%rax
mov    (%rax),%rdx
lea    0xd18(%rip),%rsi
lea    0xcf8(%rip),%rcx
lea    0xcfe(%rip),%r8
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1573 <main+0x3e3>
jmp    1332 <main+0x1a2>
jmp    1345 <main+0x1b5>
mov    0x2cba(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    142b <main+0x29b>
movl   $0x1,-0x24(%rbp)
jmp    142b <main+0x29b>
mov    0x2c9b(%rip),%rax
mov    (%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x28(%rbp)
jmp    142b <main+0x29b>
mov    0x2c84(%rip),%rax
mov    (%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x2c(%rbp)
jmp    142b <main+0x29b>
mov    0x2c6d(%rip),%rax
mov    (%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x30(%rbp)
jmp    142b <main+0x29b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    1573 <main+0x3e3>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <show_version@plt>
movl   $0x0,-0x4(%rbp)
jmp    1573 <main+0x3e3>
mov    0x2bf6(%rip),%rax
mov    (%rax),%edi
mov    0x2c05(%rip),%rax
mov    (%rax),%rax
movsbl %al,%edx
lea    0xc69(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1573 <main+0x3e3>
mov    0x2bc6(%rip),%rax
mov    (%rax),%edi
mov    0x2bd5(%rip),%rax
mov    (%rax),%rax
movsbl %al,%edx
lea    0xc5a(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1573 <main+0x3e3>
jmp    11d1 <main+0x41>
cmpq   $0x0,-0x20(%rbp)
jne    145e <main+0x2ce>
mov    0x2b86(%rip),%rax
mov    (%rax),%edi
lea    0xc44(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1573 <main+0x3e3>
cmpl   $0x0,-0x30(%rbp)
jbe    1495 <main+0x305>
cmpl   $0x2,-0x18(%rbp)
je     1495 <main+0x305>
mov    0x2b4f(%rip),%rax
mov    (%rax),%edi
lea    0xc28(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1573 <main+0x3e3>
cmpl   $0x1,-0x24(%rbp)
jne    14cc <main+0x33c>
cmpl   $0x1,-0x18(%rbp)
je     14cc <main+0x33c>
mov    0x2b18(%rip),%rax
mov    (%rax),%edi
lea    0xc22(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1573 <main+0x3e3>
mov    $0x0,%al
call   1080 <init@plt>
cmp    $0x0,%eax
jne    14e8 <main+0x358>
movl   $0x2,-0x4(%rbp)
jmp    1573 <main+0x3e3>
mov    -0x18(%rbp),%eax
mov    %eax,-0x38(%rbp)
sub    $0x1,%eax
je     150d <main+0x37d>
jmp    14fc <main+0x36c>
mov    -0x38(%rbp),%eax
sub    $0x2,%eax
je     1524 <main+0x394>
jmp    153b <main+0x3ab>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x2c(%rbp),%ecx
call   1040 <normal_read_to_multiple_write@plt>
jmp    156c <main+0x3dc>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x30(%rbp),%ecx
call   1070 <multi_read_to_normal_write@plt>
jmp    156c <main+0x3dc>
mov    0x2a86(%rip),%rax
mov    (%rax),%edi
lea    0xbc2(%rip),%rsi
lea    0xab9(%rip),%rdx
lea    0xabf(%rip),%rcx
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1573 <main+0x3e3>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbp
mov    %edi,%r12d
lea    0xf49(%rip),%rdx
call   10a0 <getopt@plt>
mov    0x2e21(%rip),%r13
cmp    0x0(%r13),%eax
jne    11e8 <main+0x58>
mov    0x2e04(%rip),%rax
mov    (%rax),%edi
lea    0xfb6(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ecx,%ecx
mov    %rcx,0x20(%rsp)
lea    0xefe(%rip),%r14
lea    0xe03(%rip),%rbx
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x14(%rsp)
xor    %ecx,%ecx
mov    %rcx,0x18(%rsp)
movl   $0x0,0x8(%rsp)
jmp    1248 <main+0xb8>
movl   $0x1,0x14(%rsp)
xchg   %ax,%ax
mov    %r12d,%edi
mov    %rbp,%rsi
mov    %r14,%rdx
call   10a0 <getopt@plt>
cmp    0x0(%r13),%eax
je     12ff <main+0x16f>
lea    -0x3a(%rax),%ecx
cmp    $0x3c,%ecx
ja     1270 <main+0xe0>
movslq (%rbx,%rcx,4),%rax
add    %rbx,%rax
jmp    *%rax
mov    0x2d98(%rip),%rax
mov    (%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,0xc(%rsp)
jmp    1230 <main+0xa0>
xchg   %ax,%ax
cmp    $0x1,%eax
jne    1230 <main+0xa0>
mov    0x2d7c(%rip),%rax
mov    (%rax),%r15
cmpl   $0x0,0x8(%rsp)
je     12bb <main+0x12b>
mov    %r15,0x18(%rsp)
jmp    1230 <main+0xa0>
mov    0x2d64(%rip),%rax
mov    (%rax),%rdi
call   10b0 <atoi@plt>
mov    %rax,0x20(%rsp)
jmp    1230 <main+0xa0>
mov    0x2d4e(%rip),%rax
mov    (%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,0x10(%rsp)
jmp    1230 <main+0xa0>
lea    0xe3d(%rip),%rdi
mov    %r15,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     12f2 <main+0x162>
lea    0xe37(%rip),%rdi
mov    %r15,%rsi
call   1050 <strcmp@plt>
movl   $0x2,0x8(%rsp)
test   %eax,%eax
je     1230 <main+0xa0>
jmp    143b <main+0x2ab>
movl   $0x1,0x8(%rsp)
jmp    1230 <main+0xa0>
mov    0x18(%rsp),%rbp
test   %rbp,%rbp
je     11bd <main+0x2d>
mov    0x20(%rsp),%rbx
test   %ebx,%ebx
mov    0x8(%rsp),%eax
je     1334 <main+0x1a4>
cmp    $0x2,%eax
je     1334 <main+0x1a4>
mov    0x2ca2(%rip),%rax
mov    (%rax),%edi
lea    0xe6f(%rip),%rsi
jmp    11cd <main+0x3d>
mov    0x14(%rsp),%r14d
cmp    $0x1,%r14d
jne    13bb <main+0x22b>
cmp    $0x1,%eax
je     13bb <main+0x22b>
mov    0x2c7d(%rip),%rax
mov    (%rax),%edi
lea    0xe7b(%rip),%rsi
jmp    11cd <main+0x3d>
mov    0x2c68(%rip),%rax
mov    (%rax),%edi
mov    0x2c77(%rip),%rax
movsbl (%rax),%edx
lea    0xdd2(%rip),%rsi
jmp    138f <main+0x1ff>
mov    0x2c4c(%rip),%rax
mov    (%rax),%edi
mov    0x2c5b(%rip),%rax
movsbl (%rax),%edx
lea    0xdd7(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    11d4 <main+0x44>
mov    0x0(%rbp),%rdi
call   1090 <usage@plt>
xor    %eax,%eax
jmp    11d9 <main+0x49>
mov    0x0(%rbp),%rdi
call   1030 <show_version@plt>
xor    %eax,%eax
jmp    11d9 <main+0x49>
xor    %eax,%eax
call   1080 <init@plt>
test   %eax,%eax
je     13ee <main+0x25e>
mov    0x8(%rsp),%eax
cmp    $0x2,%eax
je     13f8 <main+0x268>
cmp    $0x1,%eax
jne    1411 <main+0x281>
mov    %rbp,%rdi
mov    %r14d,%esi
mov    0xc(%rsp),%edx
mov    0x10(%rsp),%ecx
call   1040 <normal_read_to_multiple_write@plt>
xor    %eax,%eax
jmp    11d9 <main+0x49>
mov    $0x2,%eax
jmp    11d9 <main+0x49>
mov    %rbp,%rdi
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%edx
mov    %ebx,%ecx
call   1070 <multi_read_to_normal_write@plt>
xor    %eax,%eax
jmp    11d9 <main+0x49>
mov    0x2bb0(%rip),%rax
mov    (%rax),%edi
lea    0xde0(%rip),%rsi
lea    0xcd7(%rip),%rdx
lea    0xcdd(%rip),%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    11d4 <main+0x44>
mov    0x2b86(%rip),%rax
mov    (%rax),%edi
lea    0xccd(%rip),%rsi
lea    0xcad(%rip),%rcx
lea    0xcb3(%rip),%r8
mov    %r15,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    11d4 <main+0x44>

LLVM IR (-O0):
@.str = [11 x i8] c"-sb:hvr:c:\00"
@EOF = global i32 0
@.str.1 = [13 x i8] c"split_output\00"
@optarg = global i8* null
@.str.2 = [12 x i8] c"split_input\00"
@stderr = global i32 0
@.str.3 = [45 x i8] c"Unknown mode %s. Please use either %s or %s\0A\00"
@.str.4 = [33 x i8] c"Missing parameter to option -%c\0A\00"
@optopt = global i64 0
@.str.5 = [29 x i8] c"Ignoring unknown option -%c\0A\00"
@.str.6 = [27 x i8] c"Missing filename argument\0A\00"
@.str.7 = [49 x i8] c"-c option is only available in split_input mode\0A\00"
@.str.8 = [50 x i8] c"-s option is only available in split_output mode\0A\00"
@.str.9 = [57 x i8] c"missing read mode argument. Please user either %s or %s\0A\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 i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i8* null, i8** %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
br label %13
13: ; preds = %75, %2
%14 = load i32, i32* %4
%15 = load i8**, i8*** %5
%16 = call i32 @getopt(i32 %14, i8** %15, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i32 %16, i32* %6
%17 = load i32, i32* @EOF
%18 = icmp ne i32 %16, %17
br i1 %18, label %19, label %76
19: ; preds = %13
%20 = load i32, i32* %6
switch i32 %20, label %75 [
i32 1, label %21
i32 115, label %43
i32 98, label %44
i32 114, label %47
i32 99, label %50
i32 104, label %53
i32 118, label %58
i32 58, label %63
i32 63, label %69
]
21: ; preds = %19
%22 = load i32, i32* %7
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %40
24: ; preds = %21
%25 = load i8*, i8** @optarg
%26 = call i32 @strcmp(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %25)
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %24
store i32 1, i32* %7
br label %39
29: ; preds = %24
%30 = load i8*, i8** @optarg
%31 = call i32 @strcmp(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %30)
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %29
store i32 2, i32* %7
br label %38
34: ; preds = %29
%35 = load i32, i32* @stderr
%36 = load i8*, i8** @optarg
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i8* %36, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %122
38: ; preds = %33
br label %39
39: ; preds = %38, %28
br label %42
40: ; preds = %21
%41 = load i8*, i8** @optarg
store i8* %41, i8** %8
br label %42
42: ; preds = %40, %39
br label %75
43: ; preds = %19
store i32 1, i32* %9
br label %75
44: ; preds = %19
%45 = load i8*, i8** @optarg
%46 = call i32 @atoi(i8* %45)
store i32 %46, i32* %10
br label %75
47: ; preds = %19
%48 = load i8*, i8** @optarg
%49 = call i32 @atoi(i8* %48)
store i32 %49, i32* %11
br label %75
50: ; preds = %19
%51 = load i8*, i8** @optarg
%52 = call i32 @atoi(i8* %51)
store i32 %52, i32* %12
br label %75
53: ; preds = %19
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 0
%56 = load i8*, i8** %55
%57 = call i32 @usage(i8* %56)
store i32 0, i32* %3
br label %122
58: ; preds = %19
%59 = load i8**, i8*** %5
%60 = getelementptr inbounds i8*, i8** %59, i64 0
%61 = load i8*, i8** %60
%62 = call i32 @show_version(i8* %61)
store i32 0, i32* %3
br label %122
63: ; preds = %19
%64 = load i32, i32* @stderr
%65 = load i64, i64* @optopt
%66 = trunc i64 %65 to i8
%67 = sext i8 %66 to i32
%68 = call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %67)
store i32 1, i32* %3
br label %122
69: ; preds = %19
%70 = load i32, i32* @stderr
%71 = load i64, i64* @optopt
%72 = trunc i64 %71 to i8
%73 = sext i8 %72 to i32
%74 = call i32 (i32, i8*, ...) @fprintf(i32 %70, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), i32 %73)
store i32 1, i32* %3
br label %122
75: ; preds = %19, %50, %47, %44, %43, %42
br label %13
76: ; preds = %13
%77 = load i8*, i8** %8
%78 = icmp eq i8* %77, null
br i1 %78, label %79, label %82
79: ; preds = %76
%80 = load i32, i32* @stderr
%81 = call i32 (i32, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %3
br label %122
82: ; preds = %76
%83 = load i32, i32* %12
%84 = icmp ugt i32 %83, 0
br i1 %84, label %85, label %91
85: ; preds = %82
%86 = load i32, i32* %7
%87 = icmp ne i32 %86, 2
br i1 %87, label %88, label %91
88: ; preds = %85
%89 = load i32, i32* @stderr
%90 = call i32 (i32, i8*, ...) @fprintf(i32 %89, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %3
br label %122
91: ; preds = %85, %82
%92 = load i32, i32* %9
%93 = icmp eq i32 %92, 1
br i1 %93, label %94, label %100
94: ; preds = %91
%95 = load i32, i32* %7
%96 = icmp ne i32 %95, 1
br i1 %96, label %97, label %100
97: ; preds = %94
%98 = load i32, i32* @stderr
%99 = call i32 (i32, i8*, ...) @fprintf(i32 %98, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %3
br label %122
100: ; preds = %94, %91
%101 = call i32 (...) @init()
%102 = icmp ne i32 %101, 0
br i1 %102, label %104, label %103
103: ; preds = %100
store i32 2, i32* %3
br label %122
104: ; preds = %100
%105 = load i32, i32* %7
switch i32 %105, label %118 [
i32 1, label %106
i32 2, label %112
]
106: ; preds = %104
%107 = load i8*, i8** %8
%108 = load i32, i32* %9
%109 = load i32, i32* %10
%110 = load i32, i32* %11
%111 = call i32 @normal_read_to_multiple_write(i8* %107, i32 %108, i32 %109, i32 %110)
br label %121
112: ; preds = %104
%113 = load i8*, i8** %8
%114 = load i32, i32* %10
%115 = load i32, i32* %11
%116 = load i32, i32* %12
%117 = call i32 @multi_read_to_normal_write(i8* %113, i32 %114, i32 %115, i32 %116)
br label %121
118: ; preds = %104
%119 = load i32, i32* @stderr
%120 = call i32 (i32, i8*, ...) @fprintf(i32 %119, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %122
121: ; preds = %112, %106
store i32 0, i32* %3
br label %122
122: ; preds = %121, %118, %103, %97, %88, %79, %69, %63, %58, %53, %34
%123 = load i32, i32* %3
ret i32 %123
}

LLVM IR (-O2):
@.str = [11 x i8] c"-sb:hvr:c:\00"
@EOF = global i32 0
@.str.1 = [13 x i8] c"split_output\00"
@optarg = global i8* null
@.str.2 = [12 x i8] c"split_input\00"
@stderr = global i32 0
@.str.3 = [45 x i8] c"Unknown mode %s. Please use either %s or %s\0A\00"
@.str.4 = [33 x i8] c"Missing parameter to option -%c\0A\00"
@optopt = global i64 0
@.str.5 = [29 x i8] c"Ignoring unknown option -%c\0A\00"
@.str.6 = [27 x i8] c"Missing filename argument\0A\00"
@.str.7 = [49 x i8] c"-c option is only available in split_input mode\0A\00"
@.str.8 = [50 x i8] c"-s option is only available in split_output mode\0A\00"
@.str.9 = [57 x i8] c"missing read mode argument. Please user either %s or %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %68, label %6
6: ; preds = %2, %56
%7 = phi i32 [ %63, %56 ], [ %3, %2 ]
%8 = phi i32 [ %62, %56 ], [ 0, %2 ]
%9 = phi i32 [ %61, %56 ], [ 0, %2 ]
%10 = phi i32 [ %60, %56 ], [ 0, %2 ]
%11 = phi i32 [ %59, %56 ], [ 0, %2 ]
%12 = phi i8* [ %58, %56 ], [ null, %2 ]
%13 = phi i32 [ %57, %56 ], [ 0, %2 ]
switch i32 %7, label %56 [
i32 1, label %14
i32 115, label %26
i32 98, label %27
i32 114, label %30
i32 99, label %33
i32 104, label %36
i32 118, label %39
i32 58, label %42
i32 63, label %49
]
14: ; preds = %6
%15 = icmp eq i32 %13, 0
%16 = load i8*, i8** @optarg
br i1 %15, label %17, label %56
17: ; preds = %14
%18 = tail call i32 @strcmp(i8* dereferenceable(13) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* dereferenceable(1) %16)
%19 = icmp eq i32 %18, 0
br i1 %19, label %56, label %20
20: ; preds = %17
%21 = tail call i32 @strcmp(i8* dereferenceable(12) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* dereferenceable(1) %16)
%22 = icmp eq i32 %21, 0
br i1 %22, label %56, label %23
23: ; preds = %20
%24 = load i32, i32* @stderr
%25 = tail call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i8* %16, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %96
26: ; preds = %6
br label %56
27: ; preds = %6
%28 = load i8*, i8** @optarg
%29 = tail call i32 @atoi(i8* %28)
br label %56
30: ; preds = %6
%31 = load i8*, i8** @optarg
%32 = tail call i32 @atoi(i8* %31)
br label %56
33: ; preds = %6
%34 = load i8*, i8** @optarg
%35 = tail call i32 @atoi(i8* %34)
br label %56
36: ; preds = %6
%37 = load i8*, i8** %1
%38 = tail call i32 @usage(i8* %37)
br label %96
39: ; preds = %6
%40 = load i8*, i8** %1
%41 = tail call i32 @show_version(i8* %40)
br label %96
42: ; preds = %6
%43 = load i32, i32* @stderr
%44 = load i64, i64* @optopt
%45 = trunc i64 %44 to i32
%46 = shl i32 %45, 24
%47 = ashr exact i32 %46, 24
%48 = tail call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %47)
br label %96
49: ; preds = %6
%50 = load i32, i32* @stderr
%51 = load i64, i64* @optopt
%52 = trunc i64 %51 to i32
%53 = shl i32 %52, 24
%54 = ashr exact i32 %53, 24
%55 = tail call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), i32 %54)
br label %96
56: ; preds = %14, %20, %17, %6, %33, %30, %27, %26
%57 = phi i32 [ %13, %6 ], [ %13, %33 ], [ %13, %30 ], [ %13, %27 ], [ %13, %26 ], [ 1, %17 ], [ 2, %20 ], [ %13, %14 ]
%58 = phi i8* [ %12, %6 ], [ %12, %33 ], [ %12, %30 ], [ %12, %27 ], [ %12, %26 ], [ %12, %17 ], [ %12, %20 ], [ %16, %14 ]
%59 = phi i32 [ %11, %6 ], [ %11, %33 ], [ %11, %30 ], [ %11, %27 ], [ 1, %26 ], [ %11, %17 ], [ %11, %20 ], [ %11, %14 ]
%60 = phi i32 [ %10, %6 ], [ %10, %33 ], [ %10, %30 ], [ %29, %27 ], [ %10, %26 ], [ %10, %17 ], [ %10, %20 ], [ %10, %14 ]
%61 = phi i32 [ %9, %6 ], [ %9, %33 ], [ %32, %30 ], [ %9, %27 ], [ %9, %26 ], [ %9, %17 ], [ %9, %20 ], [ %9, %14 ]
%62 = phi i32 [ %8, %6 ], [ %35, %33 ], [ %8, %30 ], [ %8, %27 ], [ %8, %26 ], [ %8, %17 ], [ %8, %20 ], [ %8, %14 ]
%63 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%64 = load i32, i32* @EOF
%65 = icmp eq i32 %63, %64
br i1 %65, label %66, label %6
66: ; preds = %56
%67 = icmp eq i8* %58, null
br i1 %67, label %68, label %71
68: ; preds = %2, %66
%69 = load i32, i32* @stderr
%70 = tail call i32 (i32, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
br label %96
71: ; preds = %66
%72 = icmp ne i32 %62, 0
%73 = icmp ne i32 %57, 2
%74 = select i1 %72, i1 %73, i1 false
br i1 %74, label %75, label %78
75: ; preds = %71
%76 = load i32, i32* @stderr
%77 = tail call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0))
br label %96
78: ; preds = %71
%79 = icmp eq i32 %59, 1
%80 = icmp ne i32 %57, 1
%81 = select i1 %79, i1 %80, i1 false
br i1 %81, label %82, label %85
82: ; preds = %78
%83 = load i32, i32* @stderr
%84 = tail call i32 (i32, i8*, ...) @fprintf(i32 %83, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.8, i64 0, i64 0))
br label %96
85: ; preds = %78
%86 = tail call i32 (...) @init()
%87 = icmp eq i32 %86, 0
br i1 %87, label %96, label %88
88: ; preds = %85
switch i32 %57, label %93 [
i32 1, label %89
i32 2, label %91
]
89: ; preds = %88
%90 = tail call i32 @normal_read_to_multiple_write(i8* %58, i32 %59, i32 %60, i32 %61)
br label %96
91: ; preds = %88
%92 = tail call i32 @multi_read_to_normal_write(i8* %58, i32 %60, i32 %61, i32 %62)
br label %96
93: ; preds = %88
%94 = load i32, i32* @stderr
%95 = tail call i32 (i32, i8*, ...) @fprintf(i32 %94, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %96
96: ; preds = %89, %91, %85, %93, %82, %75, %68, %49, %42, %39, %36, %23
%97 = phi i32 [ 1, %49 ], [ 1, %42 ], [ 0, %39 ], [ 0, %36 ], [ 1, %23 ], [ 1, %68 ], [ 1, %75 ], [ 1, %82 ], [ 1, %93 ], [ 2, %85 ], [ 0, %91 ], [ 0, %89 ]
ret i32 %97
}