#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*/ printf(char *);
int /*<<< orphan*/ qtvrfix(char const *);
int main(int argc, const char *argv[]) {
  if (argc == 1) {
    printf("usage: qtvrfix [qtvr.mov ...]\n");
    printf("       Modifies the specified QTVR movie files in-place to fix a "
           "crashing bug which \n");
    printf("       occurs when the movie is played using QuickTime 7.6.9 or "
           "later.\n");
    printf("       The modifications are backwards-compatible. Non-QTVR movies "
           "will not be affected.\n");
  } else {
    for (int i = 1; i < argc; i++) {
      qtvrfix(argv[i]);
    }
  }
  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    1175 <main+0x55>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
lea    0xf16(%rip),%rdi
call   1030 <printf@plt>
lea    0xf52(%rip),%rdi
call   1030 <printf@plt>
jmp    11ac <main+0x8c>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a7 <main+0x87>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <qtvrfix@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117c <main+0x5c>
jmp    11ac <main+0x8c>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x1,%edi
jne    115c <main+0x3c>
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
lea    0xee1(%rip),%rdi
call   1030 <puts@plt>
lea    0xf2a(%rip),%rdi
call   1030 <puts@plt>
lea    0xf65(%rip),%rdi
call   1030 <puts@plt>
jmp    1182 <main+0x62>
jle    1182 <main+0x62>
mov    %rsi,%r14
mov    %edi,%r15d
mov    $0x1,%ebx
nopl   0x0(%rax)
mov    (%r14,%rbx,8),%rdi
call   1040 <qtvrfix@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1170 <main+0x50>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [31 x i8] c"usage: qtvrfix [qtvr.mov ...]\0A\00"
@.str.1 = [86 x i8] c" Modifies the specified QTVR movie files in-place to fix a crashing bug which \0A\00"
@.str.2 = [72 x i8] c" occurs when the movie is played using QuickTime 7.6.9 or later.\0A\00"
@.str.3 = [90 x i8] c" The modifications are backwards-compatible. Non-QTVR movies will not be affected.\0A\00"
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 %14
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([90 x i8], [90 x i8]* @.str.3, i64 0, i64 0))
br label %30
14: ; preds = %2
store i32 1, i32* %6
br label %15
15: ; preds = %26, %14
%16 = load i32, i32* %6
%17 = load i32, i32* %4
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %29
19: ; preds = %15
%20 = load i8**, i8*** %5
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %20, i64 %22
%24 = load i8*, i8** %23
%25 = call i32 @qtvrfix(i8* %24)
br label %26
26: ; preds = %19
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %15
29: ; preds = %15
br label %30
30: ; preds = %29, %9
ret i32 0
}

LLVM IR (-O2):
@str = [30 x i8] c"usage: qtvrfix [qtvr.mov ...]\00"
@str.4 = [85 x i8] c" Modifies the specified QTVR movie files in-place to fix a crashing bug which \00"
@str.5 = [71 x i8] c" occurs when the movie is played using QuickTime 7.6.9 or later.\00"
@str.6 = [89 x i8] c" The modifications are backwards-compatible. Non-QTVR movies will not be affected.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %20
6: ; preds = %4
%7 = zext i32 %0 to i64
br label %13
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([85 x i8], [85 x i8]* @str.4, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str.5, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([89 x i8], [89 x i8]* @str.6, i64 0, i64 0))
br label %20
13: ; preds = %6, %13
%14 = phi i64 [ 1, %6 ], [ %18, %13 ]
%15 = getelementptr inbounds i8*, i8** %1, i64 %14
%16 = load i8*, i8** %15
%17 = tail call i32 @qtvrfix(i8* %16)
%18 = add nuw nsw i64 %14, 1
%19 = icmp eq i64 %18, %7
br i1 %19, label %20, label %13
20: ; preds = %13, %4, %8
ret i32 0
}