#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*/ em_finish();
int /*<<< orphan*/ em_init();
int /*<<< orphan*/ em_show_whole_EPG();
int /*<<< orphan*/ printf(char *);
int sc_convert_stream_to_packet(char *);
int main(int argc, char *argv[]) {
  if (argc < 2) {
    printf("Enter the name of the .ts file.\n");
    return -1;
  }
  em_init();
  if (sc_convert_stream_to_packet(argv[1]) == -1) {
    printf("Extracting is failed.\n");
    em_finish();
    return -1;
  }
  em_show_whole_EPG();
  em_finish();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1188 <main+0x38>
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d9 <main+0x89>
mov    $0x0,%al
call   1050 <em_init@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <sc_convert_stream_to_packet@plt>
cmp    $0xffffffff,%eax
jne    11c4 <main+0x74>
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <em_finish@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d9 <main+0x89>
mov    $0x0,%al
call   1060 <em_show_whole_EPG@plt>
mov    $0x0,%al
call   1040 <em_finish@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x1,%edi
jg     1166 <main+0x16>
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
jmp    11a3 <main+0x53>
mov    %rsi,%rbx
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <em_init@plt>
mov    0x8(%rbx),%rdi
call   1070 <sc_convert_stream_to_packet@plt>
cmp    $0xffffffff,%eax
je     1190 <main+0x40>
xor    %eax,%eax
call   1060 <em_show_whole_EPG@plt>
xor    %eax,%eax
call   1040 <em_finish@plt>
jmp    11a8 <main+0x58>
lea    0xe69(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <em_finish@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Enter the name of the .ts file.\0A\00"
@.str.1 = [23 x i8] c"Extracting is failed.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %23
10: ; preds = %2
%11 = call i32 (...) @em_init()
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @sc_convert_stream_to_packet(i8* %14)
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %20
17: ; preds = %10
%18 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%19 = call i32 (...) @em_finish()
store i32 -1, i32* %3
br label %23
20: ; preds = %10
%21 = call i32 (...) @em_show_whole_EPG()
%22 = call i32 (...) @em_finish()
store i32 0, i32* %3
br label %23
23: ; preds = %20, %17, %8
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@str = [22 x i8] c"Extracting is failed.\00"
@str.2 = [32 x i8] c"Enter the name of the .ts file.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.2, i64 0, i64 0))
br label %18
6: ; preds = %2
%7 = tail call i32 (...) @em_init()
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @sc_convert_stream_to_packet(i8* %9)
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %15
12: ; preds = %6
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%14 = tail call i32 (...) @em_finish()
br label %18
15: ; preds = %6
%16 = tail call i32 (...) @em_show_whole_EPG()
%17 = tail call i32 (...) @em_finish()
br label %18
18: ; preds = %15, %12, %4
%19 = phi i32 [ -1, %4 ], [ -1, %12 ], [ 0, %15 ]
ret i32 %19
}