// File: /workspace/github_c_makefile_star2_O0/adelciotto[P]plasma/src/rgb_plasma.c
// Function: InitSDL
int InitSDL(void) {
    SDL_Init(SDL_INIT_VIDEO);

    if (SDL_GetDesktopDisplayMode(0, &displayMode) != 0) {
        return -1;
    }

    window = SDL_CreateWindow(
        WINDOW_TITLE, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
        width * scale, height * scale, SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
    if (window == NULL) {
        return -1;
    }
    LogInfo("window created with size %dx%d", width, height);

    if (fullscreen) {
        SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
    }

    if (!interactive) {
        SDL_ShowCursor(SDL_DISABLE);
    }

    renderer = SDL_CreateRenderer(
        window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
    if (renderer == NULL) {
        return -1;
    }
    LogInfo("renderer created with logical size %dx%d", width, height);

    SDL_RenderSetLogicalSize(renderer, width, height);

    texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGB888,
                                SDL_TEXTUREACCESS_STREAMING, width, height);
    if (texture == NULL) {
        return -1;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x20, %edi
callq 0x1150
xorl %edi, %edi
leaq 0x3c3d(%rip), %rsi      # 0x5188
callq 0x1200
cmpl $0x0, %eax
je 0x1561
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x16a1
movl 0x3bd1(%rip), %ecx      # 0x5138
imull 0x3bd2(%rip), %ecx      # 0x5140
movl 0x3bc7(%rip), %r8d      # 0x513c
imull 0x3bc3(%rip), %r8d      # 0x5140
leaq 0x1b4c(%rip), %rdi      # 0x30d0
movl $0x2fff0000, %edx       # imm = 0x2FFF0000
movl $0x24, %r9d
movl %edx, %esi
callq 0x1060
movq %rax, 0x3bc3(%rip)      # 0x5160
cmpq $0x0, 0x3bbb(%rip)      # 0x5160
jne 0x15b3
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x16a1
movl 0x3b7f(%rip), %edx      # 0x5138
movl 0x3b7d(%rip), %ecx      # 0x513c
xorl %edi, %edi
leaq 0x1b13(%rip), %rsi      # 0x30db
movb $0x0, %al
callq 0x1210
cmpl $0x0, 0x3baa(%rip)      # 0x5180
je 0x15e9
movq 0x3b81(%rip), %rdi      # 0x5160
movl $0x1001, %esi           # imm = 0x1001
callq 0x1180
cmpl $0x0, 0x3b94(%rip)      # 0x5184
jne 0x15f9
xorl %edi, %edi
callq 0x1240
movq 0x3b60(%rip), %rdi      # 0x5160
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0x6, %edx
callq 0x1040
movq %rax, 0x3b52(%rip)      # 0x5168
cmpq $0x0, 0x3b4a(%rip)      # 0x5168
jne 0x1629
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x16a1
movl 0x3b09(%rip), %edx      # 0x5138
movl 0x3b07(%rip), %ecx      # 0x513c
xorl %edi, %edi
leaq 0x1abc(%rip), %rsi      # 0x30fa
movb $0x0, %al
callq 0x1210
movq 0x3b1c(%rip), %rdi      # 0x5168
movl 0x3ae6(%rip), %esi      # 0x5138
movl 0x3ae4(%rip), %edx      # 0x513c
callq 0x10b0
movq 0x3b04(%rip), %rdi      # 0x5168
movl 0x3ace(%rip), %ecx      # 0x5138
movl 0x3acb(%rip), %r8d      # 0x513c
movl $0x16161804, %esi       # imm = 0x16161804
movl $0x1, %edx
callq 0x1220
movq %rax, 0x3ae9(%rip)      # 0x5170
cmpq $0x0, 0x3ae1(%rip)      # 0x5170
jne 0x169a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x16a1
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)