#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 /*<<< orphan*/ internal_subf_gets(char *, int);
int /*<<< orphan*/ memcmp(char *, char *, int);
int sscanf(char *, char *, ...);
scalar_t__ strstr(char *, char *);
int internal_sub_autodetect(int fd) {
  char line[1000 + 1];
  int i, j = 0;
  char p;
  j = sscanf("00:02:21,606 --> 00:02:23,073",
             "%d:%d:%d%[,.:]%d --> %d:%d:%d%[,.:]%d", &i, &i, &i, (char *)&i,
             &i, &i, &i, &i, (char *)&i, &i);
  j = sscanf("abc", "[aef]bc", (char *)&i);
  while (j < 100) {
    j++;
    if (!internal_subf_gets(line, fd)) {
      return -1;
    }
    if (sscanf(line, "{%d}{%d}", &i, &i) == 2) {
      return 0;
    }
    if (sscanf(line, "{%d}{}", &i) == 1) {
      return 0;
    }
    if (sscanf(line, "[%d][%d]", &i, &i) == 2) {
      return 13;
    }
    if (sscanf(line, "%d:%d:%d.%d,%d:%d:%d.%d", &i, &i, &i, &i, &i, &i, &i,
               &i) == 8) {
      return 1;
    }
    if (sscanf(line, "%d:%d:%d%[,.:]%d --> %d:%d:%d%[,.:]%d", &i, &i, &i,
               (char *)&i, &i, &i, &i, &i, (char *)&i, &i) == 10) {
      return 2;
    }
    if (sscanf(line, "{T %d:%d:%d:%d", &i, &i, &i, &i) == 4) {
      return 10;
    }
    if (strstr(line, "<SAMI>")) {
      return 3;
    }
    if (sscanf(line, "%d:%d:%d.%d %d:%d:%d.%d", &i, &i, &i, &i, &i, &i, &i,
               &i) == 8) {
      return 12;
    }
    if (sscanf(line, "@%d @%d", &i, &i) == 2) {
      return 12;
    }
    if (sscanf(line, "%d:%d:%d:", &i, &i, &i) == 3) {
      return 4;
    }
    if (sscanf(line, "%d:%d:%d ", &i, &i, &i) == 3) {
      return 4;
    }
    if (*line == '<') {
      return 5;
    }
    if (!memcmp(line, "Dialogue: Marked", 16)) {
      return 6;
    }
    if (!memcmp(line, "Dialogue: ", 10)) {
      return 6;
    }
    if (sscanf(line, "%d,%d,\"%c", &i, &i, (char *)&i) == 3) {
      return 7;
    }
    if (sscanf(line, "FORMAT=%d", &i) == 1) {
      return 8;
    }
    if (sscanf(line, "FORMAT=TIM%c", &p) == 1 && p == 'E') {
      return 8;
    }
    if (strstr(line, "-->>")) {
      return 9;
    }
    if (sscanf(line, "[%d:%d:%d]", &i, &i, &i) == 3) {
      return 11;
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<internal_sub_autodetect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x460,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0x408(%rbp)
lea    -0x404(%rbp),%r9
lea    -0x404(%rbp),%r10
lea    0xe93(%rip),%rdi
lea    0xeaa(%rip),%rsi
lea    -0x404(%rbp),%rax
mov    %rax,-0x418(%rbp)
mov    %rax,%rdx
mov    %rax,%rcx
mov    %rax,%r8
mov    %rax,(%rsp)
mov    %rax,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    %rax,0x18(%rsp)
mov    %r10,0x20(%rsp)
mov    %rax,0x28(%rsp)
mov    $0x0,%al
call   1050 <sscanf@plt>
mov    %eax,-0x408(%rbp)
lea    -0x404(%rbp),%rdx
lea    0xe81(%rip),%rdi
lea    0xe7e(%rip),%rsi
mov    $0x0,%al
call   1050 <sscanf@plt>
mov    %eax,-0x408(%rbp)
cmpl   $0x64,-0x408(%rbp)
jge    1657 <internal_sub_autodetect+0x517>
mov    -0x408(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x408(%rbp)
lea    -0x400(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1040 <internal_subf_gets@plt>
cmp    $0x0,%eax
jne    1217 <internal_sub_autodetect+0xd7>
movl   $0xffffffff,-0x4(%rbp)
jmp    165e <internal_sub_autodetect+0x51e>
lea    -0x400(%rbp),%rdi
lea    0xe2b(%rip),%rsi
lea    -0x404(%rbp),%rcx
mov    %rcx,%rdx
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x2,%eax
jne    124b <internal_sub_autodetect+0x10b>
movl   $0x0,-0x4(%rbp)
jmp    165e <internal_sub_autodetect+0x51e>
lea    -0x400(%rbp),%rdi
lea    0xe00(%rip),%rsi
lea    -0x404(%rbp),%rdx
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    127c <internal_sub_autodetect+0x13c>
movl   $0x0,-0x4(%rbp)
jmp    165e <internal_sub_autodetect+0x51e>
lea    -0x400(%rbp),%rdi
lea    0xdd6(%rip),%rsi
lea    -0x404(%rbp),%rcx
mov    %rcx,%rdx
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x2,%eax
jne    12b0 <internal_sub_autodetect+0x170>
movl   $0xd,-0x4(%rbp)
jmp    165e <internal_sub_autodetect+0x51e>
lea    -0x400(%rbp),%rdi
lea    0xdab(%rip),%rsi
lea    -0x404(%rbp),%rax
mov    %rax,-0x420(%rbp)
mov    %rax,%rdx
mov    %rax,%rcx
mov    %rax,%r8
mov    %rax,%r9
mov    %rax,(%rsp)
mov    %rax,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    %rax,0x18(%rsp)
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x8,%eax
jne    1307 <internal_sub_autodetect+0x1c7>
movl   $0x1,-0x4(%rbp)
jmp    165e <internal_sub_autodetect+0x51e>
lea    -0x400(%rbp),%rdi
lea    -0x404(%rbp),%r9
lea    -0x404(%rbp),%r10
lea    0xcfb(%rip),%rsi
lea    -0x404(%rbp),%rax
mov    %rax,-0x428(%rbp)
mov    %rax,%rdx
mov    %rax,%rcx
mov    %rax,%r8
mov    %rax,(%rsp)
mov    %rax,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    %rax,0x18(%rsp)
mov    %r10,0x20(%rsp)
mov    %rax,0x28(%rsp)
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0xa,%eax
jne    1373 <internal_sub_autodetect+0x233>
movl   $0x2,-0x4(%rbp)
jmp    165e <internal_sub_autodetect+0x51e>
lea    -0x400(%rbp),%rdi
lea    0xd00(%rip),%rsi
lea    -0x404(%rbp),%r9
mov    %r9,%rdx
mov    %r9,%rcx
mov    %r9,%r8
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x4,%eax
jne    13ad <internal_sub_autodetect+0x26d>
movl   $0xa,-0x4(%rbp)
jmp    165e <internal_sub_autodetect+0x51e>
lea    -0x400(%rbp),%rdi
lea    0xcd5(%rip),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%rax
je     13d6 <internal_sub_autodetect+0x296>
movl   $0x3,-0x4(%rbp)
jmp    165e <internal_sub_autodetect+0x51e>
lea    -0x400(%rbp),%rdi
lea    0xcb3(%rip),%rsi
lea    -0x404(%rbp),%rax
mov    %rax,-0x430(%rbp)
mov    %rax,%rdx
mov    %rax,%rcx
mov    %rax,%r8
mov    %rax,%r9
mov    %rax,(%rsp)
mov    %rax,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    %rax,0x18(%rsp)
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x8,%eax
jne    142d <internal_sub_autodetect+0x2ed>
movl   $0xc,-0x4(%rbp)
jmp    165e <internal_sub_autodetect+0x51e>
lea    -0x400(%rbp),%rdi
lea    0xc74(%rip),%rsi
lea    -0x404(%rbp),%rcx
mov    %rcx,%rdx
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x2,%eax
jne    1461 <internal_sub_autodetect+0x321>
movl   $0xc,-0x4(%rbp)
jmp    165e <internal_sub_autodetect+0x51e>
lea    -0x400(%rbp),%rdi
lea    0xc48(%rip),%rsi
lea    -0x404(%rbp),%r8
mov    %r8,%rdx
mov    %r8,%rcx
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x3,%eax
jne    1498 <internal_sub_autodetect+0x358>
movl   $0x4,-0x4(%rbp)
jmp    165e <internal_sub_autodetect+0x51e>
lea    -0x400(%rbp),%rdi
lea    0xc1b(%rip),%rsi
lea    -0x404(%rbp),%r8
mov    %r8,%rdx
mov    %r8,%rcx
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x3,%eax
jne    14cf <internal_sub_autodetect+0x38f>
movl   $0x4,-0x4(%rbp)
jmp    165e <internal_sub_autodetect+0x51e>
movsbl -0x400(%rbp),%eax
cmp    $0x3c,%eax
jne    14eb <internal_sub_autodetect+0x3ab>
movl   $0x5,-0x4(%rbp)
jmp    165e <internal_sub_autodetect+0x51e>
lea    -0x400(%rbp),%rdi
lea    0xbd2(%rip),%rsi
mov    $0x10,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%eax
jne    1518 <internal_sub_autodetect+0x3d8>
movl   $0x6,-0x4(%rbp)
jmp    165e <internal_sub_autodetect+0x51e>
lea    -0x400(%rbp),%rdi
lea    0xbb6(%rip),%rsi
mov    $0xa,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%eax
jne    1545 <internal_sub_autodetect+0x405>
movl   $0x6,-0x4(%rbp)
jmp    165e <internal_sub_autodetect+0x51e>
lea    -0x400(%rbp),%rdi
lea    -0x404(%rbp),%r8
lea    0xb8d(%rip),%rsi
lea    -0x404(%rbp),%rcx
mov    %rcx,%rdx
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x3,%eax
jne    1580 <internal_sub_autodetect+0x440>
movl   $0x7,-0x4(%rbp)
jmp    165e <internal_sub_autodetect+0x51e>
lea    -0x400(%rbp),%rdi
lea    0xb63(%rip),%rsi
lea    -0x404(%rbp),%rdx
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    15b1 <internal_sub_autodetect+0x471>
movl   $0x8,-0x4(%rbp)
jmp    165e <internal_sub_autodetect+0x51e>
lea    -0x400(%rbp),%rdi
lea    0xb3c(%rip),%rsi
lea    -0x409(%rbp),%rdx
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    15f2 <internal_sub_autodetect+0x4b2>
movsbl -0x409(%rbp),%eax
cmp    $0x45,%eax
jne    15f2 <internal_sub_autodetect+0x4b2>
movl   $0x8,-0x4(%rbp)
jmp    165e <internal_sub_autodetect+0x51e>
lea    -0x400(%rbp),%rdi
lea    0xb08(%rip),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%rax
je     161b <internal_sub_autodetect+0x4db>
movl   $0x9,-0x4(%rbp)
jmp    165e <internal_sub_autodetect+0x51e>
lea    -0x400(%rbp),%rdi
lea    0xae4(%rip),%rsi
lea    -0x404(%rbp),%r8
mov    %r8,%rdx
mov    %r8,%rcx
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x3,%eax
jne    1652 <internal_sub_autodetect+0x512>
movl   $0xb,-0x4(%rbp)
jmp    165e <internal_sub_autodetect+0x51e>
jmp    11d7 <internal_sub_autodetect+0x97>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x460,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<internal_sub_autodetect>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %edi,%r15d
lea    0xc(%rsp),%rbx
lea    0xea0(%rip),%rdi
lea    0xeb7(%rip),%r14
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
mov    %rbx,%r9
xor    %eax,%eax
push   %rbx
push   %rbx
push   %rbx
push   %rbx
push   %rbx
push   %rbx
call   1050 <sscanf@plt>
add    $0x30,%rsp
lea    0xeb6(%rip),%rdi
lea    0xeb3(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <sscanf@plt>
cmp    $0x65,%eax
mov    $0x64,%r12d
cmovge %eax,%r12d
sub    %eax,%r12d
add    $0x1,%r12d
lea    0x10(%rsp),%rbp
mov    $0xffffffff,%r13d
add    $0xffffffff,%r12d
je     14a4 <internal_sub_autodetect+0x364>
mov    %rbp,%rdi
mov    %r15d,%esi
call   1040 <internal_subf_gets@plt>
test   %eax,%eax
je     14a4 <internal_sub_autodetect+0x364>
xor    %r13d,%r13d
mov    %rbp,%rdi
lea    0xe68(%rip),%rsi
mov    %rbx,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1050 <sscanf@plt>
cmp    $0x2,%eax
je     14a4 <internal_sub_autodetect+0x364>
xor    %r13d,%r13d
mov    %rbp,%rdi
lea    0xe4e(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <sscanf@plt>
cmp    $0x1,%eax
je     14a4 <internal_sub_autodetect+0x364>
mov    %rbp,%rdi
lea    0xe38(%rip),%rsi
mov    %rbx,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1050 <sscanf@plt>
cmp    $0x2,%eax
je     1466 <internal_sub_autodetect+0x326>
mov    %rbp,%rdi
lea    0xe21(%rip),%rsi
mov    %rbx,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
mov    %rbx,%r9
xor    %eax,%eax
push   %rbx
push   %rbx
push   %rbx
push   %rbx
call   1050 <sscanf@plt>
add    $0x20,%rsp
cmp    $0x8,%eax
je     146e <internal_sub_autodetect+0x32e>
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
mov    %rbx,%r9
xor    %eax,%eax
push   %rbx
push   %rbx
push   %rbx
push   %rbx
push   %rbx
push   %rbx
call   1050 <sscanf@plt>
add    $0x30,%rsp
cmp    $0xa,%eax
je     1476 <internal_sub_autodetect+0x336>
mov    %rbp,%rdi
lea    0xddf(%rip),%rsi
mov    %rbx,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
mov    %rbx,%r9
xor    %eax,%eax
call   1050 <sscanf@plt>
cmp    $0x4,%eax
je     147e <internal_sub_autodetect+0x33e>
mov    %rbp,%rdi
lea    0xdc8(%rip),%rsi
call   1060 <strstr@plt>
test   %rax,%rax
jne    1486 <internal_sub_autodetect+0x346>
mov    %rbp,%rdi
lea    0xdb7(%rip),%rsi
mov    %rbx,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
mov    %rbx,%r9
xor    %eax,%eax
push   %rbx
push   %rbx
push   %rbx
push   %rbx
call   1050 <sscanf@plt>
add    $0x20,%rsp
mov    $0xc,%r13d
cmp    $0x8,%eax
je     14a4 <internal_sub_autodetect+0x364>
mov    %rbp,%rdi
lea    0xd9b(%rip),%rsi
mov    %rbx,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1050 <sscanf@plt>
cmp    $0x2,%eax
je     14a4 <internal_sub_autodetect+0x364>
mov    %rbp,%rdi
lea    0xd83(%rip),%rsi
mov    %rbx,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1050 <sscanf@plt>
mov    $0x4,%r13d
cmp    $0x3,%eax
je     14a4 <internal_sub_autodetect+0x364>
mov    %rbp,%rdi
lea    0xd64(%rip),%rsi
mov    %rbx,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1050 <sscanf@plt>
cmp    $0x3,%eax
je     14a4 <internal_sub_autodetect+0x364>
cmpb   $0x3c,0x10(%rsp)
je     148e <internal_sub_autodetect+0x34e>
mov    %rbp,%rdi
lea    0xd40(%rip),%rsi
mov    $0x10,%edx
call   1030 <memcmp@plt>
mov    $0x6,%r13d
test   %eax,%eax
je     14a4 <internal_sub_autodetect+0x364>
mov    %rbp,%rdi
lea    0xd2f(%rip),%rsi
mov    $0xa,%edx
call   1030 <memcmp@plt>
test   %eax,%eax
je     14a4 <internal_sub_autodetect+0x364>
mov    %rbp,%rdi
lea    0xd1e(%rip),%rsi
mov    %rbx,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1050 <sscanf@plt>
cmp    $0x3,%eax
je     1496 <internal_sub_autodetect+0x356>
mov    %rbp,%rdi
lea    0xd05(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <sscanf@plt>
mov    $0x8,%r13d
cmp    $0x1,%eax
je     14a4 <internal_sub_autodetect+0x364>
mov    %rbp,%rdi
lea    0xcec(%rip),%rsi
lea    0xb(%rsp),%rdx
xor    %eax,%eax
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    1427 <internal_sub_autodetect+0x2e7>
cmpb   $0x45,0xb(%rsp)
je     14a4 <internal_sub_autodetect+0x364>
mov    %rbp,%rdi
lea    0xcd7(%rip),%rsi
call   1060 <strstr@plt>
test   %rax,%rax
jne    149e <internal_sub_autodetect+0x35e>
mov    %rbp,%rdi
lea    0xcc8(%rip),%rsi
mov    %rbx,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1050 <sscanf@plt>
cmp    $0x3,%eax
jne    11b8 <internal_sub_autodetect+0x78>
mov    $0xb,%r13d
jmp    14a4 <internal_sub_autodetect+0x364>
mov    $0xd,%r13d
jmp    14a4 <internal_sub_autodetect+0x364>
mov    $0x1,%r13d
jmp    14a4 <internal_sub_autodetect+0x364>
mov    $0x2,%r13d
jmp    14a4 <internal_sub_autodetect+0x364>
mov    $0xa,%r13d
jmp    14a4 <internal_sub_autodetect+0x364>
mov    $0x3,%r13d
jmp    14a4 <internal_sub_autodetect+0x364>
mov    $0x5,%r13d
jmp    14a4 <internal_sub_autodetect+0x364>
mov    $0x7,%r13d
jmp    14a4 <internal_sub_autodetect+0x364>
mov    $0x9,%r13d
mov    %r13d,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"00:02:21,606 --> 00:02:23,073\00"
@.str.1 = [38 x i8] c"%d:%d:%d%[,.:]%d --> %d:%d:%d%[,.:]%d\00"
@.str.2 = [4 x i8] c"abc\00"
@.str.3 = [8 x i8] c"[aef]bc\00"
@.str.4 = [9 x i8] c"{%d}{%d}\00"
@.str.5 = [7 x i8] c"{%d}{}\00"
@.str.6 = [9 x i8] c"[%d][%d]\00"
@.str.7 = [24 x i8] c"%d:%d:%d.%d,%d:%d:%d.%d\00"
@.str.8 = [15 x i8] c"{T %d:%d:%d:%d\00"
@.str.9 = [7 x i8] c"<SAMI>\00"
@.str.10 = [24 x i8] c"%d:%d:%d.%d %d:%d:%d.%d\00"
@.str.11 = [8 x i8] c"@%d @%d\00"
@.str.12 = [10 x i8] c"%d:%d:%d:\00"
@.str.13 = [10 x i8] c"%d:%d:%d \00"
@.str.14 = [17 x i8] c"Dialogue: Marked\00"
@.str.15 = [11 x i8] c"Dialogue: \00"
@.str.16 = [10 x i8] c"%d,%d,\22%c\00"
@.str.17 = [10 x i8] c"FORMAT=%d\00"
@.str.18 = [13 x i8] c"FORMAT=TIM%c\00"
@.str.19 = [5 x i8] c"-->>\00"
@.str.20 = [11 x i8] c"[%d:%d:%d]\00"
define i32 @internal_sub_autodetect(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [1001 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
store i32 %0, i32* %3
store i32 0, i32* %6
%8 = bitcast i32* %5 to i8*
%9 = bitcast i32* %5 to i8*
%10 = call i32 (i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32* %5, i32* %5, i32* %5, i8* %8, i32* %5, i32* %5, i32* %5, i32* %5, i8* %9, i32* %5)
store i32 %10, i32* %6
%11 = bitcast i32* %5 to i8*
%12 = call i32 (i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %11)
store i32 %12, i32* %6
br label %13
13: ; preds = %127, %1
%14 = load i32, i32* %6
%15 = icmp slt i32 %14, 100
br i1 %15, label %16, label %128
16: ; preds = %13
%17 = load i32, i32* %6
%18 = add nsw i32 %17, 1
store i32 %18, i32* %6
%19 = getelementptr inbounds [1001 x i8], [1001 x i8]* %4, i64 0, i64 0
%20 = load i32, i32* %3
%21 = call i32 @internal_subf_gets(i8* %19, i32 %20)
%22 = icmp ne i32 %21, 0
br i1 %22, label %24, label %23
23: ; preds = %16
store i32 -1, i32* %2
br label %129
24: ; preds = %16
%25 = getelementptr inbounds [1001 x i8], [1001 x i8]* %4, i64 0, i64 0
%26 = call i32 (i8*, i8*, ...) @sscanf(i8* %25, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32* %5, i32* %5)
%27 = icmp eq i32 %26, 2
br i1 %27, label %28, label %29
28: ; preds = %24
store i32 0, i32* %2
br label %129
29: ; preds = %24
%30 = getelementptr inbounds [1001 x i8], [1001 x i8]* %4, i64 0, i64 0
%31 = call i32 (i8*, i8*, ...) @sscanf(i8* %30, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32* %5)
%32 = icmp eq i32 %31, 1
br i1 %32, label %33, label %34
33: ; preds = %29
store i32 0, i32* %2
br label %129
34: ; preds = %29
%35 = getelementptr inbounds [1001 x i8], [1001 x i8]* %4, i64 0, i64 0
%36 = call i32 (i8*, i8*, ...) @sscanf(i8* %35, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32* %5, i32* %5)
%37 = icmp eq i32 %36, 2
br i1 %37, label %38, label %39
38: ; preds = %34
store i32 13, i32* %2
br label %129
39: ; preds = %34
%40 = getelementptr inbounds [1001 x i8], [1001 x i8]* %4, i64 0, i64 0
%41 = call i32 (i8*, i8*, ...) @sscanf(i8* %40, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i32* %5, i32* %5, i32* %5, i32* %5, i32* %5, i32* %5, i32* %5, i32* %5)
%42 = icmp eq i32 %41, 8
br i1 %42, label %43, label %44
43: ; preds = %39
store i32 1, i32* %2
br label %129
44: ; preds = %39
%45 = getelementptr inbounds [1001 x i8], [1001 x i8]* %4, i64 0, i64 0
%46 = bitcast i32* %5 to i8*
%47 = bitcast i32* %5 to i8*
%48 = call i32 (i8*, i8*, ...) @sscanf(i8* %45, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32* %5, i32* %5, i32* %5, i8* %46, i32* %5, i32* %5, i32* %5, i32* %5, i8* %47, i32* %5)
%49 = icmp eq i32 %48, 10
br i1 %49, label %50, label %51
50: ; preds = %44
store i32 2, i32* %2
br label %129
51: ; preds = %44
%52 = getelementptr inbounds [1001 x i8], [1001 x i8]* %4, i64 0, i64 0
%53 = call i32 (i8*, i8*, ...) @sscanf(i8* %52, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i32* %5, i32* %5, i32* %5, i32* %5)
%54 = icmp eq i32 %53, 4
br i1 %54, label %55, label %56
55: ; preds = %51
store i32 10, i32* %2
br label %129
56: ; preds = %51
%57 = getelementptr inbounds [1001 x i8], [1001 x i8]* %4, i64 0, i64 0
%58 = call i64 @strstr(i8* %57, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%59 = icmp ne i64 %58, 0
br i1 %59, label %60, label %61
60: ; preds = %56
store i32 3, i32* %2
br label %129
61: ; preds = %56
%62 = getelementptr inbounds [1001 x i8], [1001 x i8]* %4, i64 0, i64 0
%63 = call i32 (i8*, i8*, ...) @sscanf(i8* %62, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0), i32* %5, i32* %5, i32* %5, i32* %5, i32* %5, i32* %5, i32* %5, i32* %5)
%64 = icmp eq i32 %63, 8
br i1 %64, label %65, label %66
65: ; preds = %61
store i32 12, i32* %2
br label %129
66: ; preds = %61
%67 = getelementptr inbounds [1001 x i8], [1001 x i8]* %4, i64 0, i64 0
%68 = call i32 (i8*, i8*, ...) @sscanf(i8* %67, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0), i32* %5, i32* %5)
%69 = icmp eq i32 %68, 2
br i1 %69, label %70, label %71
70: ; preds = %66
store i32 12, i32* %2
br label %129
71: ; preds = %66
%72 = getelementptr inbounds [1001 x i8], [1001 x i8]* %4, i64 0, i64 0
%73 = call i32 (i8*, i8*, ...) @sscanf(i8* %72, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i32* %5, i32* %5, i32* %5)
%74 = icmp eq i32 %73, 3
br i1 %74, label %75, label %76
75: ; preds = %71
store i32 4, i32* %2
br label %129
76: ; preds = %71
%77 = getelementptr inbounds [1001 x i8], [1001 x i8]* %4, i64 0, i64 0
%78 = call i32 (i8*, i8*, ...) @sscanf(i8* %77, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), i32* %5, i32* %5, i32* %5)
%79 = icmp eq i32 %78, 3
br i1 %79, label %80, label %81
80: ; preds = %76
store i32 4, i32* %2
br label %129
81: ; preds = %76
%82 = getelementptr inbounds [1001 x i8], [1001 x i8]* %4, i64 0, i64 0
%83 = load i8, i8* %82
%84 = sext i8 %83 to i32
%85 = icmp eq i32 %84, 60
br i1 %85, label %86, label %87
86: ; preds = %81
store i32 5, i32* %2
br label %129
87: ; preds = %81
%88 = getelementptr inbounds [1001 x i8], [1001 x i8]* %4, i64 0, i64 0
%89 = call i32 @memcmp(i8* %88, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0), i32 16)
%90 = icmp ne i32 %89, 0
br i1 %90, label %92, label %91
91: ; preds = %87
store i32 6, i32* %2
br label %129
92: ; preds = %87
%93 = getelementptr inbounds [1001 x i8], [1001 x i8]* %4, i64 0, i64 0
%94 = call i32 @memcmp(i8* %93, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i32 10)
%95 = icmp ne i32 %94, 0
br i1 %95, label %97, label %96
96: ; preds = %92
store i32 6, i32* %2
br label %129
97: ; preds = %92
%98 = getelementptr inbounds [1001 x i8], [1001 x i8]* %4, i64 0, i64 0
%99 = bitcast i32* %5 to i8*
%100 = call i32 (i8*, i8*, ...) @sscanf(i8* %98, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.16, i64 0, i64 0), i32* %5, i32* %5, i8* %99)
%101 = icmp eq i32 %100, 3
br i1 %101, label %102, label %103
102: ; preds = %97
store i32 7, i32* %2
br label %129
103: ; preds = %97
%104 = getelementptr inbounds [1001 x i8], [1001 x i8]* %4, i64 0, i64 0
%105 = call i32 (i8*, i8*, ...) @sscanf(i8* %104, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.17, i64 0, i64 0), i32* %5)
%106 = icmp eq i32 %105, 1
br i1 %106, label %107, label %108
107: ; preds = %103
store i32 8, i32* %2
br label %129
108: ; preds = %103
%109 = getelementptr inbounds [1001 x i8], [1001 x i8]* %4, i64 0, i64 0
%110 = call i32 (i8*, i8*, ...) @sscanf(i8* %109, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.18, i64 0, i64 0), i8* %7)
%111 = icmp eq i32 %110, 1
br i1 %111, label %112, label %117
112: ; preds = %108
%113 = load i8, i8* %7
%114 = sext i8 %113 to i32
%115 = icmp eq i32 %114, 69
br i1 %115, label %116, label %117
116: ; preds = %112
store i32 8, i32* %2
br label %129
117: ; preds = %112, %108
%118 = getelementptr inbounds [1001 x i8], [1001 x i8]* %4, i64 0, i64 0
%119 = call i64 @strstr(i8* %118, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0))
%120 = icmp ne i64 %119, 0
br i1 %120, label %121, label %122
121: ; preds = %117
store i32 9, i32* %2
br label %129
122: ; preds = %117
%123 = getelementptr inbounds [1001 x i8], [1001 x i8]* %4, i64 0, i64 0
%124 = call i32 (i8*, i8*, ...) @sscanf(i8* %123, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.20, i64 0, i64 0), i32* %5, i32* %5, i32* %5)
%125 = icmp eq i32 %124, 3
br i1 %125, label %126, label %127
126: ; preds = %122
store i32 11, i32* %2
br label %129
127: ; preds = %122
br label %13
128: ; preds = %13
store i32 -1, i32* %2
br label %129
129: ; preds = %128, %126, %121, %116, %107, %102, %96, %91, %86, %80, %75, %70, %65, %60, %55, %50, %43, %38, %33, %28, %23
%130 = load i32, i32* %2
ret i32 %130
}

LLVM IR (-O2):
@.str = [30 x i8] c"00:02:21,606 --> 00:02:23,073\00"
@.str.1 = [38 x i8] c"%d:%d:%d%[,.:]%d --> %d:%d:%d%[,.:]%d\00"
@.str.2 = [4 x i8] c"abc\00"
@.str.3 = [8 x i8] c"[aef]bc\00"
@.str.4 = [9 x i8] c"{%d}{%d}\00"
@.str.5 = [7 x i8] c"{%d}{}\00"
@.str.6 = [9 x i8] c"[%d][%d]\00"
@.str.7 = [24 x i8] c"%d:%d:%d.%d,%d:%d:%d.%d\00"
@.str.8 = [15 x i8] c"{T %d:%d:%d:%d\00"
@.str.9 = [7 x i8] c"<SAMI>\00"
@.str.10 = [24 x i8] c"%d:%d:%d.%d %d:%d:%d.%d\00"
@.str.11 = [8 x i8] c"@%d @%d\00"
@.str.12 = [10 x i8] c"%d:%d:%d:\00"
@.str.13 = [10 x i8] c"%d:%d:%d \00"
@.str.14 = [17 x i8] c"Dialogue: Marked\00"
@.str.15 = [11 x i8] c"Dialogue: \00"
@.str.16 = [10 x i8] c"%d,%d,\22%c\00"
@.str.17 = [10 x i8] c"FORMAT=%d\00"
@.str.18 = [13 x i8] c"FORMAT=TIM%c\00"
@.str.19 = [5 x i8] c"-->>\00"
@.str.20 = [11 x i8] c"[%d:%d:%d]\00"
define i32 @internal_sub_autodetect(i32 %0) {
%2 = alloca [1001 x i8]
%3 = alloca i32
%4 = alloca i8
%5 = getelementptr inbounds [1001 x i8], [1001 x i8]* %2, i64 0, i64 0
%6 = bitcast i32* %3 to i8*
%7 = call i32 (i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %3, i32* %3, i32* %3, i32* %3, i32* %3, i32* %3, i32* %3, i32* %3, i32* %3)
%8 = call i32 (i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%9 = call i32 @llvm.smax.i32(i32 %8, i32 100)
br label %10
10: ; preds = %74, %1
%11 = phi i32 [ %8, %1 ], [ %14, %74 ]
%12 = icmp eq i32 %11, %9
br i1 %12, label %77, label %13
13: ; preds = %10
%14 = add i32 %11, 1
%15 = call i32 @internal_subf_gets(i8* %5, i32 %0)
%16 = icmp eq i32 %15, 0
br i1 %16, label %77, label %17
17: ; preds = %13
%18 = call i32 (i8*, i8*, ...) @sscanf(i8* %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32* %3, i32* %3)
%19 = icmp eq i32 %18, 2
br i1 %19, label %77, label %20
20: ; preds = %17
%21 = call i32 (i8*, i8*, ...) @sscanf(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32* %3)
%22 = icmp eq i32 %21, 1
br i1 %22, label %77, label %23
23: ; preds = %20
%24 = call i32 (i8*, i8*, ...) @sscanf(i8* %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32* %3, i32* %3)
%25 = icmp eq i32 %24, 2
br i1 %25, label %77, label %26
26: ; preds = %23
%27 = call i32 (i8*, i8*, ...) @sscanf(i8* %5, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i32* %3, i32* %3, i32* %3, i32* %3, i32* %3, i32* %3, i32* %3, i32* %3)
%28 = icmp eq i32 %27, 8
br i1 %28, label %77, label %29
29: ; preds = %26
%30 = call i32 (i8*, i8*, ...) @sscanf(i8* %5, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %3, i32* %3, i32* %3, i32* %3, i32* %3, i32* %3, i32* %3, i32* %3, i32* %3)
%31 = icmp eq i32 %30, 10
br i1 %31, label %77, label %32
32: ; preds = %29
%33 = call i32 (i8*, i8*, ...) @sscanf(i8* %5, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i32* %3, i32* %3, i32* %3, i32* %3)
%34 = icmp eq i32 %33, 4
br i1 %34, label %77, label %35
35: ; preds = %32
%36 = call i64 @strstr(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %77
38: ; preds = %35
%39 = call i32 (i8*, i8*, ...) @sscanf(i8* %5, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0), i32* %3, i32* %3, i32* %3, i32* %3, i32* %3, i32* %3, i32* %3, i32* %3)
%40 = icmp eq i32 %39, 8
br i1 %40, label %77, label %41
41: ; preds = %38
%42 = call i32 (i8*, i8*, ...) @sscanf(i8* %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0), i32* %3, i32* %3)
%43 = icmp eq i32 %42, 2
br i1 %43, label %77, label %44
44: ; preds = %41
%45 = call i32 (i8*, i8*, ...) @sscanf(i8* %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i32* %3, i32* %3, i32* %3)
%46 = icmp eq i32 %45, 3
br i1 %46, label %77, label %47
47: ; preds = %44
%48 = call i32 (i8*, i8*, ...) @sscanf(i8* %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), i32* %3, i32* %3, i32* %3)
%49 = icmp eq i32 %48, 3
br i1 %49, label %77, label %50
50: ; preds = %47
%51 = load i8, i8* %5
%52 = icmp eq i8 %51, 60
br i1 %52, label %77, label %53
53: ; preds = %50
%54 = call i32 @memcmp(i8* %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0), i32 16)
%55 = icmp eq i32 %54, 0
br i1 %55, label %77, label %56
56: ; preds = %53
%57 = call i32 @memcmp(i8* %5, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i32 10)
%58 = icmp eq i32 %57, 0
br i1 %58, label %77, label %59
59: ; preds = %56
%60 = call i32 (i8*, i8*, ...) @sscanf(i8* %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.16, i64 0, i64 0), i32* %3, i32* %3, i32* %3)
%61 = icmp eq i32 %60, 3
br i1 %61, label %77, label %62
62: ; preds = %59
%63 = call i32 (i8*, i8*, ...) @sscanf(i8* %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.17, i64 0, i64 0), i32* %3)
%64 = icmp eq i32 %63, 1
br i1 %64, label %77, label %65
65: ; preds = %62
%66 = call i32 (i8*, i8*, ...) @sscanf(i8* %5, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.18, i64 0, i64 0), i8* %4)
%67 = icmp eq i32 %66, 1
%68 = load i8, i8* %4
%69 = icmp eq i8 %68, 69
%70 = select i1 %67, i1 %69, i1 false
br i1 %70, label %77, label %71
71: ; preds = %65
%72 = call i64 @strstr(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0))
%73 = icmp eq i64 %72, 0
br i1 %73, label %74, label %77
74: ; preds = %71
%75 = call i32 (i8*, i8*, ...) @sscanf(i8* %5, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.20, i64 0, i64 0), i32* %3, i32* %3, i32* %3)
%76 = icmp eq i32 %75, 3
br i1 %76, label %77, label %10
77: ; preds = %10, %74, %71, %65, %62, %59, %56, %53, %50, %47, %44, %41, %38, %35, %32, %29, %26, %23, %20, %17, %13
%78 = phi i32 [ -1, %13 ], [ 0, %17 ], [ 0, %20 ], [ 13, %23 ], [ 1, %26 ], [ 2, %29 ], [ 10, %32 ], [ 3, %35 ], [ 12, %38 ], [ 12, %41 ], [ 4, %44 ], [ 4, %47 ], [ 5, %50 ], [ 6, %53 ], [ 6, %56 ], [ 7, %59 ], [ 8, %62 ], [ 8, %65 ], [ 9, %71 ], [ 11, %74 ], [ -1, %10 ]
ret i32 %78
}