// File: /workspace/github_c_makefile_star2_O2/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 $0x28, %rsp
leaq 0xc8695(%rip), %rbp     # 0xdbba2
movswl (%rbp), %edx
leaq 0x59b954(%rip), %r13    # 0x5aee6c
movl (%r13), %ecx
cmpl %edx, %ecx
jge 0x13545
andl $0x0, 0x24(%rsp)
andl $0x0, 0x20(%rsp)
leal -0x1(%rcx), %eax
movl %eax, 0x1c(%rsp)
leaq 0x59b938(%rip), %rax    # 0x5aee70
movl (%rax), %eax
decl %eax
movl %eax, 0x18(%rsp)
jmp 0x135cc
movl %ecx, %eax
sarl %eax
movl %edx, %esi
sarl %esi
subl %esi, %eax
leaq 0x24(%rsp), %rbx
movl %eax, (%rbx)
addl %edx, %eax
decl %eax
leaq 0x1c(%rsp), %r14
movl %eax, (%r14)
leaq 0x59b907(%rip), %rax    # 0x5aee70
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 0x20(%rsp), %r15
movl %esi, (%r15)
addl %esi, %eax
decl %eax
leaq 0x18(%rsp), %r12
movl %eax, (%r12)
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0x19eda
movl (%r15), %esi
leaq 0xc6ea4(%rip), %rax     # 0xda452
movb (%rax), %cl
sarl %cl, %esi
movl (%rbx), %edi
movl (%r14), %edx
movl (%r12), %eax
sarl %cl, %eax
movl %eax, %ecx
callq 0x41e1e
movswl (%rbp), %edx
movl (%r13), %ecx
cmpl %edx, %ecx
jl 0x1372b
decl %ecx
leaq 0x59b893(%rip), %r14    # 0x5aee70
movl (%r14), %eax
decl %eax
andl $0x0, 0x10(%rsp)
movl %eax, 0x8(%rsp)
movl %ecx, (%rsp)
xorl %edi, %edi
xorl %esi, %esi
movl $0x196, %edx            # imm = 0x196
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x939f
movl (%r13), %eax
movl $0xfffffec0, %ebx       # imm = 0xFFFFFEC0
leal (%rax,%rbx), %edi
sarl %edi
movl (%r14), %ecx
leal -0x20(%rcx), %esi
decl %eax
decl %ecx
andl $0x0, 0x10(%rsp)
movl %ecx, 0x8(%rsp)
movl %eax, (%rsp)
movl $0x19e, %edx            # imm = 0x19E
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x935c
addl (%r13), %ebx
sarl %ebx
cmpl $0x8, %ebx
jl 0x13678
addl $-0x8, %ebx
movl (%r14), %eax
leal -0x20(%rax), %esi
movl (%r13), %ecx
decl %ecx
decl %eax
andl $0x0, 0x10(%rsp)
movl %eax, 0x8(%rsp)
movl %ecx, (%rsp)
movl %ebx, %edi
movl $0x1b7, %edx            # imm = 0x1B7
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x935c
jmp 0x13640
movl (%r13), %eax
cmpl $0x4, %ebx
jl 0x136b2
addl $-0x4, %ebx
movl (%r14), %ecx
leal -0x20(%rcx), %esi
decl %eax
decl %ecx
andl $0x0, 0x10(%rsp)
movl %ecx, 0x8(%rsp)
movl %eax, (%rsp)
movl %ebx, %edi
movl $0x1b9, %edx            # imm = 0x1B9
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x935c
movl (%r13), %eax
leal -0x140(%rax), %ebx
sarl %ebx
addl $0x140, %ebx            # imm = 0x140
leal -0x8(%rax), %ecx
cmpl %ecx, %ebx
jg 0x136fa
movl (%r14), %ecx
leal -0x20(%rcx), %esi
decl %eax
decl %ecx
andl $0x0, 0x10(%rsp)
movl %ecx, 0x8(%rsp)
movl %eax, (%rsp)
movl %ebx, %edi
movl $0x1b7, %edx            # imm = 0x1B7
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x935c
addl $0x8, %ebx
movl (%r13), %eax
jmp 0x136c0
leal -0x4(%rax), %ecx
cmpl %ecx, %ebx
jg 0x1372b
movl (%r14), %ecx
leal -0x20(%rcx), %esi
decl %eax
decl %ecx
andl $0x0, 0x10(%rsp)
movl %ecx, 0x8(%rsp)
movl %eax, (%rsp)
movl %ebx, %edi
movl $0x1b9, %edx            # imm = 0x1B9
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x935c
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq