#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*/ Test_Cam_Dec_Preview(int, char **);
int /*<<< orphan*/ Test_Cam_Enc_Dec(int, char **);
int /*<<< orphan*/ Test_Cam_Encoding(int, char **);
int /*<<< orphan*/ Test_Capture(int, char **);
int /*<<< orphan*/ Test_Display_4_Windows(int, char **);
int /*<<< orphan*/ Test_Display_H263(int, char **);
int /*<<< orphan*/ Test_Display_H264(int, char **);
int /*<<< orphan*/ Test_Display_MPEG4(int, char **);
int /*<<< orphan*/ Test_Display_Optimization1(int, char **);
int /*<<< orphan*/ Test_Display_Optimization2(int, char **);
int /*<<< orphan*/ Test_Display_VC1(int, char **);
int /*<<< orphan*/ Test_Jpeg_Display(int, char **);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ print_menu();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcasecmp(char *, char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
char *strrchr(char *, char);
int /*<<< orphan*/ system(char *);
int main(int argc, char **argv) {
  int num;
  int argnum;
  int files_played = 0;
  printf("%s v%s\n", argv[0], "0.10");
  for (argnum = 1; argnum < argc; argnum++) {
    if (!strncmp(argv[argnum], "--", 2)) {
      continue;
    }
    if (!strcasecmp(argv[argnum], "capture")) {
      printf("Capturing video\n");
      Test_Capture(argc, argv);
      files_played++;
      continue;
    }
    if (!strcasecmp(argv[argnum], "record")) {
      char *fake_args[] = {"dummy", "Cam_encoding_640x480-1.264"};
      Test_Cam_Encoding(argc, argv);
      files_played++;
      printf("Trying to play captured video\n");
      Test_Display_H264(2, fake_args);
      printf("Trying to play jpeg\n");
      Test_Jpeg_Display(0, fake_args);
      continue;
    }
    if (!strcasecmp(argv[argnum], "jpeg")) {
      Test_Jpeg_Display(argc, argv);
      if (argnum < argc)
        argnum++;
      files_played++;
      continue;
    }
    char *ext = strrchr(argv[argnum], '.');
    if (!ext) {
      printf("No file extension found in %s\n", argv[argnum]);
      continue;
    }
    if (!strcasecmp(ext, ".264")) {
      Test_Display_H264(argc, argv);
    } else if (!strcasecmp(ext, ".m4v")) {
      Test_Display_MPEG4(argc, argv);
    } else if (!strcasecmp(ext, ".263")) {
      Test_Display_H263(argc, argv);
    } else if (!strcasecmp(ext, ".rcv")) {
      Test_Display_VC1(argc, argv);
    } else {
      printf("Unhandled extension %s in %s - recognized extensions are .264, "
             ".m4v, .263 and .vc1\n",
             ext, argv[argnum]);
      continue;
    }
    files_played++;
  }
  if (files_played > 0) {
    printf("batch mode: played %d files, exiting now...\n", files_played);
    return 0;
  }
  while (1) {
    system("clear");
    print_menu();
    scanf("%d", &num);
    fflush(stdin);
    switch (num) {
    case 1:
      Test_Display_H264(argc, argv);
      break;
    case 2:
      Test_Display_MPEG4(argc, argv);
      break;
    case 3:
      Test_Display_H263(argc, argv);
      break;
    case 4:
      Test_Display_VC1(argc, argv);
      break;
    case 5:
      Test_Display_4_Windows(argc, argv);
      break;
    case 6:
      Test_Display_Optimization1(argc, argv);
      break;
    case 7:
      Test_Display_Optimization2(argc, argv);
      break;
    case 8:
      Test_Cam_Encoding(argc, argv);
      break;
    case 9:
      Test_Cam_Dec_Preview(argc, argv);
      break;
    case 10:
      Test_Cam_Enc_Dec(argc, argv);
      break;
    case 11:
      Test_Capture(argc, argv);
      break;
    case 12:
      Test_Jpeg_Display(argc, argv);
      break;
    case 13:
      exit(0);
      break;
    default:
      printf("Number is wrong\n");
      exit(0);
      break;
    }
  }
  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,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xdb9(%rip),%rdi
lea    0xdba(%rip),%rdx
mov    $0x0,%al
call   10c0 <printf@plt>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    151b <main+0x2cb>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd92(%rip),%rsi
mov    $0x2,%edx
call   1080 <strncmp@plt>
cmp    $0x0,%eax
jne    12c7 <main+0x77>
jmp    150d <main+0x2bd>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd6a(%rip),%rsi
call   1060 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1310 <main+0xc0>
lea    0xd5d(%rip),%rdi
mov    $0x0,%al
call   10c0 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1120 <Test_Capture@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    150d <main+0x2bd>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd3a(%rip),%rsi
call   1060 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1396 <main+0x146>
mov    0x2ac8(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2ac5(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <Test_Cam_Encoding@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
lea    0xd22(%rip),%rdi
mov    $0x0,%al
call   10c0 <printf@plt>
lea    -0x30(%rbp),%rsi
mov    $0x2,%edi
call   1130 <Test_Display_H264@plt>
lea    0xd25(%rip),%rdi
mov    $0x0,%al
call   10c0 <printf@plt>
lea    -0x30(%rbp),%rsi
xor    %edi,%edi
call   1170 <Test_Jpeg_Display@plt>
jmp    150d <main+0x2bd>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd10(%rip),%rsi
call   1060 <strcasecmp@plt>
cmp    $0x0,%eax
jne    13e6 <main+0x196>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1170 <Test_Jpeg_Display@plt>
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    13d8 <main+0x188>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    150d <main+0x2bd>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    $0x2e,%esi
call   10d0 <strrchr@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    142a <main+0x1da>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xca0(%rip),%rdi
mov    $0x0,%al
call   10c0 <printf@plt>
jmp    150d <main+0x2bd>
mov    -0x38(%rbp),%rdi
lea    0xc4b(%rip),%rsi
call   1060 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1454 <main+0x204>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1130 <Test_Display_H264@plt>
jmp    1504 <main+0x2b4>
mov    -0x38(%rbp),%rdi
lea    0xc7e(%rip),%rsi
call   1060 <strcasecmp@plt>
cmp    $0x0,%eax
jne    147e <main+0x22e>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1150 <Test_Display_MPEG4@plt>
jmp    14ff <main+0x2af>
mov    -0x38(%rbp),%rdi
lea    0xc59(%rip),%rsi
call   1060 <strcasecmp@plt>
cmp    $0x0,%eax
jne    14a8 <main+0x258>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1090 <Test_Display_H263@plt>
jmp    14fa <main+0x2aa>
mov    -0x38(%rbp),%rdi
lea    0xc34(%rip),%rsi
call   1060 <strcasecmp@plt>
cmp    $0x0,%eax
jne    14d2 <main+0x282>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <Test_Display_VC1@plt>
jmp    14f5 <main+0x2a5>
mov    -0x38(%rbp),%rsi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xc03(%rip),%rdi
mov    $0x0,%al
call   10c0 <printf@plt>
jmp    150d <main+0x2bd>
jmp    14fa <main+0x2aa>
jmp    14ff <main+0x2af>
jmp    1504 <main+0x2b4>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1290 <main+0x40>
cmpl   $0x0,-0x1c(%rbp)
jle    153e <main+0x2ee>
mov    -0x1c(%rbp),%esi
lea    0xc11(%rip),%rdi
mov    $0x0,%al
call   10c0 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret
jmp    1543 <main+0x2f3>
lea    0xc23(%rip),%rdi
call   10b0 <system@plt>
xor    %eax,%eax
call   1100 <print_menu@plt>
lea    0xc16(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1140 <scanf@plt>
mov    0x2a73(%rip),%rax
mov    (%rax),%edi
call   1110 <fflush@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x40(%rbp)
sub    $0xc,%eax
ja     1670 <main+0x420>
mov    -0x40(%rbp),%rax
lea    0xa6c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1130 <Test_Display_H264@plt>
jmp    1685 <main+0x435>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1150 <Test_Display_MPEG4@plt>
jmp    1685 <main+0x435>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1090 <Test_Display_H263@plt>
jmp    1685 <main+0x435>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <Test_Display_VC1@plt>
jmp    1685 <main+0x435>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   10a0 <Test_Display_4_Windows@plt>
jmp    1685 <main+0x435>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   10f0 <Test_Display_Optimization1@plt>
jmp    1685 <main+0x435>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <Test_Display_Optimization2@plt>
jmp    1685 <main+0x435>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <Test_Cam_Encoding@plt>
jmp    1685 <main+0x435>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   10e0 <Test_Cam_Dec_Preview@plt>
jmp    1685 <main+0x435>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <Test_Cam_Enc_Dec@plt>
jmp    1685 <main+0x435>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1120 <Test_Capture@plt>
jmp    1685 <main+0x435>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1170 <Test_Jpeg_Display@plt>
jmp    1685 <main+0x435>
xor    %edi,%edi
call   1160 <exit@plt>
lea    0xaff(%rip),%rdi
mov    $0x0,%al
call   10c0 <printf@plt>
xor    %edi,%edi
call   1160 <exit@plt>
jmp    1543 <main+0x2f3>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r12
mov    %edi,%r15d
mov    (%rsi),%rsi
lea    0xdb6(%rip),%rdi
lea    0xdb7(%rip),%rdx
xor    %eax,%eax
call   10d0 <printf@plt>
cmp    $0x2,%r15d
jl     14d0 <main+0x270>
mov    $0x1,%r14d
lea    0xd9e(%rip),%rbx
movl   $0x0,0xc(%rsp)
jmp    12d9 <main+0x79>
nopl   (%rax)
lea    0xe85(%rip),%rdi
call   10a0 <puts@plt>
mov    %r15d,%edi
mov    %r12,%rsi
call   1130 <Test_Capture@plt>
addl   $0x1,0xc(%rsp)
add    $0x1,%r14d
cmp    %r15d,%r14d
jge    1494 <main+0x234>
movslq %r14d,%rbp
mov    (%r12,%rbp,8),%rdi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1080 <strncmp@plt>
test   %eax,%eax
je     12cc <main+0x6c>
mov    (%r12,%rbp,8),%r13
mov    %r13,%rdi
lea    0xd45(%rip),%rsi
call   1060 <strcasecmp@plt>
test   %eax,%eax
je     12b0 <main+0x50>
mov    %r13,%rdi
lea    0xd3a(%rip),%rsi
call   1060 <strcasecmp@plt>
test   %eax,%eax
je     13ca <main+0x16a>
mov    %r13,%rdi
lea    0xe50(%rip),%rsi
call   1060 <strcasecmp@plt>
test   %eax,%eax
je     141f <main+0x1bf>
mov    %r15d,%ebp
mov    %r13,%rdi
mov    $0x2e,%esi
call   10e0 <strrchr@plt>
test   %rax,%rax
je     1433 <main+0x1d3>
mov    %rax,%r15
mov    %rax,%rdi
lea    0xd13(%rip),%rsi
call   1060 <strcasecmp@plt>
test   %eax,%eax
je     144c <main+0x1ec>
mov    %r15,%rdi
lea    0xd20(%rip),%rsi
call   1060 <strcasecmp@plt>
test   %eax,%eax
je     145e <main+0x1fe>
mov    %r15,%rdi
lea    0xd0e(%rip),%rsi
call   1060 <strcasecmp@plt>
test   %eax,%eax
je     1470 <main+0x210>
mov    %r15,%rdi
lea    0xcfc(%rip),%rsi
call   1060 <strcasecmp@plt>
test   %eax,%eax
je     1482 <main+0x222>
lea    0xced(%rip),%rdi
mov    %r15,%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   10d0 <printf@plt>
mov    %ebp,%r15d
jmp    12cc <main+0x6c>
movaps 0x2a2f(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    %r15d,%edi
mov    %r12,%rsi
call   1070 <Test_Cam_Encoding@plt>
addl   $0x1,0xc(%rsp)
lea    0xd5f(%rip),%rdi
call   10a0 <puts@plt>
mov    $0x2,%edi
lea    0x10(%rsp),%rbp
mov    %rbp,%rsi
call   1140 <Test_Display_H264@plt>
lea    0xd5f(%rip),%rdi
call   10a0 <puts@plt>
xor    %edi,%edi
mov    %rbp,%rsi
call   1180 <Test_Jpeg_Display@plt>
jmp    12cc <main+0x6c>
mov    %r15d,%edi
mov    %r12,%rsi
call   1180 <Test_Jpeg_Display@plt>
add    $0x1,%r14d
jmp    12c7 <main+0x67>
lea    0xc3a(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   10d0 <printf@plt>
mov    %ebp,%r15d
jmp    12cc <main+0x6c>
mov    %ebp,%r15d
mov    %ebp,%edi
mov    %r12,%rsi
call   1140 <Test_Display_H264@plt>
jmp    12c7 <main+0x67>
mov    %ebp,%r15d
mov    %ebp,%edi
mov    %r12,%rsi
call   1160 <Test_Display_MPEG4@plt>
jmp    12c7 <main+0x67>
mov    %ebp,%r15d
mov    %ebp,%edi
mov    %r12,%rsi
call   1090 <Test_Display_H263@plt>
jmp    12c7 <main+0x67>
mov    %ebp,%r15d
mov    %ebp,%edi
mov    %r12,%rsi
call   1040 <Test_Display_VC1@plt>
jmp    12c7 <main+0x67>
mov    0xc(%rsp),%esi
test   %esi,%esi
jle    14d0 <main+0x270>
lea    0xc53(%rip),%rdi
xor    %eax,%eax
call   10d0 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r15d,%edi
mov    %r12,%rsi
call   1180 <Test_Jpeg_Display@plt>
cs nopw 0x0(%rax,%rax,1)
lea    0xc4c(%rip),%rdi
call   10c0 <system@plt>
xor    %eax,%eax
call   1110 <print_menu@plt>
lea    0xc3f(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1150 <scanf@plt>
mov    0x2ae5(%rip),%rax
mov    (%rax),%edi
call   1120 <fflush@plt>
mov    0x10(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0xc,%eax
ja     15c9 <main+0x369>
lea    0xae7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %r15d,%edi
mov    %r12,%rsi
call   1140 <Test_Display_H264@plt>
jmp    14d0 <main+0x270>
mov    %r15d,%edi
mov    %r12,%rsi
call   1160 <Test_Display_MPEG4@plt>
jmp    14d0 <main+0x270>
mov    %r15d,%edi
mov    %r12,%rsi
call   1090 <Test_Display_H263@plt>
jmp    14d0 <main+0x270>
mov    %r15d,%edi
mov    %r12,%rsi
call   1040 <Test_Display_VC1@plt>
jmp    14d0 <main+0x270>
mov    %r15d,%edi
mov    %r12,%rsi
call   10b0 <Test_Display_4_Windows@plt>
jmp    14d0 <main+0x270>
mov    %r15d,%edi
mov    %r12,%rsi
call   1100 <Test_Display_Optimization1@plt>
jmp    14d0 <main+0x270>
mov    %r15d,%edi
mov    %r12,%rsi
call   1030 <Test_Display_Optimization2@plt>
jmp    14d0 <main+0x270>
mov    %r15d,%edi
mov    %r12,%rsi
call   1070 <Test_Cam_Encoding@plt>
jmp    14d0 <main+0x270>
mov    %r15d,%edi
mov    %r12,%rsi
call   10f0 <Test_Cam_Dec_Preview@plt>
jmp    14d0 <main+0x270>
mov    %r15d,%edi
mov    %r12,%rsi
call   1050 <Test_Cam_Enc_Dec@plt>
jmp    14d0 <main+0x270>
mov    %r15d,%edi
mov    %r12,%rsi
call   1130 <Test_Capture@plt>
jmp    14d0 <main+0x270>
lea    0xb5c(%rip),%rdi
call   10a0 <puts@plt>
xor    %edi,%edi
call   1170 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"%s v%s\0A\00"
@.str.1 = [5 x i8] c"0.10\00"
@.str.2 = [3 x i8] c"--\00"
@.str.3 = [8 x i8] c"capture\00"
@.str.4 = [17 x i8] c"Capturing video\0A\00"
@.str.5 = [7 x i8] c"record\00"
@.str.6 = [6 x i8] c"dummy\00"
@.str.7 = [27 x i8] c"Cam_encoding_640x480-1.264\00"
@__const.main.fake_args = [2 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i32 0, i32 0)]
@.str.8 = [31 x i8] c"Trying to play captured video\0A\00"
@.str.9 = [21 x i8] c"Trying to play jpeg\0A\00"
@.str.10 = [5 x i8] c"jpeg\00"
@.str.11 = [31 x i8] c"No file extension found in %s\0A\00"
@.str.12 = [5 x i8] c".264\00"
@.str.13 = [5 x i8] c".m4v\00"
@.str.14 = [5 x i8] c".263\00"
@.str.15 = [5 x i8] c".rcv\00"
@.str.16 = [84 x i8] c"Unhandled extension %s in %s - recognized extensions are .264, .m4v, .263 and .vc1\0A\00"
@.str.17 = [45 x i8] c"batch mode: played %d files, exiting now...\0A\00"
@.str.18 = [6 x i8] c"clear\00"
@.str.19 = [3 x i8] c"%d\00"
@stdin = global i32 0
@.str.20 = [17 x i8] c"Number is wrong\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 i32
%9 = alloca [2 x i8*]
%10 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %7
br label %15
15: ; preds = %147, %2
%16 = load i32, i32* %7
%17 = load i32, i32* %4
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %150
19: ; preds = %15
%20 = load i8**, i8*** %5
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %20, i64 %22
%24 = load i8*, i8** %23
%25 = call i32 @strncmp(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
%26 = icmp ne i32 %25, 0
br i1 %26, label %28, label %27
27: ; preds = %19
br label %147
28: ; preds = %19
%29 = load i8**, i8*** %5
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %29, i64 %31
%33 = load i8*, i8** %32
%34 = call i32 @strcasecmp(i8* %33, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%35 = icmp ne i32 %34, 0
br i1 %35, label %43, label %36
36: ; preds = %28
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%38 = load i32, i32* %4
%39 = load i8**, i8*** %5
%40 = call i32 @Test_Capture(i32 %38, i8** %39)
%41 = load i32, i32* %8
%42 = add nsw i32 %41, 1
store i32 %42, i32* %8
br label %147
43: ; preds = %28
%44 = load i8**, i8*** %5
%45 = load i32, i32* %7
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8*, i8** %44, i64 %46
%48 = load i8*, i8** %47
%49 = call i32 @strcasecmp(i8* %48, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%50 = icmp ne i32 %49, 0
br i1 %50, label %64, label %51
51: ; preds = %43
%52 = bitcast [2 x i8*]* %9 to i8*
%53 = load i32, i32* %4
%54 = load i8**, i8*** %5
%55 = call i32 @Test_Cam_Encoding(i32 %53, i8** %54)
%56 = load i32, i32* %8
%57 = add nsw i32 %56, 1
store i32 %57, i32* %8
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0))
%59 = getelementptr inbounds [2 x i8*], [2 x i8*]* %9, i64 0, i64 0
%60 = call i32 @Test_Display_H264(i32 2, i8** %59)
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0))
%62 = getelementptr inbounds [2 x i8*], [2 x i8*]* %9, i64 0, i64 0
%63 = call i32 @Test_Jpeg_Display(i32 0, i8** %62)
br label %147
64: ; preds = %43
%65 = load i8**, i8*** %5
%66 = load i32, i32* %7
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8*, i8** %65, i64 %67
%69 = load i8*, i8** %68
%70 = call i32 @strcasecmp(i8* %69, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%71 = icmp ne i32 %70, 0
br i1 %71, label %85, label %72
72: ; preds = %64
%73 = load i32, i32* %4
%74 = load i8**, i8*** %5
%75 = call i32 @Test_Jpeg_Display(i32 %73, i8** %74)
%76 = load i32, i32* %7
%77 = load i32, i32* %4
%78 = icmp slt i32 %76, %77
br i1 %78, label %79, label %82
79: ; preds = %72
%80 = load i32, i32* %7
%81 = add nsw i32 %80, 1
store i32 %81, i32* %7
br label %82
82: ; preds = %79, %72
%83 = load i32, i32* %8
%84 = add nsw i32 %83, 1
store i32 %84, i32* %8
br label %147
85: ; preds = %64
%86 = load i8**, i8*** %5
%87 = load i32, i32* %7
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i8*, i8** %86, i64 %88
%90 = load i8*, i8** %89
%91 = call i8* @strrchr(i8* %90, i8 signext 46)
store i8* %91, i8** %10
%92 = load i8*, i8** %10
%93 = icmp ne i8* %92, null
br i1 %93, label %101, label %94
94: ; preds = %85
%95 = load i8**, i8*** %5
%96 = load i32, i32* %7
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds i8*, i8** %95, i64 %97
%99 = load i8*, i8** %98
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), i8* %99)
br label %147
101: ; preds = %85
%102 = load i8*, i8** %10
%103 = call i32 @strcasecmp(i8* %102, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%104 = icmp ne i32 %103, 0
br i1 %104, label %109, label %105
105: ; preds = %101
%106 = load i32, i32* %4
%107 = load i8**, i8*** %5
%108 = call i32 @Test_Display_H264(i32 %106, i8** %107)
br label %144
109: ; preds = %101
%110 = load i8*, i8** %10
%111 = call i32 @strcasecmp(i8* %110, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0))
%112 = icmp ne i32 %111, 0
br i1 %112, label %117, label %113
113: ; preds = %109
%114 = load i32, i32* %4
%115 = load i8**, i8*** %5
%116 = call i32 @Test_Display_MPEG4(i32 %114, i8** %115)
br label %143
117: ; preds = %109
%118 = load i8*, i8** %10
%119 = call i32 @strcasecmp(i8* %118, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
%120 = icmp ne i32 %119, 0
br i1 %120, label %125, label %121
121: ; preds = %117
%122 = load i32, i32* %4
%123 = load i8**, i8*** %5
%124 = call i32 @Test_Display_H263(i32 %122, i8** %123)
br label %142
125: ; preds = %117
%126 = load i8*, i8** %10
%127 = call i32 @strcasecmp(i8* %126, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0))
%128 = icmp ne i32 %127, 0
br i1 %128, label %133, label %129
129: ; preds = %125
%130 = load i32, i32* %4
%131 = load i8**, i8*** %5
%132 = call i32 @Test_Display_VC1(i32 %130, i8** %131)
br label %141
133: ; preds = %125
%134 = load i8*, i8** %10
%135 = load i8**, i8*** %5
%136 = load i32, i32* %7
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds i8*, i8** %135, i64 %137
%139 = load i8*, i8** %138
%140 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str.16, i64 0, i64 0), i8* %134, i8* %139)
br label %147
141: ; preds = %129
br label %142
142: ; preds = %141, %121
br label %143
143: ; preds = %142, %113
br label %144
144: ; preds = %143, %105
%145 = load i32, i32* %8
%146 = add nsw i32 %145, 1
store i32 %146, i32* %8
br label %147
147: ; preds = %144, %133, %94, %82, %51, %36, %27
%148 = load i32, i32* %7
%149 = add nsw i32 %148, 1
store i32 %149, i32* %7
br label %15
150: ; preds = %15
%151 = load i32, i32* %8
%152 = icmp sgt i32 %151, 0
br i1 %152, label %153, label %156
153: ; preds = %150
%154 = load i32, i32* %8
%155 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.17, i64 0, i64 0), i32 %154)
ret i32 0
156: ; preds = %150
br label %157
157: ; preds = %156, %217
%158 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.18, i64 0, i64 0))
%159 = call i32 (...) @print_menu()
%160 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.19, i64 0, i64 0), i32* %6)
%161 = load i32, i32* @stdin
%162 = call i32 @fflush(i32 %161)
%163 = load i32, i32* %6
switch i32 %163, label %214 [
i32 1, label %164
i32 2, label %168
i32 3, label %172
i32 4, label %176
i32 5, label %180
i32 6, label %184
i32 7, label %188
i32 8, label %192
i32 9, label %196
i32 10, label %200
i32 11, label %204
i32 12, label %208
i32 13, label %212
]
164: ; preds = %157
%165 = load i32, i32* %4
%166 = load i8**, i8*** %5
%167 = call i32 @Test_Display_H264(i32 %165, i8** %166)
br label %217
168: ; preds = %157
%169 = load i32, i32* %4
%170 = load i8**, i8*** %5
%171 = call i32 @Test_Display_MPEG4(i32 %169, i8** %170)
br label %217
172: ; preds = %157
%173 = load i32, i32* %4
%174 = load i8**, i8*** %5
%175 = call i32 @Test_Display_H263(i32 %173, i8** %174)
br label %217
176: ; preds = %157
%177 = load i32, i32* %4
%178 = load i8**, i8*** %5
%179 = call i32 @Test_Display_VC1(i32 %177, i8** %178)
br label %217
180: ; preds = %157
%181 = load i32, i32* %4
%182 = load i8**, i8*** %5
%183 = call i32 @Test_Display_4_Windows(i32 %181, i8** %182)
br label %217
184: ; preds = %157
%185 = load i32, i32* %4
%186 = load i8**, i8*** %5
%187 = call i32 @Test_Display_Optimization1(i32 %185, i8** %186)
br label %217
188: ; preds = %157
%189 = load i32, i32* %4
%190 = load i8**, i8*** %5
%191 = call i32 @Test_Display_Optimization2(i32 %189, i8** %190)
br label %217
192: ; preds = %157
%193 = load i32, i32* %4
%194 = load i8**, i8*** %5
%195 = call i32 @Test_Cam_Encoding(i32 %193, i8** %194)
br label %217
196: ; preds = %157
%197 = load i32, i32* %4
%198 = load i8**, i8*** %5
%199 = call i32 @Test_Cam_Dec_Preview(i32 %197, i8** %198)
br label %217
200: ; preds = %157
%201 = load i32, i32* %4
%202 = load i8**, i8*** %5
%203 = call i32 @Test_Cam_Enc_Dec(i32 %201, i8** %202)
br label %217
204: ; preds = %157
%205 = load i32, i32* %4
%206 = load i8**, i8*** %5
%207 = call i32 @Test_Capture(i32 %205, i8** %206)
br label %217
208: ; preds = %157
%209 = load i32, i32* %4
%210 = load i8**, i8*** %5
%211 = call i32 @Test_Jpeg_Display(i32 %209, i8** %210)
br label %217
212: ; preds = %157
%213 = call i32 @exit(i32 0)
unreachable
214: ; preds = %157
%215 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.20, i64 0, i64 0))
%216 = call i32 @exit(i32 0)
unreachable
217: ; preds = %208, %204, %200, %196, %192, %188, %184, %180, %176, %172, %168, %164
br label %157
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s v%s\0A\00"
@.str.1 = [5 x i8] c"0.10\00"
@.str.2 = [3 x i8] c"--\00"
@.str.3 = [8 x i8] c"capture\00"
@.str.5 = [7 x i8] c"record\00"
@.str.6 = [6 x i8] c"dummy\00"
@.str.7 = [27 x i8] c"Cam_encoding_640x480-1.264\00"
@__const.main.fake_args = [2 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i32 0, i32 0)]
@.str.10 = [5 x i8] c"jpeg\00"
@.str.11 = [31 x i8] c"No file extension found in %s\0A\00"
@.str.12 = [5 x i8] c".264\00"
@.str.13 = [5 x i8] c".m4v\00"
@.str.14 = [5 x i8] c".263\00"
@.str.15 = [5 x i8] c".rcv\00"
@.str.16 = [84 x i8] c"Unhandled extension %s in %s - recognized extensions are .264, .m4v, .263 and .vc1\0A\00"
@.str.17 = [45 x i8] c"batch mode: played %d files, exiting now...\0A\00"
@.str.18 = [6 x i8] c"clear\00"
@.str.19 = [3 x i8] c"%d\00"
@stdin = global i32 0
@str = [16 x i8] c"Number is wrong\00"
@str.21 = [16 x i8] c"Capturing video\00"
@str.22 = [30 x i8] c"Trying to play captured video\00"
@str.23 = [20 x i8] c"Trying to play jpeg\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca [2 x i8*]
%5 = bitcast i32* %3 to i8*
%6 = load i8*, i8** %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp sgt i32 %0, 1
br i1 %8, label %9, label %81
9: ; preds = %2
%10 = bitcast [2 x i8*]* %4 to i8*
%11 = getelementptr inbounds [2 x i8*], [2 x i8*]* %4, i64 0, i64 0
br label %12
12: ; preds = %9, %74
%13 = phi i32 [ 0, %9 ], [ %76, %74 ]
%14 = phi i32 [ 1, %9 ], [ %77, %74 ]
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %1, i64 %15
%17 = load i8*, i8** %16
%18 = call i32 @strncmp(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
%19 = icmp eq i32 %18, 0
br i1 %19, label %74, label %20
20: ; preds = %12
%21 = load i8*, i8** %16
%22 = call i32 @strcasecmp(i8* %21, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %20
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.21, i64 0, i64 0))
%26 = call i32 @Test_Capture(i32 %0, i8** %1)
%27 = add nsw i32 %13, 1
br label %74
28: ; preds = %20
%29 = call i32 @strcasecmp(i8* %21, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %38
31: ; preds = %28
%32 = call i32 @Test_Cam_Encoding(i32 %0, i8** %1)
%33 = add nsw i32 %13, 1
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.22, i64 0, i64 0))
%35 = call i32 @Test_Display_H264(i32 2, i8** %11)
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.23, i64 0, i64 0))
%37 = call i32 @Test_Jpeg_Display(i32 0, i8** %11)
br label %74
38: ; preds = %28
%39 = call i32 @strcasecmp(i8* %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %45
41: ; preds = %38
%42 = call i32 @Test_Jpeg_Display(i32 %0, i8** %1)
%43 = add nsw i32 %14, 1
%44 = add nsw i32 %13, 1
br label %74
45: ; preds = %38
%46 = call i8* @strrchr(i8* dereferenceable(1) %21, i8 signext 46)
%47 = icmp eq i8* %46, null
br i1 %47, label %48, label %50
48: ; preds = %45
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), i8* %21)
br label %74
50: ; preds = %45
%51 = call i32 @strcasecmp(i8* %46, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %55
53: ; preds = %50
%54 = call i32 @Test_Display_H264(i32 %0, i8** %1)
br label %72
55: ; preds = %50
%56 = call i32 @strcasecmp(i8* %46, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0))
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %60
58: ; preds = %55
%59 = call i32 @Test_Display_MPEG4(i32 %0, i8** %1)
br label %72
60: ; preds = %55
%61 = call i32 @strcasecmp(i8* %46, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
%62 = icmp eq i32 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %60
%64 = call i32 @Test_Display_H263(i32 %0, i8** %1)
br label %72
65: ; preds = %60
%66 = call i32 @strcasecmp(i8* %46, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0))
%67 = icmp eq i32 %66, 0
br i1 %67, label %68, label %70
68: ; preds = %65
%69 = call i32 @Test_Display_VC1(i32 %0, i8** %1)
br label %72
70: ; preds = %65
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([84 x i8], [84 x i8]* @.str.16, i64 0, i64 0), i8* %46, i8* %21)
br label %74
72: ; preds = %58, %68, %63, %53
%73 = add nsw i32 %13, 1
br label %74
74: ; preds = %48, %70, %72, %12, %41, %31, %24
%75 = phi i32 [ %43, %41 ], [ %14, %31 ], [ %14, %24 ], [ %14, %12 ], [ %14, %72 ], [ %14, %70 ], [ %14, %48 ]
%76 = phi i32 [ %44, %41 ], [ %33, %31 ], [ %27, %24 ], [ %13, %12 ], [ %73, %72 ], [ %13, %70 ], [ %13, %48 ]
%77 = add nsw i32 %75, 1
%78 = icmp slt i32 %77, %0
br i1 %78, label %12, label %79
79: ; preds = %74
%80 = icmp sgt i32 %76, 0
br i1 %80, label %82, label %81
81: ; preds = %2, %79
br label %84
82: ; preds = %79
%83 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.17, i64 0, i64 0), i32 %76)
ret i32 0
84: ; preds = %115, %81
%85 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.18, i64 0, i64 0))
%86 = call i32 (...) @print_menu()
%87 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.19, i64 0, i64 0), i32* %3)
%88 = load i32, i32* @stdin
%89 = call i32 @fflush(i32 %88)
%90 = load i32, i32* %3
switch i32 %90, label %118 [
i32 1, label %91
i32 2, label %93
i32 3, label %95
i32 4, label %97
i32 5, label %99
i32 6, label %101
i32 7, label %103
i32 8, label %105
i32 9, label %107
i32 10, label %109
i32 11, label %111
i32 12, label %113
i32 13, label %116
]
91: ; preds = %84
%92 = call i32 @Test_Display_H264(i32 %0, i8** %1)
br label %115
93: ; preds = %84
%94 = call i32 @Test_Display_MPEG4(i32 %0, i8** %1)
br label %115
95: ; preds = %84
%96 = call i32 @Test_Display_H263(i32 %0, i8** %1)
br label %115
97: ; preds = %84
%98 = call i32 @Test_Display_VC1(i32 %0, i8** %1)
br label %115
99: ; preds = %84
%100 = call i32 @Test_Display_4_Windows(i32 %0, i8** %1)
br label %115
101: ; preds = %84
%102 = call i32 @Test_Display_Optimization1(i32 %0, i8** %1)
br label %115
103: ; preds = %84
%104 = call i32 @Test_Display_Optimization2(i32 %0, i8** %1)
br label %115
105: ; preds = %84
%106 = call i32 @Test_Cam_Encoding(i32 %0, i8** %1)
br label %115
107: ; preds = %84
%108 = call i32 @Test_Cam_Dec_Preview(i32 %0, i8** %1)
br label %115
109: ; preds = %84
%110 = call i32 @Test_Cam_Enc_Dec(i32 %0, i8** %1)
br label %115
111: ; preds = %84
%112 = call i32 @Test_Capture(i32 %0, i8** %1)
br label %115
113: ; preds = %84
%114 = call i32 @Test_Jpeg_Display(i32 %0, i8** %1)
br label %115
115: ; preds = %113, %111, %109, %107, %105, %103, %101, %99, %97, %95, %93, %91
br label %84
116: ; preds = %84
%117 = call i32 @exit(i32 0)
unreachable
118: ; preds = %84
%119 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%120 = call i32 @exit(i32 0)
unreachable
}