// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: screencapture_png
static int screencapture_png(char mode)
{
	const unsigned char pngsig[] = { 0x89, 'P', 'N', 'G', 0xd, 0xa, 0x1a, 0xa };
	const unsigned char enddeflate[] = { 1, 0, 0, 0xff, 0xff };

#define BEGIN_PNG_CHUNK(type) { \
	acclen = 4; \
	memcpy(&buf[acclen], type, 4); \
	acclen += 4; \
}
#define SET_PNG_CHUNK_LEN(fore) { \
	/* Accumulated and forecast, minus length and type fields. */ \
	int len = B_BIG32(acclen + fore - 8); \
	memcpy(&buf[0], &len, 4); \
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x470, %rsp            # imm = 0x470
movb %dil, %al
movb %al, -0x5(%rbp)
movq 0x58d20(%rip), %rax     # 0xb2d38
movq %rax, -0xd(%rbp)
movl 0x58dd0(%rip), %eax     # 0xb2df2
movl %eax, -0x12(%rbp)
movb 0x58dcb(%rip), %al      # 0xb2df6
movb %al, -0xe(%rbp)
movl $0x0, -0x430(%rbp)
xorl %eax, %eax
leaq 0x5938df(%rip), %rcx    # 0x5ed920
cmpl $0x3, (%rcx)
movb %al, -0x469(%rbp)
jne 0x5a05f
cmpl $0xc8, 0x19b532(%rip)   # 0x1f5588
sete %al
movb %al, -0x469(%rbp)
movb -0x469(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x430(%rbp)
leaq 0x579c1(%rip), %rdi     # 0xb1a38
callq 0x61370
movq %rax, -0x440(%rbp)
cmpq $0x0, %rax
jne 0x5a095
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5a747
leaq -0xd(%rbp), %rdi
movq -0x440(%rbp), %rcx
movl $0x8, %esi
movl $0x1, %edx
callq 0x6aa0
movl $0x4, -0x42c(%rbp)
movslq -0x42c(%rbp), %rax
movl 0x59596(%rip), %ecx     # 0xb365c
movl %ecx, -0x420(%rbp,%rax)
movl -0x42c(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x42c(%rbp)
movl 0x3e8c6a(%rip), %edi    # 0x442d4c
callq 0x61aa0
movl %eax, -0x428(%rbp)
movslq -0x42c(%rbp), %rax
movl -0x428(%rbp), %ecx
movl %ecx, -0x420(%rbp,%rax)
movl -0x42c(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x42c(%rbp)
movl 0x3e8c3a(%rip), %edi    # 0x442d50
callq 0x61aa0
movl %eax, -0x428(%rbp)
movslq -0x42c(%rbp), %rax
movl -0x428(%rbp), %ecx
movl %ecx, -0x420(%rbp,%rax)
movl -0x42c(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x42c(%rbp)
movl -0x42c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x42c(%rbp)
cltq
movb $0x8, -0x420(%rbp,%rax)
movl -0x430(%rbp), %edx
movl $0x3, %eax
movl $0x2, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movb %al, %cl
movl -0x42c(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x42c(%rbp)
cltq
movb %cl, -0x420(%rbp,%rax)
movl -0x42c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x42c(%rbp)
cltq
movb $0x0, -0x420(%rbp,%rax)
movl -0x42c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x42c(%rbp)
cltq
movb $0x0, -0x420(%rbp,%rax)
movl -0x42c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x42c(%rbp)
cltq
movb $0x0, -0x420(%rbp,%rax)
movl -0x42c(%rbp), %edi
addl $0x0, %edi
subl $0x8, %edi
callq 0x61aa0
movl %eax, -0x44c(%rbp)
movl -0x44c(%rbp), %eax
movl %eax, -0x420(%rbp)
leaq -0x420(%rbp), %rdi
addq $0x4, %rdi
movl -0x42c(%rbp), %esi
subl $0x4, %esi
callq 0xa8430
movl %eax, %edi
callq 0x61aa0
movl %eax, -0x450(%rbp)
movslq -0x42c(%rbp), %rax
movl -0x450(%rbp), %ecx
movl %ecx, -0x420(%rbp,%rax)
movl -0x42c(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x42c(%rbp)
leaq -0x420(%rbp), %rdi
movslq -0x42c(%rbp), %rsi
movq -0x440(%rbp), %rcx
movl $0x1, %edx
callq 0x6aa0
leaq 0x5936ac(%rip), %rax    # 0x5ed920
cmpl $0x3, (%rax)
jl 0x5a299
leaq 0x5936a0(%rip), %rax    # 0x5ed920
cmpl $0x3, (%rax)
jne 0x5a3f9
cmpl $0xc8, 0x19b2f5(%rip)   # 0x1f5588
je 0x5a3f9
movl $0x4, -0x42c(%rbp)
movslq -0x42c(%rbp), %rax
movl 0x593b1(%rip), %ecx     # 0xb3661
movl %ecx, -0x420(%rbp,%rax)
movl -0x42c(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x42c(%rbp)
movl $0x0, -0x428(%rbp)
cmpl $0x100, -0x428(%rbp)    # imm = 0x100
jge 0x5a36e
movslq -0x428(%rbp), %rcx
leaq 0x417312(%rip), %rax    # 0x471600
movb (%rax,%rcx,4), %cl
movl -0x42c(%rbp), %eax
addl $0x0, %eax
cltq
movb %cl, -0x420(%rbp,%rax)
movslq -0x428(%rbp), %rcx
leaq 0x4172ef(%rip), %rax    # 0x471600
movb 0x1(%rax,%rcx,4), %cl
movl -0x42c(%rbp), %eax
addl $0x1, %eax
cltq
movb %cl, -0x420(%rbp,%rax)
movslq -0x428(%rbp), %rcx
leaq 0x4172cb(%rip), %rax    # 0x471600
movb 0x2(%rax,%rcx,4), %cl
movl -0x42c(%rbp), %eax
addl $0x2, %eax
cltq
movb %cl, -0x420(%rbp,%rax)
movl -0x428(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x428(%rbp)
movl -0x42c(%rbp), %eax
addl $0x3, %eax
movl %eax, -0x42c(%rbp)
jmp 0x5a2d0
movl -0x42c(%rbp), %edi
addl $0x0, %edi
subl $0x8, %edi
callq 0x61aa0
movl %eax, -0x454(%rbp)
movl -0x454(%rbp), %eax
movl %eax, -0x420(%rbp)
leaq -0x420(%rbp), %rdi
addq $0x4, %rdi
movl -0x42c(%rbp), %esi
subl $0x4, %esi
callq 0xa8430
movl %eax, %edi
callq 0x61aa0
movl %eax, -0x458(%rbp)
movslq -0x42c(%rbp), %rax
movl -0x458(%rbp), %ecx
movl %ecx, -0x420(%rbp,%rax)
movl -0x42c(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x42c(%rbp)
leaq -0x420(%rbp), %rdi
movslq -0x42c(%rbp), %rsi
movq -0x440(%rbp), %rcx
movl $0x1, %edx
callq 0x6aa0
movl $0x4, -0x42c(%rbp)
movslq -0x42c(%rbp), %rax
movl 0x59256(%rip), %ecx     # 0xb3666
movl %ecx, -0x420(%rbp,%rax)
movl -0x42c(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x42c(%rbp)
leaq -0x448(%rbp), %rdi
callq 0xa8470
movl -0x42c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x42c(%rbp)
cltq
movb $0x78, -0x420(%rbp,%rax)
movl -0x42c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x42c(%rbp)
cltq
movb $0x1, -0x420(%rbp,%rax)
movl 0x3e88de(%rip), %eax    # 0x442d4c
movl -0x430(%rbp), %esi
movl $0x1, %ecx
movl $0x3, %edx
cmpl $0x0, %esi
cmovnel %edx, %ecx
imull %ecx, %eax
addl $0x6, %eax
movl %eax, -0x424(%rbp)
movl 0x3e88ba(%rip), %eax    # 0x442d50
imull -0x424(%rbp), %eax
movl %eax, -0x424(%rbp)
movslq -0x424(%rbp), %rax
addq $0x5, %rax
movl %eax, -0x424(%rbp)
movl -0x424(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x424(%rbp)
movl -0x42c(%rbp), %edi
addl -0x424(%rbp), %edi
subl $0x8, %edi
callq 0x61aa0
movl %eax, -0x45c(%rbp)
movl -0x45c(%rbp), %eax
movl %eax, -0x420(%rbp)
leaq -0x448(%rbp), %rdi
leaq -0x420(%rbp), %rsi
addq $0x4, %rsi
movl -0x42c(%rbp), %edx
subl $0x4, %edx
callq 0xa8490
leaq -0x420(%rbp), %rdi
movslq -0x42c(%rbp), %rsi
movq -0x440(%rbp), %rcx
movl $0x1, %edx
callq 0x6aa0
movw $0x1, -0x444(%rbp)
movw $0x0, -0x442(%rbp)
movq -0x440(%rbp), %rdi
movsbl -0x5(%rbp), %eax
andl $0x1, %eax
leaq -0x448(%rbp), %rdx
leaq 0x758a(%rip), %rcx      # 0x61ae0
movsbl %al, %esi
callq 0x61500
movl $0x0, -0x42c(%rbp)
movslq -0x42c(%rbp), %rax
movl -0x12(%rbp), %ecx
movl %ecx, -0x420(%rbp,%rax)
movb -0xe(%rbp), %cl
movb %cl, -0x41c(%rbp,%rax)
movslq -0x42c(%rbp), %rax
addq $0x5, %rax
movl %eax, -0x42c(%rbp)
movzwl -0x442(%rbp), %edi
callq 0x61c20
movw %ax, -0x432(%rbp)
movslq -0x42c(%rbp), %rax
movw -0x432(%rbp), %cx
movw %cx, -0x420(%rbp,%rax)
movl -0x42c(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x42c(%rbp)
movzwl -0x444(%rbp), %edi
callq 0x61c20
movw %ax, -0x432(%rbp)
movslq -0x42c(%rbp), %rax
movw -0x432(%rbp), %cx
movw %cx, -0x420(%rbp,%rax)
movl -0x42c(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x42c(%rbp)
leaq -0x448(%rbp), %rdi
leaq -0x420(%rbp), %rsi
movl -0x42c(%rbp), %edx
callq 0xa8490
leaq -0x448(%rbp), %rdi
callq 0xa8500
movl -0x448(%rbp), %edi
callq 0x61aa0
movl %eax, -0x460(%rbp)
movslq -0x42c(%rbp), %rax
movl -0x460(%rbp), %ecx
movl %ecx, -0x420(%rbp,%rax)
movl -0x42c(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x42c(%rbp)
leaq -0x420(%rbp), %rdi
movslq -0x42c(%rbp), %rsi
movq -0x440(%rbp), %rcx
movl $0x1, %edx
callq 0x6aa0
movl $0x4, -0x42c(%rbp)
movslq -0x42c(%rbp), %rax
movl 0x58fd8(%rip), %ecx     # 0xb366b
movl %ecx, -0x420(%rbp,%rax)
movl -0x42c(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x42c(%rbp)
movl -0x42c(%rbp), %edi
addl $0x0, %edi
subl $0x8, %edi
callq 0x61aa0
movl %eax, -0x464(%rbp)
movl -0x464(%rbp), %eax
movl %eax, -0x420(%rbp)
leaq -0x420(%rbp), %rdi
addq $0x4, %rdi
movl -0x42c(%rbp), %esi
subl $0x4, %esi
callq 0xa8430
movl %eax, %edi
callq 0x61aa0
movl %eax, -0x468(%rbp)
movslq -0x42c(%rbp), %rax
movl -0x468(%rbp), %ecx
movl %ecx, -0x420(%rbp,%rax)
movl -0x42c(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x42c(%rbp)
leaq -0x420(%rbp), %rdi
movslq -0x42c(%rbp), %rsi
movq -0x440(%rbp), %rcx
movl $0x1, %edx
callq 0x6aa0
movq -0x440(%rbp), %rdi
callq 0x6420
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x470, %rsp            # imm = 0x470
popq %rbp
retq
nopw %cs:(%rax,%rax)