// File: /workspace/github_c_makefile_star2_O3/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 0x3597e
movq %rdi, %rsi
leaq 0x6f2e7(%rip), %rdi     # 0xa4c60
callq 0x6430
movl 0x1830a4(%rip), %eax    # 0x1b8a28
cmpl $0xc8, %eax
jne 0x359a6
testb $0x2, %bl
je 0x359a6
cmpb $0x0, 0x3ed4ed(%rip)    # 0x422e84
jne 0x359a6
movb %bl, 0x3ed4e5(%rip)     # 0x422e84
xorl %ebx, %ebx
jmp 0x35ec0
movl 0x376b48(%rip), %ecx    # 0x3ac4f4
andb $0x1, %bl
cmpl $0x1, %ecx
je 0x35ac4
testl %ecx, %ecx
jne 0x35c11
movaps 0x41659(%rip), %xmm0    # 0x77020
movaps %xmm0, 0x20(%rsp)
movw $0x8, 0x30(%rsp)
leaq 0x3ebd5(%rip), %rdi     # 0x745af
callq 0x40e85
testq %rax, %rax
je 0x35e99
movq %rax, %r14
leaq 0x5c4f5e(%rip), %r15    # 0x5fa950
cmpl $0x3, (%r15)
jl 0x35a1d
cmpl $0xc8, 0x183026(%rip)   # 0x1b8a28
jne 0x35a1d
movw $0x200, 0x21(%rsp)      # imm = 0x200
movl $0x0, 0x23(%rsp)
movb $0x0, 0x27(%rsp)
movb $0x18, 0x30(%rsp)
movzwl 0x3d25c8(%rip), %eax    # 0x407fec
leaq 0x20(%rsp), %rdi
movw %ax, 0xc(%rdi)
movzwl 0x3d25bc(%rip), %eax    # 0x407ff0
movw %ax, 0xe(%rdi)
movl $0x12, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x6b90
cmpl $0x3, (%r15)
jl 0x35a5e
jne 0x35a9d
cmpl $0xc8, 0x182fcc(%rip)   # 0x1b8a28
je 0x35a9d
xorl %r15d, %r15d
leaq 0x401348(%rip), %r12    # 0x436db0
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
cmpq $0x100, %r15            # imm = 0x100
jne 0x35a68
orb $0x6, %bl
movzbl %bl, %esi
leaq 0xb846(%rip), %rcx      # 0x412f0
xorl %r15d, %r15d
movq %r14, %rdi
xorl %edx, %edx
callq 0x4100c
movq %r14, %rdi
callq 0x6480
jmp 0x35e9f
leaq 0x41ce5(%rip), %rdi     # 0x777b0
callq 0x40e85
testq %rax, %rax
je 0x35e99
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 0x5c4e20(%rip), %r15    # 0x5fa950
cmpl $0x3, (%r15)
jl 0x35b47
cmpl $0xc8, 0x182ee8(%rip)   # 0x1b8a28
jne 0x35b47
movb $0x3, 0x61(%rsp)
movl 0x3d249f(%rip), %ecx    # 0x407fec
leal -0x1(%rcx), %eax
leaq 0x20(%rsp), %rdi
movb %al, 0x8(%rdi)
leal -0x1(%rcx), %eax
movb %ah, 0x29(%rsp)
movl 0x3d248b(%rip), %eax    # 0x407ff0
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)
movl $0x80, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x6b90
movzbl %bl, %esi
leaq 0xb760(%rip), %rcx      # 0x412fb
movq %r14, %rdi
xorl %edx, %edx
callq 0x4100c
cmpl $0x3, (%r15)
jl 0x35bc1
jne 0x35e8c
cmpl $0xc8, 0x182e6d(%rip)   # 0x1b8a28
je 0x35e8c
movl $0xc, %edi
movq %r14, %rsi
callq 0x6920
xorl %ebx, %ebx
leaq 0x4011d9(%rip), %r15    # 0x436db0
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
cmpq $0x100, %rbx            # imm = 0x100
jne 0x35bd7
jmp 0x35e8c
xorl $0xc8, %eax
movabsq $0xa1a0a0d474e5089, %rcx # imm = 0xA1A0A0D474E5089
movq %rcx, 0x10(%rsp)
leaq 0x5c4d24(%rip), %r12    # 0x5fa950
movl (%r12), %ecx
xorl $0x3, %ecx
xorl %ebp, %ebp
orl %eax, %ecx
sete %r13b
leaq 0x3ffe6(%rip), %rdi     # 0x75c28
callq 0x40e85
testq %rax, %rax
je 0x35e99
movq %rax, %r14
leaq 0x10(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x6b90
leaq 0x24(%rsp), %r15
movl 0x3d2377(%rip), %eax    # 0x407fec
bswapl %eax
movl %eax, 0x4(%r15)
movl 0x3d236f(%rip), %eax    # 0x407ff0
bswapl %eax
movl %eax, 0x8(%r15)
movb $0x8, 0xc(%r15)
movb %r13b, 0xf(%rsp)
movl %r13d, %eax
xorb $0x3, %al
movb %al, 0xd(%r15)
movw $0x0, 0xe(%r15)
movb $0x0, 0x10(%r15)
movabsq $0x524448490d000000, %rax # imm = 0x524448490D000000
movq %rax, -0x4(%r15)
movq %r15, %rdi
movl $0x11, %esi
callq 0x70277
bswapl %eax
movl %eax, 0x11(%r15)
leaq 0x20(%rsp), %rdi
movl $0x19, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x6b90
cmpl $0x3, (%r12)
jl 0x35cf3
jne 0x35d64
cmpl $0xc8, 0x182d37(%rip)   # 0x1b8a28
je 0x35d64
movl $0x45544c50, 0x24(%rsp) # imm = 0x45544C50
movl $0xa, %eax
leaq 0x4010ab(%rip), %rcx    # 0x436db2
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 $0x3, %rax
addq $0x4, %rcx
cmpq $0x30a, %rax            # imm = 0x30A
jne 0x35d07
leaq 0x20(%rsp), %r12
movl $0x30000, (%r12)        # imm = 0x30000
movq %r15, %rdi
movl $0x304, %esi            # imm = 0x304
callq 0x70277
bswapl %eax
movl %eax, 0x308(%r12)
movl $0x30c, %esi            # imm = 0x30C
movl $0x1, %edx
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 0x702aa
movb 0xf(%rsp), %al
movb %al, %bpl
leal 0x1(,%rbp,2), %eax
imull 0x3d2258(%rip), %eax    # 0x407fec
addl $0x6, %eax
imull 0x3d2252(%rip), %eax    # 0x407ff0
movw $0x178, 0x8(%r12)       # imm = 0x178
addl $0xb, %eax
bswapl %eax
movl %eax, (%r12)
movq %r13, %rdi
movq %r15, %rsi
movl $0x6, %edx
callq 0x702b6
movl $0xa, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %r14, %rcx
callq 0x6b90
movl $0x1, 0x4(%r13)
movzbl %bl, %esi
leaq 0xb65b(%rip), %rcx      # 0x41441
movq %r14, %rdi
movq %r13, %rdx
callq 0x4100c
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)
movq %r13, %rdi
movq %r12, %rsi
movl $0x9, %edx
callq 0x702b6
movq %r13, %rdi
callq 0x702e3
movl (%r13), %eax
bswapl %eax
movl %eax, 0x9(%r12)
movl $0xd, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %r14, %rcx
callq 0x6b90
movabsq $0x444e454900000000, %rax # imm = 0x444E454900000000
movq %rax, (%r12)
movq %r15, %rdi
movl $0x4, %esi
callq 0x70277
bswapl %eax
movl %eax, 0x8(%r12)
movl $0xc, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %r14, %rcx
callq 0x6b90
movq %r14, %rdi
callq 0x6480
xorl %r15d, %r15d
jmp 0x35e9f
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testl %r15d, %r15d
jne 0x35ec0
leaq 0x41666(%rip), %rdi     # 0x77516
leaq 0x6eda9(%rip), %rsi     # 0xa4c60
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x25221
movl %ebx, %eax
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq