// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: screencapture
int screencapture(char *filename, char mode)
{
	int ret;

	if (filename) {
		strcpy(capturename, filename);
	}
	if (qsetmode == 200 && (mode & 2) && !captureatnextpage) {
		captureatnextpage = mode;
		return 0;
	}
	switch (captureformat) {
		case 0: ret = screencapture_tga(mode&1); break;
		case 1: ret = screencapture_pcx(mode&1); break;
		default: ret = screencapture_png(mode&1); break;
	}
	if (ret == 0) {
		buildprintf("Saved screenshot to %s\n", capturename);
	}
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x428, %rsp            # imm = 0x428
movl %esi, %ebx
testq %rdi, %rdi
je 0x322d4
movq %rdi, %rsi
leaq 0x6b991(%rip), %rdi     # 0x9dc60
callq 0x6430
movl 0x17f74e(%rip), %eax    # 0x1b1a28
cmpl $0xc8, %eax
jne 0x322fc
testb $0x2, %bl
je 0x322fc
cmpb $0x0, 0x3e9b97(%rip)    # 0x41be84
jne 0x322fc
movb %bl, 0x3e9b8f(%rip)     # 0x41be84
xorl %ebx, %ebx
jmp 0x32808
movl 0x3731f2(%rip), %ecx    # 0x3a54f4
andb $0x1, %bl
cmpl $0x1, %ecx
je 0x323fa
testl %ecx, %ecx
jne 0x32544
movaps 0x39c23(%rip), %xmm0    # 0x6bf40
movaps %xmm0, 0x20(%rsp)
movw $0x8, 0x30(%rsp)
leaq 0x371bf(%rip), %rdi     # 0x694ef
callq 0x3bd3f
testq %rax, %rax
je 0x32660
movq %rax, %r14
leaq 0x5c1608(%rip), %r15    # 0x5f3950
cmpl $0x3, (%r15)
jl 0x32370
cmpl $0xc8, 0x17f6d0(%rip)   # 0x1b1a28
jne 0x32370
movw $0x200, 0x21(%rsp)      # imm = 0x200
andl $0x0, 0x23(%rsp)
movb $0x0, 0x27(%rsp)
movb $0x18, 0x30(%rsp)
movzwl 0x3cec75(%rip), %eax    # 0x400fec
leaq 0x20(%rsp), %rdi
movw %ax, 0xc(%rdi)
movzwl 0x3cec69(%rip), %eax    # 0x400ff0
movw %ax, 0xe(%rdi)
pushq $0x12
popq %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x6b90
cmpl $0x3, (%r15)
jl 0x323b5
jne 0x32668
cmpl $0xc8, 0x17f679(%rip)   # 0x1b1a28
je 0x32668
xorl %r15d, %r15d
leaq 0x3fd9f1(%rip), %r12    # 0x42fdb0
cmpq $0x100, %r15            # imm = 0x100
je 0x32668
movzbl 0x2(%r12,%r15,4), %edi
movq %r14, %rsi
callq 0x6920
movzbl 0x1(%r12,%r15,4), %edi
movq %r14, %rsi
callq 0x6920
movzbl (%r12,%r15,4), %edi
movq %r14, %rsi
callq 0x6920
incq %r15
jmp 0x323bf
leaq 0x3a26f(%rip), %rdi     # 0x6c670
callq 0x3bd3f
testq %rax, %rax
je 0x32660
movq %rax, %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movl $0x801050a, 0x20(%rsp)  # imm = 0x801050A
movb $0x48, %al
movb %al, 0x2c(%rsp)
movb %al, 0x2e(%rsp)
movb $0x1, %al
movb %al, 0x61(%rsp)
movb %al, 0x64(%rsp)
leaq 0x5c14ea(%rip), %r15    # 0x5f3950
cmpl $0x3, (%r15)
jl 0x3247d
cmpl $0xc8, 0x17f5b2(%rip)   # 0x1b1a28
jne 0x3247d
movb $0x3, 0x61(%rsp)
movl 0x3ceb69(%rip), %ecx    # 0x400fec
leal -0x1(%rcx), %eax
leaq 0x20(%rsp), %rdi
movb %al, 0x8(%rdi)
leal -0x1(%rcx), %eax
movb %ah, 0x29(%rsp)
movl 0x3ceb55(%rip), %eax    # 0x400ff0
leal -0x1(%rax), %edx
movb %dl, 0xa(%rdi)
decl %eax
movb %ah, 0x2b(%rsp)
movl %ecx, %eax
andl $0x1, %eax
addl %ecx, %eax
movb %al, 0x42(%rdi)
movb %ah, 0x63(%rsp)
pushq $0x1
popq %rdx
movl $0x80, %esi
movq %r14, %rcx
callq 0x6b90
movzbl %bl, %esi
leaq 0x9bff(%rip), %rcx      # 0x3c0ce
movq %r14, %rdi
xorl %edx, %edx
callq 0x3be50
cmpl $0x3, (%r15)
jl 0x324f5
jne 0x327de
cmpl $0xc8, 0x17f539(%rip)   # 0x1b1a28
je 0x327de
pushq $0xc
popq %rdi
movq %r14, %rsi
callq 0x6920
xorl %ebx, %ebx
leaq 0x3fd8a7(%rip), %r15    # 0x42fdb0
cmpq $0x100, %rbx            # imm = 0x100
je 0x327de
movzbl (%r15,%rbx,4), %edi
movq %r14, %rsi
callq 0x6920
movzbl 0x1(%r15,%rbx,4), %edi
movq %r14, %rsi
callq 0x6920
movzbl 0x2(%r15,%rbx,4), %edi
movq %r14, %rsi
callq 0x6920
incq %rbx
jmp 0x32509
xorl $0xc8, %eax
movabsq $0xa1a0a0d474e5089, %rcx # imm = 0xA1A0A0D474E5089
movq %rcx, 0x10(%rsp)
leaq 0x5c13f1(%rip), %r13    # 0x5f3950
movl (%r13), %ecx
xorl $0x3, %ecx
xorl %ebp, %ebp
orl %eax, %ecx
sete %r15b
leaq 0x385f3(%rip), %rdi     # 0x6ab68
callq 0x3bd3f
testq %rax, %rax
je 0x32660
movq %rax, %r14
leaq 0x10(%rsp), %rdi
pushq $0x8
popq %rsi
pushq $0x1
popq %r12
movq %r12, %rdx
movq %rax, %rcx
callq 0x6b90
movl %r15d, %ecx
leaq 0x24(%rsp), %r15
movl 0x3cea41(%rip), %eax    # 0x400fec
bswapl %eax
movl %eax, 0x4(%r15)
movl 0x3cea39(%rip), %eax    # 0x400ff0
bswapl %eax
movl %eax, 0x8(%r15)
movb $0x8, 0xc(%r15)
movb %cl, 0xf(%rsp)
movl %ecx, %eax
xorb $0x3, %al
movb %al, 0xd(%r15)
andw $0x0, 0xe(%r15)
movb $0x0, 0x10(%r15)
movabsq $0x524448490d000000, %rax # imm = 0x524448490D000000
movq %rax, -0x4(%r15)
pushq $0x11
popq %rsi
movq %r15, %rdi
callq 0x64918
bswapl %eax
movl %eax, 0x11(%r15)
leaq 0x20(%rsp), %rdi
pushq $0x19
popq %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x6b90
cmpl $0x3, (%r13)
jl 0x32628
jne 0x326c5
cmpl $0xc8, 0x17f406(%rip)   # 0x1b1a28
je 0x326c5
pushq $0xa
popq %rax
movl $0x45544c50, 0x24(%rsp) # imm = 0x45544C50
leaq 0x3fd778(%rip), %rcx    # 0x42fdb2
cmpq $0x30a, %rax            # imm = 0x30A
je 0x3268e
movb -0x2(%rcx), %dl
movb %dl, 0x1e(%rsp,%rax)
movb -0x1(%rcx), %dl
movb %dl, 0x1f(%rsp,%rax)
movb (%rcx), %dl
movb %dl, 0x20(%rsp,%rax)
addq $0x4, %rcx
addq $0x3, %rax
jmp 0x3263a
pushq $-0x1
popq %rbx
jmp 0x327e8
orb $0x6, %bl
movzbl %bl, %esi
leaq 0x9a4e(%rip), %rcx      # 0x3c0c3
xorl %ebx, %ebx
movq %r14, %rdi
xorl %edx, %edx
callq 0x3be50
movq %r14, %rdi
callq 0x6480
jmp 0x327e8
leaq 0x20(%rsp), %r12
movl $0x30000, (%r12)        # imm = 0x30000
movq %r15, %rdi
movl $0x304, %esi            # imm = 0x304
callq 0x64918
bswapl %eax
movl %eax, 0x308(%r12)
pushq $0x1
popq %rdx
movl $0x30c, %esi            # imm = 0x30C
movq %r12, %rdi
movq %r14, %rcx
callq 0x6b90
leaq 0x20(%rsp), %r12
movl $0x54414449, 0x4(%r12)  # imm = 0x54414449
leaq 0x18(%rsp), %r13
movq %r13, %rdi
callq 0x6493c
movb 0xf(%rsp), %al
movb %al, %bpl
leal 0x1(,%rbp,2), %eax
imull 0x3ce8f7(%rip), %eax    # 0x400fec
addl $0x6, %eax
imull 0x3ce8f1(%rip), %eax    # 0x400ff0
movw $0x178, 0x8(%r12)       # imm = 0x178
addl $0xb, %eax
bswapl %eax
movl %eax, (%r12)
pushq $0x6
popq %rdx
movq %r13, %rdi
movq %r15, %rsi
callq 0x64945
pushq $0xa
popq %rsi
pushq $0x1
popq %rbp
movq %r12, %rdi
movq %rbp, %rdx
movq %r14, %rcx
callq 0x6b90
movl $0x1, 0x4(%r13)
movzbl %bl, %esi
leaq 0x9ac9(%rip), %rcx      # 0x3c20d
movq %r14, %rdi
movq %r13, %rdx
callq 0x3be50
movb $-0x1, 0x4(%r12)
movl $0xff000001, (%r12)     # imm = 0xFF000001
movzwl 0x4(%r13), %eax
movzwl 0x6(%r13), %ecx
rolw $0x8, %cx
movw %cx, 0x5(%r12)
rolw $0x8, %ax
movw %ax, 0x7(%r12)
pushq $0x9
popq %rdx
movq %r13, %rdi
movq %r12, %rsi
callq 0x64945
movq %r13, %rdi
callq 0x64970
movl (%r13), %eax
bswapl %eax
movl %eax, 0x9(%r12)
pushq $0xd
popq %rsi
movq %r12, %rdi
movq %rbp, %rdx
movq %r14, %rcx
callq 0x6b90
movabsq $0x444e454900000000, %rax # imm = 0x444E454900000000
movq %rax, (%r12)
pushq $0x4
popq %rsi
movq %r15, %rdi
callq 0x64918
bswapl %eax
movl %eax, 0x8(%r12)
pushq $0xc
popq %rsi
movq %r12, %rdi
movq %rbp, %rdx
movq %r14, %rcx
callq 0x6b90
movq %r14, %rdi
callq 0x6480
xorl %ebx, %ebx
testl %ebx, %ebx
je 0x327f1
pushq $-0x1
popq %rbx
jmp 0x32808
leaq 0x39bde(%rip), %rdi     # 0x6c3d6
leaq 0x6b461(%rip), %rsi     # 0x9dc60
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x22427
movl %ebx, %eax
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq