// File: /workspace/github_c_makefile_star2_O1/jonof[P]jftekwar/src/tekmsc.c
// Function: setup3dscreen
void
setup3dscreen()
{
     int      i, dax, day, dax2, day2;

     if( screensize > xdim ) {
          dax = 0; day = 0;
          dax2 = xdim-1; day2 = ydim-1;
     }
     else {
          dax = (xdim>>1)-(screensize>>1);
          dax2 = dax+screensize-1;
          day = ((ydim-32)>>1)-(((screensize*(ydim-32))/xdim)>>1);
          day2 = day + ((screensize*(ydim-32))/xdim)-1;
          tekview(&dax,&day,&dax2,&day2);
          setview(dax,day>>detailmode,dax2,day2>>detailmode);
     }
     if( screensize <= xdim ) {
          permanentwritespritetile(0L,0L,BACKGROUND,0,0L,0L,xdim-1,ydim-1,0);
          permanentwritesprite((xdim-320)>>1,ydim-32,STATUSBAR,0,0,0,xdim-1,ydim-1,0);
          i = ((xdim-320)>>1);
          while (i >= 8) i -= 8, permanentwritesprite(i,ydim-32,STATUSBARFILL8,0,0,0,xdim-1,ydim-1,0);
          if (i >= 4) i -= 4, permanentwritesprite(i,ydim-32,STATUSBARFILL4,0,0,0,xdim-1,ydim-1,0);
          i = ((xdim-320)>>1)+320;
          while (i <= xdim-8) permanentwritesprite(i,ydim-32,STATUSBARFILL8,0,0,0,xdim-1,ydim-1,0), i += 8;
          if (i <= xdim-4) permanentwritesprite(i,ydim-32,STATUSBARFILL4,0,0,0,xdim-1,ydim-1,0), i += 4;
     }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0xce28a(%rip), %rbp     # 0xe2ba2
movswl (%rbp), %edx
leaq 0x5a1529(%rip), %r13    # 0x5b5e4c
movl (%r13), %ecx
cmpl %edx, %ecx
jge 0x1494c
xorl %eax, %eax
movl %eax, 0x14(%rsp)
movl %eax, 0x10(%rsp)
decl %ecx
movl %ecx, 0xc(%rsp)
leaq 0x5a150e(%rip), %rax    # 0x5b5e50
movl (%rax), %eax
decl %eax
movl %eax, 0x8(%rsp)
jmp 0x149cb
movl %ecx, %eax
sarl %eax
movl %edx, %esi
sarl %esi
subl %esi, %eax
leaq 0x14(%rsp), %rbx
movl %eax, (%rbx)
addl %edx, %eax
decl %eax
leaq 0xc(%rsp), %r14
movl %eax, (%r14)
leaq 0x5a14e0(%rip), %rax    # 0x5b5e50
movl (%rax), %eax
addl $-0x20, %eax
movl %eax, %esi
sarl %esi
imull %edx, %eax
cltd
idivl %ecx
movl %eax, %ecx
sarl %ecx
subl %ecx, %esi
leaq 0x10(%rsp), %r15
movl %esi, (%r15)
addl %esi, %eax
decl %eax
leaq 0x8(%rsp), %r12
movl %eax, (%r12)
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0x1b4ea
movl (%r15), %esi
leaq 0xcca9d(%rip), %rax     # 0xe1452
movb (%rax), %cl
sarl %cl, %esi
movl (%rbx), %edi
movl (%r14), %edx
movl (%r12), %eax
sarl %cl, %eax
movl %eax, %ecx
callq 0x44922
movswl (%rbp), %ecx
movl (%r13), %eax
cmpl %ecx, %eax
jl 0x14b52
decl %eax
leaq 0x5a146c(%rip), %r14    # 0x5b5e50
movl (%r14), %r10d
decl %r10d
subq $0x8, %rsp
xorl %ebx, %ebx
xorl %edi, %edi
xorl %esi, %esi
movl $0x196, %edx            # imm = 0x196
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %rbx
pushq %r10
pushq %rax
callq 0x9f3f
addq $0x20, %rsp
movl (%r13), %eax
movl $0xfffffec0, %r15d      # imm = 0xFFFFFEC0
leal (%rax,%r15), %edi
sarl %edi
movl (%r14), %r10d
leal -0x20(%r10), %esi
decl %eax
decl %r10d
subq $0x8, %rsp
movl $0x19e, %edx            # imm = 0x19E
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %rbx
pushq %r10
pushq %rax
callq 0x9efc
addq $0x20, %rsp
addl (%r13), %r15d
sarl %r15d
cmpl $0x8, %r15d
jl 0x14a94
leal -0x8(%r15), %ebx
movl (%r14), %eax
leal -0x20(%rax), %esi
movl (%r13), %r10d
decl %r10d
decl %eax
subq $0x8, %rsp
movl %ebx, %edi
movl $0x1b7, %edx            # imm = 0x1B7
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq $0x0
pushq %rax
pushq %r10
callq 0x9efc
addq $0x20, %rsp
cmpl $0xf, %r15d
movl %ebx, %r15d
jg 0x14a55
jmp 0x14a97
movl %r15d, %ebx
cmpl $0x4, %ebx
jl 0x14acf
addl $-0x4, %ebx
movl (%r14), %eax
leal -0x20(%rax), %esi
movl (%r13), %r10d
decl %r10d
decl %eax
subq $0x8, %rsp
movl %ebx, %edi
movl $0x1b9, %edx            # imm = 0x1B9
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq $0x0
pushq %rax
pushq %r10
callq 0x9efc
addq $0x20, %rsp
movl (%r13), %eax
leal -0x140(%rax), %ebx
sarl %ebx
addl $0x140, %ebx            # imm = 0x140
leal -0x8(%rax), %ecx
cmpl %ecx, %ebx
jg 0x14b1e
movl (%r14), %r10d
leal -0x20(%r10), %esi
decl %eax
decl %r10d
subq $0x8, %rsp
movl %ebx, %edi
movl $0x1b7, %edx            # imm = 0x1B7
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq $0x0
pushq %r10
pushq %rax
callq 0x9efc
addq $0x20, %rsp
addl $0x8, %ebx
movl (%r13), %eax
jmp 0x14ae1
leal -0x4(%rax), %ecx
cmpl %ecx, %ebx
jg 0x14b52
movl (%r14), %r10d
leal -0x20(%r10), %esi
decl %eax
decl %r10d
subq $0x8, %rsp
movl %ebx, %edi
movl $0x1b9, %edx            # imm = 0x1B9
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq $0x0
pushq %r10
pushq %rax
callq 0x9efc
addq $0x20, %rsp
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq