// File: /workspace/github_cpp_makefile_star2_O2/rockytriton[P]dreamsys_emu_gb/src/ui.cpp
// Function: dsemu::ui::init()
void init() {
    SDL_Init(SDL_INIT_VIDEO);


    SDL_CreateWindowAndRenderer(SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_RESIZABLE, &sdlWindow, &sdlRenderer);

    screen = SDL_CreateRGBSurface(0, SCREEN_WIDTH, SCREEN_HEIGHT, 32,
                                            0x00FF0000,
                                            0x0000FF00,
                                            0x000000FF,
                                            0xFF000000);
    sdlTexture = SDL_CreateTexture(sdlRenderer,
                                                SDL_PIXELFORMAT_ARGB8888,
                                                SDL_TEXTUREACCESS_STREAMING,
                                                SCREEN_WIDTH, SCREEN_HEIGHT);

    int x, y;
    SDL_GetWindowPosition(sdlWindow, &x, &y);

    SDL_CreateWindowAndRenderer(16 * 8 * scale, 32 * 8 * scale, SDL_WINDOW_RESIZABLE, &sdlDebugWindow, &sdlDebugRenderer);

    debugScreen = SDL_CreateRGBSurface(0, 16 * 8 * scale, 32 * 8 * scale, 32,
                                            0x00FF0000,
                                            0x0000FF00,
                                            0x000000FF,
                                            0xFF000000);
    sdlDebugTexture = SDL_CreateTexture(sdlDebugRenderer,
                                                SDL_PIXELFORMAT_ARGB8888,
                                                SDL_TEXTUREACCESS_STREAMING,
                                                16 * 8 * scale, 32 * 8 * scale);

    SDL_SetWindowPosition(sdlDebugWindow, x + SCREEN_WIDTH + 10, y);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
pushq $0x20
popq %rbx
movl %ebx, %edi
callq 0x3230
leaq 0x2c44c(%rip), %rcx     # 0x3b728
leaq 0x2c44d(%rip), %r8      # 0x3b730
movl $0x400, %edi            # imm = 0x400
movl $0x300, %esi            # imm = 0x300
movl %ebx, %edx
callq 0x30e0
movl $0xff000000, %r13d      # imm = 0xFF000000
movl $0xff, %r12d
xorl %edi, %edi
movl $0x400, %esi            # imm = 0x400
movl $0x300, %edx            # imm = 0x300
movl %ebx, %ecx
movl $0xff0000, %r8d         # imm = 0xFF0000
movl $0xff00, %r9d           # imm = 0xFF00
pushq %r13
pushq %r12
callq 0x3310
popq %rcx
popq %rdx
movq %rax, 0x2c414(%rip)     # 0x3b740
movq 0x2c3fd(%rip), %rdi     # 0x3b730
pushq $0x1
popq %rbp
movl $0x16362004, %esi       # imm = 0x16362004
movl %ebp, %edx
movl $0x400, %ecx            # imm = 0x400
movl $0x300, %r8d            # imm = 0x300
callq 0x3420
movq %rax, 0x2c3e4(%rip)     # 0x3b738
movq 0x2c3cd(%rip), %rdi     # 0x3b728
leaq 0x4(%rsp), %r14
movq %rsp, %r15
movq %r14, %rsi
movq %r15, %rdx
callq 0x3330
movl 0x6ed0(%rip), %esi      # 0x16244
movl %esi, %edi
shll $0x7, %edi
shll $0x8, %esi
leaq 0x2c3c5(%rip), %rcx     # 0x3b748
leaq 0x2c3c6(%rip), %r8      # 0x3b750
movl %ebx, %edx
callq 0x30e0
movl 0x6ead(%rip), %edx      # 0x16244
movl %edx, %esi
shll $0x7, %esi
shll $0x8, %edx
xorl %edi, %edi
movl %ebx, %ecx
movl $0xff0000, %r8d         # imm = 0xFF0000
movl $0xff00, %r9d           # imm = 0xFF00
pushq %r13
pushq %r12
callq 0x3310
popq %rcx
popq %rdx
movq %rax, 0x2c39f(%rip)     # 0x3b760
movq 0x2c388(%rip), %rdi     # 0x3b750
movl 0x6e75(%rip), %r8d      # 0x16244
movl %r8d, %ecx
shll $0x7, %ecx
shll $0x8, %r8d
movl $0x16362004, %esi       # imm = 0x16362004
movl %ebp, %edx
callq 0x3420
movq %rax, 0x2c36c(%rip)     # 0x3b758
movq 0x2c355(%rip), %rdi     # 0x3b748
movl $0x40a, %esi            # imm = 0x40A
addl (%r14), %esi
movl (%r15), %edx
callq 0x3050
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq