// File: /workspace/github_c_makefile_star2_O1/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: setview
void setview(int x1, int y1, int x2, int y2)
{
	int i, xfov = 65536;

	if (widescreen) xfov = divscale16(xdim*3, ydim*4);

	windowx1 = x1; wx1 = (x1<<12);
	windowy1 = y1; wy1 = (y1<<12);
	windowx2 = x2; wx2 = ((x2+1)<<12);
	windowy2 = y2; wy2 = ((y2+1)<<12);

	xdimen = (x2-x1)+1; halfxdimen = (xdimen>>1);
	xdimenrecip = divscale32(1L,xdimen);
	ydimen = (y2-y1)+1;

	setaspect(mulscale16(65536,xfov), pixelaspect);

	for(i=0;i<windowx1;i++) { startumost[i] = 1, startdmost[i] = 0; }
	for(i=windowx1;i<=windowx2;i++)
		{ startumost[i] = windowy1, startdmost[i] = windowy2+1; }
	for(i=windowx2+1;i<xdim;i++) { startumost[i] = 1, startdmost[i] = 0; }

#if USE_POLYMOST && USE_OPENGL
	polymost_setview();
#endif
}

// Assembly:
movl %edx, %r8d
movl %edi, %r9d
cmpl $0x0, 0x3e26dd(%rip)    # 0x415c70
je 0x335b9
movslq 0x3d3a50(%rip), %rax    # 0x406fec
movslq 0x3d3a4d(%rip), %rdi    # 0x406ff0
shlq $0x2, %rdi
shlq $0x10, %rax
leaq (%rax,%rax,2), %rax
cqto
idivq %rdi
movq %rax, %rdi
jmp 0x335be
movl $0x10000, %edi          # imm = 0x10000
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %r9d, 0x39d7a4(%rip)    # 0x3d0d70
movl %r9d, %eax
shll $0xc, %eax
movl %eax, 0x401fb4(%rip)    # 0x43558c
movl %esi, 0x39f5a2(%rip)    # 0x3d2b80
movl %esi, %eax
shll $0xc, %eax
movl %eax, 0x401fa7(%rip)    # 0x435590
movl %r8d, 0x3d39f0(%rip)    # 0x406fe0
movl %r8d, %eax
shll $0xc, %eax
movl $0x1000, %edx           # imm = 0x1000
addl %edx, %eax
movl %eax, 0x401f91(%rip)    # 0x435594
movl %ecx, 0x3d39db(%rip)    # 0x406fe4
movl %ecx, %eax
shll $0xc, %eax
addl %edx, %eax
movl %eax, 0x401f82(%rip)    # 0x435598
subl %r9d, %r8d
incl %r8d
movl %r8d, 0x7020d(%rip)     # 0xa3830
movslq %r8d, %r9
sarl %r8d
movl %r8d, 0x3e4834(%rip)    # 0x417e64
movabsq $0x100000000, %rax      # imm = 0x100000000
xorl %edx, %edx
idivq %r9
movl %eax, 0x401f57(%rip)    # 0x43559c
subl %esi, %ecx
incl %ecx
movl %ecx, 0x247445(%rip)    # 0x27aa94
movl 0x3e2623(%rip), %esi    # 0x415c78
callq 0x3a850
movl 0x39d70f(%rip), %r14d   # 0x3d0d70
testl %r14d, %r14d
jle 0x33695
leaq (%r14,%r14), %rbx
leaq 0x39d70f(%rip), %rdi    # 0x3d0d80
xorl %r15d, %r15d
xorl %esi, %esi
movq %rbx, %rdx
callq 0x62f0
leaq 0x39b8eb(%rip), %rax    # 0x3cef70
movw $0x1, (%r15,%rax)
addq $0x2, %r15
cmpq %r15, %rbx
jne 0x33685
movslq 0x3d3944(%rip), %rbx    # 0x406fe0
cmpl %ebx, %r14d
jg 0x336e2
movzwl 0x39f4d8(%rip), %eax    # 0x3d2b80
movl 0x3d3936(%rip), %ecx    # 0x406fe4
incl %ecx
movslq %r14d, %rdx
addq %rdx, %rdx
movl %ebx, %esi
subl %r14d, %esi
incl %esi
xorl %edi, %edi
leaq 0x39b8aa(%rip), %r8     # 0x3cef70
leaq 0x39d6b3(%rip), %r9     # 0x3d0d80
leaq (%rdx,%rdi,2), %r10
movw %ax, (%r8,%r10)
movw %cx, (%r9,%r10)
incq %rdi
cmpl %edi, %esi
jne 0x336cd
movl 0x3d3904(%rip), %ebp    # 0x406fec
leaq 0x1(%rbx), %r15
cmpl %ebp, %r15d
jge 0x33738
leaq 0x39d688(%rip), %rax    # 0x3d0d80
leaq (%rax,%r15,2), %rdi
movl %ebp, %eax
subl %ebx, %eax
addl $-0x2, %eax
leaq 0x2(,%rax,2), %rdx
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x62f0
movslq %r15d, %rax
addq %rax, %rax
notl %ebx
addl %ebp, %ebx
leaq 0x39b84a(%rip), %rcx    # 0x3cef70
leaq (%rax,%r14,2), %rdx
movw $0x1, (%rcx,%rdx)
incq %r14
cmpl %r14d, %ebx
jne 0x33726
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x4e4b5