// File: /workspace/github_c_makefile_star2_O3/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 0xd120a(%rip), %rbp     # 0xe5ba2
movswl (%rbp), %ecx
leaq 0x5a44c9(%rip), %r13    # 0x5b8e6c
movl (%r13), %r10d
cmpl %ecx, %r10d
jge 0x149d2
xorl %eax, %eax
movl %eax, 0x14(%rsp)
movl %eax, 0x10(%rsp)
leal -0x1(%r10), %eax
movl %eax, 0xc(%rsp)
leaq 0x5a44ab(%rip), %rax    # 0x5b8e70
movl (%rax), %eax
decl %eax
movl %eax, 0x8(%rsp)
jmp 0x14a5b
movl %r10d, %eax
sarl %eax
movl %ecx, %edx
sarl %edx
subl %edx, %eax
leaq 0x14(%rsp), %rbx
movl %eax, (%rbx)
addl %ecx, %eax
decl %eax
leaq 0xc(%rsp), %r14
movl %eax, (%r14)
leaq 0x5a4479(%rip), %rax    # 0x5b8e70
movl (%rax), %eax
addl $-0x20, %eax
movl %eax, %esi
sarl %esi
imull %ecx, %eax
cltd
idivl %r10d
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 0x1b6c0
movl (%r15), %esi
leaq 0xcfa15(%rip), %rax     # 0xe4452
movb (%rax), %cl
sarl %cl, %esi
movl (%rbx), %edi
movl (%r14), %edx
movl (%r12), %eax
sarl %cl, %eax
movl %eax, %ecx
callq 0x4624e
movswl (%rbp), %ecx
movl (%r13), %r10d
cmpl %ecx, %r10d
jl 0x14bd8
decl %r10d
leaq 0x5a4402(%rip), %r14    # 0x5b8e70
movl (%r14), %eax
decl %eax
subq $0x8, %rsp
xorl %r15d, %r15d
xorl %edi, %edi
xorl %esi, %esi
movl $0x196, %edx            # imm = 0x196
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %r15
pushq %rax
pushq %r10
callq 0x9f5f
addq $0x20, %rsp
movl (%r13), %eax
movl $0xfffffec0, %ebx       # imm = 0xFFFFFEC0
leal (%rax,%rbx), %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 %r15
pushq %r10
pushq %rax
callq 0x9f1c
addq $0x20, %rsp
movl (%r13), %eax
addl %eax, %ebx
sarl %ebx
cmpl $0x8, %ebx
jl 0x14b20
movl %ebx, %r15d
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 0x9f1c
addq $0x20, %rsp
cmpl $0xf, %r15d
ja 0x14adf
movl (%r13), %eax
cmpl $0x4, %ebx
jl 0x14b59
addl $-0x4, %ebx
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 0x9f1c
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 0x14ba4
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 0x9f1c
addq $0x20, %rsp
addl $0x8, %ebx
movl (%r13), %eax
jmp 0x14b67
leal -0x4(%rax), %ecx
cmpl %ecx, %ebx
jg 0x14bd8
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 0x9f1c
addq $0x20, %rsp
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq