#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*/ convert_yuv422_to_rgb24_buffer(unsigned char *,
                                                  unsigned char *, int, int);
int /*<<< orphan*/ memset(unsigned char *, int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ rgb24_to_bmp(unsigned char *, int, int, char *);
int main(int argc, char *argv[]) {
  printf("Program start...\n");
  unsigned char yuv422buf[(800) * (480) * 2];
  memset(yuv422buf, 0xaa, (800) * (480) * 2);
  unsigned char rgb24buf[(800) * (480) * 3];
  convert_yuv422_to_rgb24_buffer(yuv422buf, rgb24buf, (800), (480));
  rgb24_to_bmp(rgb24buf, (800), (480), "sample.bmp");
  printf("Program exit\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d4c10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
lea    -0xbb810(%rbp),%rdi
mov    $0xaa,%esi
mov    $0xbb800,%edx
call   1040 <memset@plt>
lea    -0xbb810(%rbp),%rdi
lea    -0x1d4c10(%rbp),%rsi
mov    $0x320,%edx
mov    $0x1e0,%ecx
call   1060 <convert_yuv422_to_rgb24_buffer@plt>
lea    -0x1d4c10(%rbp),%rdi
mov    $0x320,%esi
mov    $0x1e0,%edx
lea    0xe62(%rip),%rcx
call   1050 <rgb24_to_bmp@plt>
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1d4c10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x1d4c08,%rsp
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0xaa,%esi
mov    $0xbb800,%edx
call   1040 <memset@plt>
lea    0xbb800(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x320,%edx
mov    $0x1e0,%ecx
call   1060 <convert_yuv422_to_rgb24_buffer@plt>
lea    0xe71(%rip),%rcx
mov    %rbx,%rdi
mov    $0x320,%esi
mov    $0x1e0,%edx
call   1050 <rgb24_to_bmp@plt>
lea    0xe74(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x1d4c08,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Program start...\0A\00"
@.str.1 = [11 x i8] c"sample.bmp\00"
@.str.2 = [14 x i8] c"Program exit\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [768000 x i8]
%7 = alloca [1152000 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [768000 x i8], [768000 x i8]* %6, i64 0, i64 0
%10 = call i32 @memset(i8* %9, i32 170, i32 768000)
%11 = getelementptr inbounds [768000 x i8], [768000 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [1152000 x i8], [1152000 x i8]* %7, i64 0, i64 0
%13 = call i32 @convert_yuv422_to_rgb24_buffer(i8* %11, i8* %12, i32 800, i32 480)
%14 = getelementptr inbounds [1152000 x i8], [1152000 x i8]* %7, i64 0, i64 0
%15 = call i32 @rgb24_to_bmp(i8* %14, i32 800, i32 480, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [11 x i8] c"sample.bmp\00"
@str = [17 x i8] c"Program start...\00"
@str.3 = [13 x i8] c"Program exit\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [768000 x i8]
%4 = alloca [1152000 x i8]
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%6 = getelementptr inbounds [768000 x i8], [768000 x i8]* %3, i64 0, i64 0
%7 = call i32 @memset(i8* %6, i32 170, i32 768000)
%8 = getelementptr inbounds [1152000 x i8], [1152000 x i8]* %4, i64 0, i64 0
%9 = call i32 @convert_yuv422_to_rgb24_buffer(i8* %6, i8* %8, i32 800, i32 480)
%10 = call i32 @rgb24_to_bmp(i8* %8, i32 800, i32 480, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.3, i64 0, i64 0))
ret i32 0
}