// File: /workspace/github_c_makefile_star2_O0/tvlabs[P]edge264/edge264_test.c
// Function: draw_frame
static int draw_frame()
{
	// create or resize the window if necessary
	int has_second_view = out.samples_mvc[0] != NULL;
	if (width != out.width_Y || height != out.height_Y || mvc_display != has_second_view) {
		width = out.width_Y;
		height = out.height_Y;
		mvc_display = has_second_view;
		if (window == NULL) {
			SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS);
			window = SDL_CreateWindow("edge264_test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS);
			renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
		} else {
			SDL_SetWindowSize(window, width, height);
			SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
			SDL_DestroyTexture(texture0);
			SDL_DestroyTexture(texture1);
		}
		texture0 = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_IYUV, SDL_TEXTUREACCESS_STREAMING, width, height);
		texture1 = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_IYUV, SDL_TEXTUREACCESS_STREAMING, width, height);
		SDL_SetTextureBlendMode(texture1, SDL_BLENDMODE_BLEND);
		SDL_SetTextureAlphaMod(texture1, 128);
	}
	
	// upload the image to a texture and render!
	SDL_UpdateYUVTexture(texture0, NULL, out.samples[0], out.stride_Y, out.samples[1], out.stride_C, out.samples[2], out.stride_C);
	SDL_RenderClear(renderer);
	SDL_RenderCopy(renderer, texture0, NULL, NULL);
	if (mvc_display) {
		SDL_UpdateYUVTexture(texture1, NULL, out.samples_mvc[0], out.stride_Y, out.samples_mvc[1], out.stride_C, out.samples_mvc[2], out.stride_C);
		SDL_RenderCopy(renderer, texture1, NULL, NULL);
	}
	SDL_RenderPresent(renderer);
	
	// Is user closing the window?
	SDL_Event event;
	while (SDL_PollEvent(&event)) {
		if (event.type == SDL_QUIT ||
			(event.type == SDL_KEYDOWN && event.key.keysym.sym == SDLK_ESCAPE)) {
			return 1;
		}
	}
	return 0;
}

// Assembly:
subq $0x58, %rsp
cmpq $0x0, 0x341c(%rip)      # 0x6238
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x50(%rsp)
movl 0x3452(%rip), %eax      # 0x6280
movswl 0x3425(%rip), %ecx      # 0x625a
cmpl %ecx, %eax
jne 0x2e5a
movl 0x3445(%rip), %eax      # 0x6284
movswl 0x3418(%rip), %ecx      # 0x625e
cmpl %ecx, %eax
jne 0x2e5a
movl 0x3438(%rip), %eax      # 0x6288
cmpl 0x50(%rsp), %eax
je 0x2fc0
movswl 0x33f9(%rip), %eax      # 0x625a
movl %eax, 0x3419(%rip)      # 0x6280
movswl 0x33f0(%rip), %eax      # 0x625e
movl %eax, 0x3410(%rip)      # 0x6284
movl 0x50(%rsp), %eax
movl %eax, 0x340a(%rip)      # 0x6288
cmpq $0x0, 0x330a(%rip)      # 0x6190
jne 0x2ee7
movl $0x4020, %edi           # imm = 0x4020
callq *0x3315(%rip)           # 0x61a8
movq 0x3316(%rip), %rax      # 0x61b0
movl 0x33e0(%rip), %ecx      # 0x6280
movl 0x33dd(%rip), %r8d      # 0x6284
leaq 0x1953(%rip), %rdi      # 0x4801
movl $0x2fff0000, %edx       # imm = 0x2FFF0000
movl $0x14, %r9d
movl %edx, %esi
callq *%rax
movq %rax, 0x32cc(%rip)      # 0x6190
movq 0x32ed(%rip), %rax      # 0x61b8
movq 0x32be(%rip), %rdi      # 0x6190
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0x6, %edx
callq *%rax
movq %rax, 0x329b(%rip)      # 0x6180
jmp 0x2f3a
movq 0x32d2(%rip), %rax      # 0x61c0
movq 0x329b(%rip), %rdi      # 0x6190
movl 0x3385(%rip), %esi      # 0x6280
movl 0x3383(%rip), %edx      # 0x6284
callq *%rax
movq 0x32be(%rip), %rax      # 0x61c8
movq 0x327f(%rip), %rdi      # 0x6190
movl $0x2fff0000, %edx       # imm = 0x2FFF0000
movl %edx, %esi
callq *%rax
movq 0x323f(%rip), %rax      # 0x6160
movq 0x3240(%rip), %rdi      # 0x6168
callq *%rax
movq 0x322f(%rip), %rax      # 0x6160
movq 0x3238(%rip), %rdi      # 0x6170
callq *%rax
movq 0x328f(%rip), %rax      # 0x61d0
movq 0x3238(%rip), %rdi      # 0x6180
movl 0x3332(%rip), %ecx      # 0x6280
movl 0x332f(%rip), %r8d      # 0x6284
movl $0x56555949, %esi       # imm = 0x56555949
movl $0x1, %edx
callq *%rax
movq %rax, 0x3200(%rip)      # 0x6168
movq 0x3261(%rip), %rax      # 0x61d0
movq 0x320a(%rip), %rdi      # 0x6180
movl 0x3304(%rip), %ecx      # 0x6280
movl 0x3301(%rip), %r8d      # 0x6284
movl $0x56555949, %esi       # imm = 0x56555949
movl $0x1, %edx
callq *%rax
movq %rax, 0x31da(%rip)      # 0x6170
movq 0x323b(%rip), %rax      # 0x61d8
movq 0x31cc(%rip), %rdi      # 0x6170
movl $0x1, %esi
callq *%rax
movq 0x322e(%rip), %rax      # 0x61e0
movq 0x31b7(%rip), %rdi      # 0x6170
movl $0x80, %esi
callq *%rax
movq 0x3221(%rip), %rax      # 0x61e8
movq 0x319a(%rip), %rdi      # 0x6168
movq 0x324b(%rip), %rdx      # 0x6220
movswl 0x3286(%rip), %ecx      # 0x6262
movq 0x3245(%rip), %r8       # 0x6228
movswl 0x3279(%rip), %r9d      # 0x6264
movq 0x323e(%rip), %r11      # 0x6230
movswl 0x326a(%rip), %r10d     # 0x6264
xorl %esi, %esi
movq %r11, (%rsp)
movl %r10d, 0x8(%rsp)
callq *%rax
movq 0x31e2(%rip), %rax      # 0x61f0
movq 0x316b(%rip), %rdi      # 0x6180
callq *%rax
movq 0x31da(%rip), %rax      # 0x61f8
movq 0x315b(%rip), %rdi      # 0x6180
movq 0x313c(%rip), %rsi      # 0x6168
xorl %ecx, %ecx
movq %rcx, %rdx
callq *%rax
cmpl $0x0, 0x324e(%rip)      # 0x6288
je 0x309f
movq 0x31a5(%rip), %rax      # 0x61e8
movq 0x3126(%rip), %rdi      # 0x6170
movq 0x31e7(%rip), %rdx      # 0x6238
movswl 0x320a(%rip), %ecx      # 0x6262
movq 0x31e1(%rip), %r8       # 0x6240
movswl 0x31fd(%rip), %r9d      # 0x6264
movq 0x31da(%rip), %r11      # 0x6248
movswl 0x31ee(%rip), %r10d     # 0x6264
xorl %esi, %esi
movq %r11, (%rsp)
movl %r10d, 0x8(%rsp)
callq *%rax
movq 0x316e(%rip), %rax      # 0x61f8
movq 0x30ef(%rip), %rdi      # 0x6180
movq 0x30d8(%rip), %rsi      # 0x6170
xorl %ecx, %ecx
movq %rcx, %rdx
callq *%rax
movq 0x315a(%rip), %rax      # 0x6200
movq 0x30d3(%rip), %rdi      # 0x6180
callq *%rax
leaq 0x18(%rsp), %rdi
callq *0x314e(%rip)           # 0x6208
cmpl $0x0, %eax
je 0x30e6
cmpl $0x100, 0x18(%rsp)      # imm = 0x100
je 0x30da
cmpl $0x300, 0x18(%rsp)      # imm = 0x300
jne 0x30e4
cmpl $0x1b, 0x2c(%rsp)
jne 0x30e4
movl $0x1, 0x54(%rsp)
jmp 0x30ee
jmp 0x30af
movl $0x0, 0x54(%rsp)
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq