#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 Media_DVD_CLUT(int /*<<< orphan*/, unsigned char *);
int Media_DVD_Cell(int /*<<< orphan*/, unsigned char *);
int Media_DVD_ForceFormat(int /*<<< orphan*/);
int Media_DVD_SPUCTRL(int /*<<< orphan*/, unsigned char *);
int Media_DVD_SetSTC(int /*<<< orphan*/);
int Media_DVD_SetStream(int /*<<< orphan*/, int /*<<< orphan*/);
int Media_Flush();
int Media_FrameStep(int /*<<< orphan*/);
int Media_GetMediaTime();
int Media_GetVolume();
int Media_Pause();
int Media_Play();
int Media_PushBuffer(int /*<<< orphan*/, int /*<<< orphan*/, unsigned char *);
int /*<<< orphan*/ Media_Seek(int /*<<< orphan*/, int /*<<< orphan*/);
int Media_SetMute(int /*<<< orphan*/);
int Media_SetVideoRect(int /*<<< orphan*/, int /*<<< orphan*/,
                       int /*<<< orphan*/, int /*<<< orphan*/,
                       int /*<<< orphan*/, int /*<<< orphan*/,
                       int /*<<< orphan*/, int /*<<< orphan*/);
int Media_SetVolume(int /*<<< orphan*/);
int Media_Stop();
int Media_deinit();
int Media_init(int /*<<< orphan*/);
int Media_openurl(unsigned char *);
int /*<<< orphan*/ readInt(int, unsigned char *);
int ExecuteMediaCommand(int cmd, int len, unsigned char *cmddata, int *hasret,
                        int sd) {
  *hasret = 0;
  switch (cmd) {
  case 0:
    *hasret = 1;
    return Media_init(readInt(0, cmddata));
    break;
  case 1:
    *hasret = 1;
    return Media_deinit();
    break;
  case 16:
    *hasret = 1;
    return Media_openurl(&cmddata[4]);
    break;
  case 17:
    *hasret = 1;
    return Media_GetMediaTime();
    break;
  case 18:
    *hasret = 1;
    return Media_SetMute(readInt(0, cmddata));
    break;
  case 19:
    *hasret = 1;
    return Media_Stop();
    break;
  case 20:
    *hasret = 1;
    return Media_Pause();
    break;
  case 21:
    *hasret = 1;
    return Media_Play();
    break;
  case 22:
    *hasret = 1;
    return Media_Flush();
    break;
  case 23:
    *hasret = 1;
    return Media_PushBuffer(readInt(0, cmddata), readInt(4, cmddata),
                            &cmddata[8]);
    break;
  case 26:
    *hasret = 1;
    return Media_GetVolume();
    break;
  case 27:
    *hasret = 1;
    return Media_SetVolume(readInt(0, cmddata));
    break;
  case 25:
    *hasret = 1;
    return Media_SetVideoRect(readInt(0, cmddata), readInt(4, cmddata),
                              readInt(8, cmddata), readInt(12, cmddata),
                              readInt(16, cmddata), readInt(20, cmddata),
                              readInt(24, cmddata), readInt(28, cmddata));
    break;
  case 32:
    *hasret = 1;
    return Media_DVD_Cell(readInt(0, cmddata), &cmddata[4]);
    break;
  case 33:
    *hasret = 1;
    return Media_DVD_CLUT(readInt(0, cmddata), &cmddata[4]);
    break;
  case 34:
    *hasret = 1;
    return Media_DVD_SPUCTRL(readInt(0, cmddata), &cmddata[4]);
    break;
  case 35:
    *hasret = 1;
    return Media_DVD_SetSTC(readInt(0, cmddata));
    break;
  case 36:
    *hasret = 1;
    return Media_DVD_SetStream(readInt(0, cmddata), readInt(4, cmddata));
    break;
  case 37:
    *hasret = 1;
    return Media_DVD_ForceFormat(readInt(0, cmddata));
    break;
  case 28:
    *hasret = 1;
    return Media_FrameStep(readInt(0, cmddata));
    break;
  case 29:
    Media_Seek(readInt(0, cmddata), readInt(4, cmddata));
    break;
  default:
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<ExecuteMediaCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%eax
mov    %rax,-0x30(%rbp)
sub    $0x25,%rax
ja     162f <ExecuteMediaCommand+0x3cf>
mov    -0x30(%rbp),%rax
lea    0xd60(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rsi
xor    %edi,%edi
call   1100 <readInt@plt>
mov    %eax,%edi
call   1040 <Media_init@plt>
mov    %eax,-0x4(%rbp)
jmp    1642 <ExecuteMediaCommand+0x3e2>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    $0x0,%al
call   1150 <Media_deinit@plt>
mov    %eax,-0x4(%rbp)
jmp    1642 <ExecuteMediaCommand+0x3e2>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rdi
add    $0x4,%rdi
call   10f0 <Media_openurl@plt>
mov    %eax,-0x4(%rbp)
jmp    1642 <ExecuteMediaCommand+0x3e2>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    $0x0,%al
call   10a0 <Media_GetMediaTime@plt>
mov    %eax,-0x4(%rbp)
jmp    1642 <ExecuteMediaCommand+0x3e2>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rsi
xor    %edi,%edi
call   1100 <readInt@plt>
mov    %eax,%edi
call   1030 <Media_SetMute@plt>
mov    %eax,-0x4(%rbp)
jmp    1642 <ExecuteMediaCommand+0x3e2>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    $0x0,%al
call   10e0 <Media_Stop@plt>
mov    %eax,-0x4(%rbp)
jmp    1642 <ExecuteMediaCommand+0x3e2>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    $0x0,%al
call   1090 <Media_Pause@plt>
mov    %eax,-0x4(%rbp)
jmp    1642 <ExecuteMediaCommand+0x3e2>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    $0x0,%al
call   10d0 <Media_Play@plt>
mov    %eax,-0x4(%rbp)
jmp    1642 <ExecuteMediaCommand+0x3e2>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    $0x0,%al
call   10b0 <Media_Flush@plt>
mov    %eax,-0x4(%rbp)
jmp    1642 <ExecuteMediaCommand+0x3e2>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rsi
xor    %edi,%edi
call   1100 <readInt@plt>
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rsi
mov    $0x4,%edi
call   1100 <readInt@plt>
mov    -0x34(%rbp),%edi
mov    %eax,%esi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
call   10c0 <Media_PushBuffer@plt>
mov    %eax,-0x4(%rbp)
jmp    1642 <ExecuteMediaCommand+0x3e2>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    $0x0,%al
call   1060 <Media_GetVolume@plt>
mov    %eax,-0x4(%rbp)
jmp    1642 <ExecuteMediaCommand+0x3e2>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rsi
xor    %edi,%edi
call   1100 <readInt@plt>
mov    %eax,%edi
call   1130 <Media_SetVolume@plt>
mov    %eax,-0x4(%rbp)
jmp    1642 <ExecuteMediaCommand+0x3e2>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rsi
xor    %edi,%edi
call   1100 <readInt@plt>
mov    %eax,-0x50(%rbp)
mov    -0x18(%rbp),%rsi
mov    $0x4,%edi
call   1100 <readInt@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x18(%rbp),%rsi
mov    $0x8,%edi
call   1100 <readInt@plt>
mov    %eax,-0x48(%rbp)
mov    -0x18(%rbp),%rsi
mov    $0xc,%edi
call   1100 <readInt@plt>
mov    %eax,-0x44(%rbp)
mov    -0x18(%rbp),%rsi
mov    $0x10,%edi
call   1100 <readInt@plt>
mov    %eax,-0x40(%rbp)
mov    -0x18(%rbp),%rsi
mov    $0x14,%edi
call   1100 <readInt@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rsi
mov    $0x18,%edi
call   1100 <readInt@plt>
mov    %eax,-0x38(%rbp)
mov    -0x18(%rbp),%rsi
mov    $0x1c,%edi
call   1100 <readInt@plt>
mov    -0x50(%rbp),%edi
mov    -0x4c(%rbp),%esi
mov    -0x48(%rbp),%edx
mov    -0x44(%rbp),%ecx
mov    -0x40(%rbp),%r8d
mov    -0x3c(%rbp),%r9d
mov    -0x38(%rbp),%r10d
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1080 <Media_SetVideoRect@plt>
mov    %eax,-0x4(%rbp)
jmp    1642 <ExecuteMediaCommand+0x3e2>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rsi
xor    %edi,%edi
call   1100 <readInt@plt>
mov    %eax,%edi
mov    -0x18(%rbp),%rsi
add    $0x4,%rsi
call   1110 <Media_DVD_Cell@plt>
mov    %eax,-0x4(%rbp)
jmp    1642 <ExecuteMediaCommand+0x3e2>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rsi
xor    %edi,%edi
call   1100 <readInt@plt>
mov    %eax,%edi
mov    -0x18(%rbp),%rsi
add    $0x4,%rsi
call   1070 <Media_DVD_CLUT@plt>
mov    %eax,-0x4(%rbp)
jmp    1642 <ExecuteMediaCommand+0x3e2>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rsi
xor    %edi,%edi
call   1100 <readInt@plt>
mov    %eax,%edi
mov    -0x18(%rbp),%rsi
add    $0x4,%rsi
call   1170 <Media_DVD_SPUCTRL@plt>
mov    %eax,-0x4(%rbp)
jmp    1642 <ExecuteMediaCommand+0x3e2>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rsi
xor    %edi,%edi
call   1100 <readInt@plt>
mov    %eax,%edi
call   1180 <Media_DVD_SetSTC@plt>
mov    %eax,-0x4(%rbp)
jmp    1642 <ExecuteMediaCommand+0x3e2>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rsi
xor    %edi,%edi
call   1100 <readInt@plt>
mov    %eax,-0x54(%rbp)
mov    -0x18(%rbp),%rsi
mov    $0x4,%edi
call   1100 <readInt@plt>
mov    -0x54(%rbp),%edi
mov    %eax,%esi
call   1120 <Media_DVD_SetStream@plt>
mov    %eax,-0x4(%rbp)
jmp    1642 <ExecuteMediaCommand+0x3e2>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rsi
xor    %edi,%edi
call   1100 <readInt@plt>
mov    %eax,%edi
call   1140 <Media_DVD_ForceFormat@plt>
mov    %eax,-0x4(%rbp)
jmp    1642 <ExecuteMediaCommand+0x3e2>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rsi
xor    %edi,%edi
call   1100 <readInt@plt>
mov    %eax,%edi
call   1160 <Media_FrameStep@plt>
mov    %eax,-0x4(%rbp)
jmp    1642 <ExecuteMediaCommand+0x3e2>
mov    -0x18(%rbp),%rsi
xor    %edi,%edi
call   1100 <readInt@plt>
mov    %eax,-0x58(%rbp)
mov    -0x18(%rbp),%rsi
mov    $0x4,%edi
call   1100 <readInt@plt>
mov    -0x58(%rbp),%edi
mov    %eax,%esi
call   1050 <Media_Seek@plt>
jmp    163b <ExecuteMediaCommand+0x3db>
movl   $0xffffffff,-0x4(%rbp)
jmp    1642 <ExecuteMediaCommand+0x3e2>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ExecuteMediaCommand>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,(%rcx)
mov    $0xffffffff,%ebp
cmp    $0x25,%edi
ja     150c <ExecuteMediaCommand+0x2ac>
mov    %rdx,%rbx
mov    %edi,%eax
lea    0xd75(%rip),%rdx
movslq (%rdx,%rax,4),%rax
add    %rdx,%rax
jmp    *%rax
movl   $0x1,(%rcx)
xor    %edi,%edi
mov    %rbx,%rsi
call   1100 <readInt@plt>
mov    %eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <Media_init@plt>
movl   $0x1,(%rcx)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1150 <Media_deinit@plt>
movl   $0x1,(%rcx)
add    $0x4,%rbx
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    10f0 <Media_openurl@plt>
movl   $0x1,(%rcx)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    10a0 <Media_GetMediaTime@plt>
movl   $0x1,(%rcx)
xor    %edi,%edi
mov    %rbx,%rsi
call   1100 <readInt@plt>
mov    %eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <Media_SetMute@plt>
movl   $0x1,(%rcx)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    10e0 <Media_Stop@plt>
movl   $0x1,(%rcx)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1090 <Media_Pause@plt>
movl   $0x1,(%rcx)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    10d0 <Media_Play@plt>
movl   $0x1,(%rcx)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    10b0 <Media_Flush@plt>
movl   $0x1,(%rcx)
xor    %edi,%edi
mov    %rbx,%rsi
call   1100 <readInt@plt>
mov    %eax,%ebp
mov    $0x4,%edi
mov    %rbx,%rsi
call   1100 <readInt@plt>
add    $0x8,%rbx
mov    %ebp,%edi
mov    %eax,%esi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    10c0 <Media_PushBuffer@plt>
movl   $0x1,(%rcx)
xor    %edi,%edi
mov    %rbx,%rsi
call   1100 <readInt@plt>
mov    %eax,0x4(%rsp)
mov    $0x4,%edi
mov    %rbx,%rsi
call   1100 <readInt@plt>
mov    %eax,(%rsp)
mov    $0x8,%edi
mov    %rbx,%rsi
call   1100 <readInt@plt>
mov    %eax,%r12d
mov    $0xc,%edi
mov    %rbx,%rsi
call   1100 <readInt@plt>
mov    %eax,%r13d
mov    $0x10,%edi
mov    %rbx,%rsi
call   1100 <readInt@plt>
mov    %eax,%ebp
mov    $0x14,%edi
mov    %rbx,%rsi
call   1100 <readInt@plt>
mov    %eax,%r14d
mov    $0x18,%edi
mov    %rbx,%rsi
call   1100 <readInt@plt>
mov    %eax,%r15d
mov    $0x1c,%edi
mov    %rbx,%rsi
call   1100 <readInt@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
mov    %r12d,%edx
mov    %r13d,%ecx
mov    %ebp,%r8d
mov    %r14d,%r9d
push   %rax
push   %r15
call   1080 <Media_SetVideoRect@plt>
add    $0x18,%rsp
jmp    1512 <ExecuteMediaCommand+0x2b2>
movl   $0x1,(%rcx)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <Media_GetVolume@plt>
movl   $0x1,(%rcx)
xor    %edi,%edi
mov    %rbx,%rsi
call   1100 <readInt@plt>
mov    %eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1130 <Media_SetVolume@plt>
movl   $0x1,(%rcx)
xor    %edi,%edi
mov    %rbx,%rsi
call   1100 <readInt@plt>
mov    %eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1160 <Media_FrameStep@plt>
xor    %ebp,%ebp
xor    %edi,%edi
mov    %rbx,%rsi
call   1100 <readInt@plt>
mov    %eax,%r14d
mov    $0x4,%edi
mov    %rbx,%rsi
call   1100 <readInt@plt>
mov    %r14d,%edi
mov    %eax,%esi
call   1050 <Media_Seek@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movl   $0x1,(%rcx)
xor    %edi,%edi
mov    %rbx,%rsi
call   1100 <readInt@plt>
add    $0x4,%rbx
mov    %eax,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1110 <Media_DVD_Cell@plt>
movl   $0x1,(%rcx)
xor    %edi,%edi
mov    %rbx,%rsi
call   1100 <readInt@plt>
add    $0x4,%rbx
mov    %eax,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <Media_DVD_CLUT@plt>
movl   $0x1,(%rcx)
xor    %edi,%edi
mov    %rbx,%rsi
call   1100 <readInt@plt>
add    $0x4,%rbx
mov    %eax,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1170 <Media_DVD_SPUCTRL@plt>
movl   $0x1,(%rcx)
xor    %edi,%edi
mov    %rbx,%rsi
call   1100 <readInt@plt>
mov    %eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1180 <Media_DVD_SetSTC@plt>
movl   $0x1,(%rcx)
xor    %edi,%edi
mov    %rbx,%rsi
call   1100 <readInt@plt>
mov    %eax,%ebp
mov    $0x4,%edi
mov    %rbx,%rsi
call   1100 <readInt@plt>
mov    %ebp,%edi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1120 <Media_DVD_SetStream@plt>
movl   $0x1,(%rcx)
xor    %edi,%edi
mov    %rbx,%rsi
call   1100 <readInt@plt>
mov    %eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1140 <Media_DVD_ForceFormat@plt>

LLVM IR (-O0):
define i32 @ExecuteMediaCommand(i32 %0, i32 %1, i8* %2, i32* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32*
%11 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i8* %2, i8** %9
store i32* %3, i32** %10
store i32 %4, i32* %11
%12 = load i32*, i32** %10
store i32 0, i32* %12
%13 = load i32, i32* %7
switch i32 %13, label %132 [
i32 0, label %14
i32 1, label %19
i32 16, label %22
i32 17, label %27
i32 18, label %30
i32 19, label %35
i32 20, label %38
i32 21, label %41
i32 22, label %44
i32 23, label %47
i32 26, label %56
i32 27, label %59
i32 25, label %64
i32 32, label %83
i32 33, label %90
i32 34, label %97
i32 35, label %104
i32 36, label %109
i32 37, label %116
i32 28, label %121
i32 29, label %126
]
14: ; preds = %5
%15 = load i32*, i32** %10
store i32 1, i32* %15
%16 = load i8*, i8** %9
%17 = call i32 @readInt(i32 0, i8* %16)
%18 = call i32 @Media_init(i32 %17)
store i32 %18, i32* %6
br label %134
19: ; preds = %5
%20 = load i32*, i32** %10
store i32 1, i32* %20
%21 = call i32 (...) @Media_deinit()
store i32 %21, i32* %6
br label %134
22: ; preds = %5
%23 = load i32*, i32** %10
store i32 1, i32* %23
%24 = load i8*, i8** %9
%25 = getelementptr inbounds i8, i8* %24, i64 4
%26 = call i32 @Media_openurl(i8* %25)
store i32 %26, i32* %6
br label %134
27: ; preds = %5
%28 = load i32*, i32** %10
store i32 1, i32* %28
%29 = call i32 (...) @Media_GetMediaTime()
store i32 %29, i32* %6
br label %134
30: ; preds = %5
%31 = load i32*, i32** %10
store i32 1, i32* %31
%32 = load i8*, i8** %9
%33 = call i32 @readInt(i32 0, i8* %32)
%34 = call i32 @Media_SetMute(i32 %33)
store i32 %34, i32* %6
br label %134
35: ; preds = %5
%36 = load i32*, i32** %10
store i32 1, i32* %36
%37 = call i32 (...) @Media_Stop()
store i32 %37, i32* %6
br label %134
38: ; preds = %5
%39 = load i32*, i32** %10
store i32 1, i32* %39
%40 = call i32 (...) @Media_Pause()
store i32 %40, i32* %6
br label %134
41: ; preds = %5
%42 = load i32*, i32** %10
store i32 1, i32* %42
%43 = call i32 (...) @Media_Play()
store i32 %43, i32* %6
br label %134
44: ; preds = %5
%45 = load i32*, i32** %10
store i32 1, i32* %45
%46 = call i32 (...) @Media_Flush()
store i32 %46, i32* %6
br label %134
47: ; preds = %5
%48 = load i32*, i32** %10
store i32 1, i32* %48
%49 = load i8*, i8** %9
%50 = call i32 @readInt(i32 0, i8* %49)
%51 = load i8*, i8** %9
%52 = call i32 @readInt(i32 4, i8* %51)
%53 = load i8*, i8** %9
%54 = getelementptr inbounds i8, i8* %53, i64 8
%55 = call i32 @Media_PushBuffer(i32 %50, i32 %52, i8* %54)
store i32 %55, i32* %6
br label %134
56: ; preds = %5
%57 = load i32*, i32** %10
store i32 1, i32* %57
%58 = call i32 (...) @Media_GetVolume()
store i32 %58, i32* %6
br label %134
59: ; preds = %5
%60 = load i32*, i32** %10
store i32 1, i32* %60
%61 = load i8*, i8** %9
%62 = call i32 @readInt(i32 0, i8* %61)
%63 = call i32 @Media_SetVolume(i32 %62)
store i32 %63, i32* %6
br label %134
64: ; preds = %5
%65 = load i32*, i32** %10
store i32 1, i32* %65
%66 = load i8*, i8** %9
%67 = call i32 @readInt(i32 0, i8* %66)
%68 = load i8*, i8** %9
%69 = call i32 @readInt(i32 4, i8* %68)
%70 = load i8*, i8** %9
%71 = call i32 @readInt(i32 8, i8* %70)
%72 = load i8*, i8** %9
%73 = call i32 @readInt(i32 12, i8* %72)
%74 = load i8*, i8** %9
%75 = call i32 @readInt(i32 16, i8* %74)
%76 = load i8*, i8** %9
%77 = call i32 @readInt(i32 20, i8* %76)
%78 = load i8*, i8** %9
%79 = call i32 @readInt(i32 24, i8* %78)
%80 = load i8*, i8** %9
%81 = call i32 @readInt(i32 28, i8* %80)
%82 = call i32 @Media_SetVideoRect(i32 %67, i32 %69, i32 %71, i32 %73, i32 %75, i32 %77, i32 %79, i32 %81)
store i32 %82, i32* %6
br label %134
83: ; preds = %5
%84 = load i32*, i32** %10
store i32 1, i32* %84
%85 = load i8*, i8** %9
%86 = call i32 @readInt(i32 0, i8* %85)
%87 = load i8*, i8** %9
%88 = getelementptr inbounds i8, i8* %87, i64 4
%89 = call i32 @Media_DVD_Cell(i32 %86, i8* %88)
store i32 %89, i32* %6
br label %134
90: ; preds = %5
%91 = load i32*, i32** %10
store i32 1, i32* %91
%92 = load i8*, i8** %9
%93 = call i32 @readInt(i32 0, i8* %92)
%94 = load i8*, i8** %9
%95 = getelementptr inbounds i8, i8* %94, i64 4
%96 = call i32 @Media_DVD_CLUT(i32 %93, i8* %95)
store i32 %96, i32* %6
br label %134
97: ; preds = %5
%98 = load i32*, i32** %10
store i32 1, i32* %98
%99 = load i8*, i8** %9
%100 = call i32 @readInt(i32 0, i8* %99)
%101 = load i8*, i8** %9
%102 = getelementptr inbounds i8, i8* %101, i64 4
%103 = call i32 @Media_DVD_SPUCTRL(i32 %100, i8* %102)
store i32 %103, i32* %6
br label %134
104: ; preds = %5
%105 = load i32*, i32** %10
store i32 1, i32* %105
%106 = load i8*, i8** %9
%107 = call i32 @readInt(i32 0, i8* %106)
%108 = call i32 @Media_DVD_SetSTC(i32 %107)
store i32 %108, i32* %6
br label %134
109: ; preds = %5
%110 = load i32*, i32** %10
store i32 1, i32* %110
%111 = load i8*, i8** %9
%112 = call i32 @readInt(i32 0, i8* %111)
%113 = load i8*, i8** %9
%114 = call i32 @readInt(i32 4, i8* %113)
%115 = call i32 @Media_DVD_SetStream(i32 %112, i32 %114)
store i32 %115, i32* %6
br label %134
116: ; preds = %5
%117 = load i32*, i32** %10
store i32 1, i32* %117
%118 = load i8*, i8** %9
%119 = call i32 @readInt(i32 0, i8* %118)
%120 = call i32 @Media_DVD_ForceFormat(i32 %119)
store i32 %120, i32* %6
br label %134
121: ; preds = %5
%122 = load i32*, i32** %10
store i32 1, i32* %122
%123 = load i8*, i8** %9
%124 = call i32 @readInt(i32 0, i8* %123)
%125 = call i32 @Media_FrameStep(i32 %124)
store i32 %125, i32* %6
br label %134
126: ; preds = %5
%127 = load i8*, i8** %9
%128 = call i32 @readInt(i32 0, i8* %127)
%129 = load i8*, i8** %9
%130 = call i32 @readInt(i32 4, i8* %129)
%131 = call i32 @Media_Seek(i32 %128, i32 %130)
br label %133
132: ; preds = %5
store i32 -1, i32* %6
br label %134
133: ; preds = %126
store i32 0, i32* %6
br label %134
134: ; preds = %133, %132, %121, %116, %109, %104, %97, %90, %83, %64, %59, %56, %47, %44, %41, %38, %35, %30, %27, %22, %19, %14
%135 = load i32, i32* %6
ret i32 %135
}

LLVM IR (-O2):
define i32 @ExecuteMediaCommand(i32 %0, i32 %1, i8* %2, i32* writeonly %3, i32 %4) {
store i32 0, i32* %3
switch i32 %0, label %76 [
i32 0, label %6
i32 1, label %9
i32 16, label %11
i32 17, label %14
i32 18, label %16
i32 19, label %19
i32 20, label %21
i32 21, label %23
i32 22, label %25
i32 23, label %27
i32 26, label %32
i32 27, label %34
i32 25, label %37
i32 32, label %47
i32 33, label %51
i32 34, label %55
i32 35, label %59
i32 36, label %62
i32 37, label %66
i32 28, label %69
i32 29, label %72
]
6: ; preds = %5
store i32 1, i32* %3
%7 = tail call i32 @readInt(i32 0, i8* %2)
%8 = tail call i32 @Media_init(i32 %7)
br label %76
9: ; preds = %5
store i32 1, i32* %3
%10 = tail call i32 (...) @Media_deinit()
br label %76
11: ; preds = %5
store i32 1, i32* %3
%12 = getelementptr inbounds i8, i8* %2, i64 4
%13 = tail call i32 @Media_openurl(i8* %12)
br label %76
14: ; preds = %5
store i32 1, i32* %3
%15 = tail call i32 (...) @Media_GetMediaTime()
br label %76
16: ; preds = %5
store i32 1, i32* %3
%17 = tail call i32 @readInt(i32 0, i8* %2)
%18 = tail call i32 @Media_SetMute(i32 %17)
br label %76
19: ; preds = %5
store i32 1, i32* %3
%20 = tail call i32 (...) @Media_Stop()
br label %76
21: ; preds = %5
store i32 1, i32* %3
%22 = tail call i32 (...) @Media_Pause()
br label %76
23: ; preds = %5
store i32 1, i32* %3
%24 = tail call i32 (...) @Media_Play()
br label %76
25: ; preds = %5
store i32 1, i32* %3
%26 = tail call i32 (...) @Media_Flush()
br label %76
27: ; preds = %5
store i32 1, i32* %3
%28 = tail call i32 @readInt(i32 0, i8* %2)
%29 = tail call i32 @readInt(i32 4, i8* %2)
%30 = getelementptr inbounds i8, i8* %2, i64 8
%31 = tail call i32 @Media_PushBuffer(i32 %28, i32 %29, i8* %30)
br label %76
32: ; preds = %5
store i32 1, i32* %3
%33 = tail call i32 (...) @Media_GetVolume()
br label %76
34: ; preds = %5
store i32 1, i32* %3
%35 = tail call i32 @readInt(i32 0, i8* %2)
%36 = tail call i32 @Media_SetVolume(i32 %35)
br label %76
37: ; preds = %5
store i32 1, i32* %3
%38 = tail call i32 @readInt(i32 0, i8* %2)
%39 = tail call i32 @readInt(i32 4, i8* %2)
%40 = tail call i32 @readInt(i32 8, i8* %2)
%41 = tail call i32 @readInt(i32 12, i8* %2)
%42 = tail call i32 @readInt(i32 16, i8* %2)
%43 = tail call i32 @readInt(i32 20, i8* %2)
%44 = tail call i32 @readInt(i32 24, i8* %2)
%45 = tail call i32 @readInt(i32 28, i8* %2)
%46 = tail call i32 @Media_SetVideoRect(i32 %38, i32 %39, i32 %40, i32 %41, i32 %42, i32 %43, i32 %44, i32 %45)
br label %76
47: ; preds = %5
store i32 1, i32* %3
%48 = tail call i32 @readInt(i32 0, i8* %2)
%49 = getelementptr inbounds i8, i8* %2, i64 4
%50 = tail call i32 @Media_DVD_Cell(i32 %48, i8* %49)
br label %76
51: ; preds = %5
store i32 1, i32* %3
%52 = tail call i32 @readInt(i32 0, i8* %2)
%53 = getelementptr inbounds i8, i8* %2, i64 4
%54 = tail call i32 @Media_DVD_CLUT(i32 %52, i8* %53)
br label %76
55: ; preds = %5
store i32 1, i32* %3
%56 = tail call i32 @readInt(i32 0, i8* %2)
%57 = getelementptr inbounds i8, i8* %2, i64 4
%58 = tail call i32 @Media_DVD_SPUCTRL(i32 %56, i8* %57)
br label %76
59: ; preds = %5
store i32 1, i32* %3
%60 = tail call i32 @readInt(i32 0, i8* %2)
%61 = tail call i32 @Media_DVD_SetSTC(i32 %60)
br label %76
62: ; preds = %5
store i32 1, i32* %3
%63 = tail call i32 @readInt(i32 0, i8* %2)
%64 = tail call i32 @readInt(i32 4, i8* %2)
%65 = tail call i32 @Media_DVD_SetStream(i32 %63, i32 %64)
br label %76
66: ; preds = %5
store i32 1, i32* %3
%67 = tail call i32 @readInt(i32 0, i8* %2)
%68 = tail call i32 @Media_DVD_ForceFormat(i32 %67)
br label %76
69: ; preds = %5
store i32 1, i32* %3
%70 = tail call i32 @readInt(i32 0, i8* %2)
%71 = tail call i32 @Media_FrameStep(i32 %70)
br label %76
72: ; preds = %5
%73 = tail call i32 @readInt(i32 0, i8* %2)
%74 = tail call i32 @readInt(i32 4, i8* %2)
%75 = tail call i32 @Media_Seek(i32 %73, i32 %74)
br label %76
76: ; preds = %5, %72, %69, %66, %62, %59, %55, %51, %47, %37, %34, %32, %27, %25, %23, %21, %19, %16, %14, %11, %9, %6
%77 = phi i32 [ 0, %72 ], [ %71, %69 ], [ %68, %66 ], [ %65, %62 ], [ %61, %59 ], [ %58, %55 ], [ %54, %51 ], [ %50, %47 ], [ %46, %37 ], [ %36, %34 ], [ %33, %32 ], [ %31, %27 ], [ %26, %25 ], [ %24, %23 ], [ %22, %21 ], [ %20, %19 ], [ %18, %16 ], [ %15, %14 ], [ %13, %11 ], [ %10, %9 ], [ %8, %6 ], [ -1, %5 ]
ret i32 %77
}