#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*/ DMX_PES_AUDIO;
int /*<<< orphan*/ DMX_PES_VIDEO;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ O_WRONLY;
int /*<<< orphan*/ close(int);
int errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
char *getenv(char *);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ play_file_dvr(int, int);
int /*<<< orphan*/ set_pid(int, int, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int strtoul(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  char *dmxdev = "/dev/dvb/adapter0/demux0";
  char *dvrdev = "/dev/dvb/adapter0/dvr0";
  int vpid, apid;
  int filefd, dvrfd, vfd, afd;
  if (argc < 4) {
    fprintf(stderr, "usage: test_dvr_play TS-file video-PID audio-PID\n");
    return 1;
  }
  vpid = strtoul(argv[2], NULL, 0);
  apid = strtoul(argv[3], NULL, 0);
  filefd = open(argv[1], O_RDONLY);
  if (filefd == -1) {
    fprintf(stderr, "Failed to open '%s': %d %m\n", argv[1], errno);
    return 1;
  }
  fprintf(stderr, "Playing '%s', video PID 0x%04x, audio PID 0x%04x\n", argv[1],
          vpid, apid);
  if (getenv("DEMUX"))
    dmxdev = getenv("DEMUX");
  if (getenv("DVR"))
    dvrdev = getenv("DVR");
  if ((dvrfd = open(dvrdev, O_WRONLY)) == -1) {
    fprintf(stderr, "Failed to open '%s': %d %m\n", dvrdev, errno);
    return 1;
  }
  if ((vfd = open(dmxdev, O_WRONLY)) == -1) {
    fprintf(stderr, "Failed to open video '%s': %d %m\n", dmxdev, errno);
    return 1;
  }
  if ((afd = open(dmxdev, O_WRONLY)) == -1) {
    fprintf(stderr, "Failed to open audio '%s': %d %m\n", dmxdev, errno);
    return 1;
  }
  set_pid(afd, apid, DMX_PES_AUDIO);
  set_pid(vfd, vpid, DMX_PES_VIDEO);
  play_file_dvr(filefd, dvrfd);
  close(dvrfd);
  close(afd);
  close(vfd);
  close(filefd);
  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)
lea    0xe73(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xe81(%rip),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    11c9 <main+0x59>
mov    0x2e23(%rip),%rax
mov    (%rax),%edi
lea    0xe7a(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1402 <main+0x292>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1080 <strtoul@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1080 <strtoul@plt>
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2ddc(%rip),%rax
mov    (%rax),%esi
call   1070 <open@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0xffffffff,-0x2c(%rbp)
jne    124c <main+0xdc>
mov    0x2db1(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    0x2d98(%rip),%rax
mov    (%rax),%ecx
lea    0xe29(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1402 <main+0x292>
mov    0x2d7d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x24(%rbp),%ecx
mov    -0x28(%rbp),%r8d
lea    0xe13(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
lea    0xe37(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     1298 <main+0x128>
lea    0xe21(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
lea    0xe17(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     12be <main+0x14e>
lea    0xe01(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    0x2cef(%rip),%rax
mov    (%rax),%esi
call   1070 <open@plt>
mov    %eax,-0x30(%rbp)
cmp    $0xffffffff,%eax
jne    130c <main+0x19c>
mov    0x2ced(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
mov    0x2cd8(%rip),%rax
mov    (%rax),%ecx
lea    0xd69(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1402 <main+0x292>
mov    -0x18(%rbp),%rdi
mov    0x2ca1(%rip),%rax
mov    (%rax),%esi
call   1070 <open@plt>
mov    %eax,-0x34(%rbp)
cmp    $0xffffffff,%eax
jne    135a <main+0x1ea>
mov    0x2c9f(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    0x2c8a(%rip),%rax
mov    (%rax),%ecx
lea    0xd73(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1402 <main+0x292>
mov    -0x18(%rbp),%rdi
mov    0x2c53(%rip),%rax
mov    (%rax),%esi
call   1070 <open@plt>
mov    %eax,-0x38(%rbp)
cmp    $0xffffffff,%eax
jne    13a8 <main+0x238>
mov    0x2c51(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    0x2c3c(%rip),%rax
mov    (%rax),%ecx
lea    0xd47(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1402 <main+0x292>
mov    -0x38(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    0x2bfb(%rip),%rax
mov    (%rax),%edx
call   1040 <set_pid@plt>
mov    -0x34(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    0x2c27(%rip),%rax
mov    (%rax),%edx
call   1040 <set_pid@plt>
mov    -0x2c(%rbp),%edi
mov    -0x30(%rbp),%esi
call   1090 <play_file_dvr@plt>
mov    -0x30(%rbp),%edi
call   1050 <close@plt>
mov    -0x38(%rbp),%edi
call   1050 <close@plt>
mov    -0x34(%rbp),%edi
call   1050 <close@plt>
mov    -0x2c(%rbp),%edi
call   1050 <close@plt>
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
push   %rax
cmp    $0x3,%edi
jg     119c <main+0x2c>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
lea    0xea0(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    1347 <main+0x1d7>
mov    %rsi,%rbx
mov    0x10(%rsi),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1080 <strtoul@plt>
mov    %eax,%ebp
mov    0x18(%rbx),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1080 <strtoul@plt>
mov    %eax,%r15d
mov    0x8(%rbx),%rdi
mov    0x2e17(%rip),%rax
mov    (%rax),%esi
call   1070 <open@plt>
mov    %eax,%r12d
mov    0x2df6(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
cmp    $0xffffffff,%r12d
je     12d9 <main+0x169>
lea    0xe8d(%rip),%rsi
mov    %ebp,0x4(%rsp)
mov    %ebp,%ecx
mov    %r15d,%r8d
xor    %eax,%eax
call   1060 <fprintf@plt>
lea    0xea8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
lea    0xde9(%rip),%rbp
cmovne %rax,%rbp
lea    0xe94(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
lea    0xde8(%rip),%rbx
cmovne %rax,%rbx
mov    0x2d7c(%rip),%r13
mov    0x0(%r13),%esi
mov    %rbx,%rdi
call   1070 <open@plt>
cmp    $0xffffffff,%eax
je     12eb <main+0x17b>
mov    %eax,%r14d
mov    0x0(%r13),%esi
mov    %rbp,%rdi
call   1070 <open@plt>
cmp    $0xffffffff,%eax
je     1309 <main+0x199>
mov    %eax,%ebx
mov    0x0(%r13),%esi
mov    %rbp,%rdi
call   1070 <open@plt>
cmp    $0xffffffff,%eax
je     1324 <main+0x1b4>
mov    %eax,%r13d
mov    0x2d26(%rip),%rax
mov    (%rax),%edx
mov    %r13d,%edi
mov    %r15d,%esi
call   1040 <set_pid@plt>
mov    0x2d52(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    0x4(%rsp),%esi
call   1040 <set_pid@plt>
mov    %r12d,%edi
mov    %r14d,%esi
call   1090 <play_file_dvr@plt>
mov    %r14d,%edi
call   1050 <close@plt>
mov    %r13d,%edi
call   1050 <close@plt>
mov    %ebx,%edi
call   1050 <close@plt>
mov    %r12d,%edi
call   1050 <close@plt>
xor    %eax,%eax
jmp    134c <main+0x1dc>
mov    0x2ce8(%rip),%rax
mov    (%rax),%ecx
lea    0xd79(%rip),%rsi
jmp    1340 <main+0x1d0>
mov    0x2cde(%rip),%rax
mov    (%rax),%edi
mov    0x2ccd(%rip),%rax
mov    (%rax),%ecx
lea    0xd5e(%rip),%rsi
mov    %rbx,%rdx
jmp    1340 <main+0x1d0>
mov    0x2cc0(%rip),%rax
mov    (%rax),%edi
mov    0x2caf(%rip),%rax
mov    (%rax),%ecx
lea    0xd98(%rip),%rsi
jmp    133d <main+0x1cd>
mov    0x2ca5(%rip),%rax
mov    (%rax),%edi
mov    0x2c94(%rip),%rax
mov    (%rax),%ecx
lea    0xd9f(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"/dev/dvb/adapter0/demux0\00"
@.str.1 = [23 x i8] c"/dev/dvb/adapter0/dvr0\00"
@stderr = global i32 0
@.str.2 = [50 x i8] c"usage: test_dvr_play TS-file video-PID audio-PID\0A\00"
@O_RDONLY = global i32 0
@.str.3 = [28 x i8] c"Failed to open '%s': %d %m\0A\00"
@errno = global i32 0
@.str.4 = [50 x i8] c"Playing '%s', video PID 0x%04x, audio PID 0x%04x\0A\00"
@.str.5 = [6 x i8] c"DEMUX\00"
@.str.6 = [4 x i8] c"DVR\00"
@O_WRONLY = global i32 0
@.str.7 = [34 x i8] c"Failed to open video '%s': %d %m\0A\00"
@.str.8 = [34 x i8] c"Failed to open audio '%s': %d %m\0A\00"
@DMX_PES_AUDIO = global i32 0
@DMX_PES_VIDEO = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8** %6
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8** %7
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 4
br i1 %15, label %16, label %19
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %109
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call i32 @strtoul(i8* %22, i32* null, i32 0)
store i32 %23, i32* %8
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 3
%26 = load i8*, i8** %25
%27 = call i32 @strtoul(i8* %26, i32* null, i32 0)
store i32 %27, i32* %9
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = load i32, i32* @O_RDONLY
%32 = call i32 @open(i8* %30, i32 %31)
store i32 %32, i32* %10
%33 = load i32, i32* %10
%34 = icmp eq i32 %33, -1
br i1 %34, label %35, label %42
35: ; preds = %19
%36 = load i32, i32* @stderr
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 1
%39 = load i8*, i8** %38
%40 = load i32, i32* @errno
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %39, i32 %40)
store i32 1, i32* %3
br label %109
42: ; preds = %19
%43 = load i32, i32* @stderr
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 1
%46 = load i8*, i8** %45
%47 = load i32, i32* %8
%48 = load i32, i32* %9
%49 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0), i8* %46, i32 %47, i32 %48)
%50 = call i8* @getenv(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%51 = icmp ne i8* %50, null
br i1 %51, label %52, label %54
52: ; preds = %42
%53 = call i8* @getenv(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
store i8* %53, i8** %6
br label %54
54: ; preds = %52, %42
%55 = call i8* @getenv(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%56 = icmp ne i8* %55, null
br i1 %56, label %57, label %59
57: ; preds = %54
%58 = call i8* @getenv(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
store i8* %58, i8** %7
br label %59
59: ; preds = %57, %54
%60 = load i8*, i8** %7
%61 = load i32, i32* @O_WRONLY
%62 = call i32 @open(i8* %60, i32 %61)
store i32 %62, i32* %11
%63 = icmp eq i32 %62, -1
br i1 %63, label %64, label %69
64: ; preds = %59
%65 = load i32, i32* @stderr
%66 = load i8*, i8** %7
%67 = load i32, i32* @errno
%68 = call i32 (i32, i8*, ...) @fprintf(i32 %65, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %66, i32 %67)
store i32 1, i32* %3
br label %109
69: ; preds = %59
%70 = load i8*, i8** %6
%71 = load i32, i32* @O_WRONLY
%72 = call i32 @open(i8* %70, i32 %71)
store i32 %72, i32* %12
%73 = icmp eq i32 %72, -1
br i1 %73, label %74, label %79
74: ; preds = %69
%75 = load i32, i32* @stderr
%76 = load i8*, i8** %6
%77 = load i32, i32* @errno
%78 = call i32 (i32, i8*, ...) @fprintf(i32 %75, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0), i8* %76, i32 %77)
store i32 1, i32* %3
br label %109
79: ; preds = %69
%80 = load i8*, i8** %6
%81 = load i32, i32* @O_WRONLY
%82 = call i32 @open(i8* %80, i32 %81)
store i32 %82, i32* %13
%83 = icmp eq i32 %82, -1
br i1 %83, label %84, label %89
84: ; preds = %79
%85 = load i32, i32* @stderr
%86 = load i8*, i8** %6
%87 = load i32, i32* @errno
%88 = call i32 (i32, i8*, ...) @fprintf(i32 %85, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), i8* %86, i32 %87)
store i32 1, i32* %3
br label %109
89: ; preds = %79
%90 = load i32, i32* %13
%91 = load i32, i32* %9
%92 = load i32, i32* @DMX_PES_AUDIO
%93 = call i32 @set_pid(i32 %90, i32 %91, i32 %92)
%94 = load i32, i32* %12
%95 = load i32, i32* %8
%96 = load i32, i32* @DMX_PES_VIDEO
%97 = call i32 @set_pid(i32 %94, i32 %95, i32 %96)
%98 = load i32, i32* %10
%99 = load i32, i32* %11
%100 = call i32 @play_file_dvr(i32 %98, i32 %99)
%101 = load i32, i32* %11
%102 = call i32 @close(i32 %101)
%103 = load i32, i32* %13
%104 = call i32 @close(i32 %103)
%105 = load i32, i32* %12
%106 = call i32 @close(i32 %105)
%107 = load i32, i32* %10
%108 = call i32 @close(i32 %107)
store i32 0, i32* %3
br label %109
109: ; preds = %89, %84, %74, %64, %35, %16
%110 = load i32, i32* %3
ret i32 %110
}

LLVM IR (-O2):
@.str = [25 x i8] c"/dev/dvb/adapter0/demux0\00"
@.str.1 = [23 x i8] c"/dev/dvb/adapter0/dvr0\00"
@stderr = global i32 0
@.str.2 = [50 x i8] c"usage: test_dvr_play TS-file video-PID audio-PID\0A\00"
@O_RDONLY = global i32 0
@.str.3 = [28 x i8] c"Failed to open '%s': %d %m\0A\00"
@errno = global i32 0
@.str.4 = [50 x i8] c"Playing '%s', video PID 0x%04x, audio PID 0x%04x\0A\00"
@.str.5 = [6 x i8] c"DEMUX\00"
@.str.6 = [4 x i8] c"DVR\00"
@O_WRONLY = global i32 0
@.str.7 = [34 x i8] c"Failed to open video '%s': %d %m\0A\00"
@.str.8 = [34 x i8] c"Failed to open audio '%s': %d %m\0A\00"
@DMX_PES_AUDIO = global i32 0
@DMX_PES_VIDEO = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 4
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
br label %65
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = tail call i32 @strtoul(i8* nocapture %9, i32* null, i32 0)
%11 = getelementptr inbounds i8*, i8** %1, i64 3
%12 = load i8*, i8** %11
%13 = tail call i32 @strtoul(i8* nocapture %12, i32* null, i32 0)
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = load i32, i32* @O_RDONLY
%17 = tail call i32 @open(i8* %15, i32 %16)
%18 = icmp eq i32 %17, -1
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %14
br i1 %18, label %21, label %24
21: ; preds = %7
%22 = load i32, i32* @errno
%23 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %20, i32 %22)
br label %65
24: ; preds = %7
%25 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0), i8* %20, i32 %10, i32 %13)
%26 = tail call i8* @getenv(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%27 = icmp eq i8* %26, null
%28 = select i1 %27, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %26
%29 = tail call i8* @getenv(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%30 = icmp eq i8* %29, null
%31 = select i1 %30, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %29
%32 = load i32, i32* @O_WRONLY
%33 = tail call i32 @open(i8* %31, i32 %32)
%34 = icmp eq i32 %33, -1
br i1 %34, label %35, label %39
35: ; preds = %24
%36 = load i32, i32* @stderr
%37 = load i32, i32* @errno
%38 = tail call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %31, i32 %37)
br label %65
39: ; preds = %24
%40 = load i32, i32* @O_WRONLY
%41 = tail call i32 @open(i8* %28, i32 %40)
%42 = icmp eq i32 %41, -1
br i1 %42, label %43, label %47
43: ; preds = %39
%44 = load i32, i32* @stderr
%45 = load i32, i32* @errno
%46 = tail call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0), i8* %28, i32 %45)
br label %65
47: ; preds = %39
%48 = load i32, i32* @O_WRONLY
%49 = tail call i32 @open(i8* %28, i32 %48)
%50 = icmp eq i32 %49, -1
br i1 %50, label %51, label %55
51: ; preds = %47
%52 = load i32, i32* @stderr
%53 = load i32, i32* @errno
%54 = tail call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), i8* %28, i32 %53)
br label %65
55: ; preds = %47
%56 = load i32, i32* @DMX_PES_AUDIO
%57 = tail call i32 @set_pid(i32 %49, i32 %13, i32 %56)
%58 = load i32, i32* @DMX_PES_VIDEO
%59 = tail call i32 @set_pid(i32 %41, i32 %10, i32 %58)
%60 = tail call i32 @play_file_dvr(i32 %17, i32 %33)
%61 = tail call i32 @close(i32 %33)
%62 = tail call i32 @close(i32 %49)
%63 = tail call i32 @close(i32 %41)
%64 = tail call i32 @close(i32 %17)
br label %65
65: ; preds = %55, %51, %43, %35, %21, %4
%66 = phi i32 [ 1, %4 ], [ 1, %21 ], [ 1, %35 ], [ 1, %43 ], [ 1, %51 ], [ 0, %55 ]
ret i32 %66
}