// File: /workspace/github_c_makefile_star2_O0/jrrk[P]cbzone/c_graphics.c
// Function: updatedisplay
void updatedisplay (missile, lander, score, numleft, sens, reset)
     Bool missile, lander, sens, reset;
     LONG score;  // Eric Fogelin made this LONG from int
     int numleft;
{
  char text[11];
  static Bool flasher[] = {False, False};
  static int currentnumleft = 0;
  static int currentscore = -1;
  static int bswitch[] = {918, 612};
  static int blswitch[] = {918, 638};	// Eric Fogelin: added - orig did not work
  static int wind1[][2] = {591, 571, 54, 29};
  static int wind2[][2] = {656, 571, 54, 29};
  static int origin[][2] = {733, 493, 733, 533, 733, 573, 733, 613};
  static Bool currentsens = True;

  gprsetclippingactive(False);
  if (reset) {
    flasher[0] = flasher[1] = False;
    currentsens = True;
  }

  if ((flasher[0] && !missile) ||       /* change the missile warning */
      (!flasher[0] && missile)) {
    flasher[0] = missile;
    bitblt(wind1);
  }
  if ((flasher[1] && !lander) ||        /* change the lander warning */
      (!flasher[1] && lander)) {
    flasher[1] = lander;
    bitblt(wind2);
  }
  if (score != currentscore) {          /*     change the score      */
    currentscore = score;
    sprintf(text,"%10ld",score);  // Eric Fogelin changed this to ld from d
    printstring(608, 542, text, strlen(text));
  }
  if (numleft < currentnumleft && numleft >= 0)    /* remove tank(s) */
    while (numleft != currentnumleft)
      removepixmap(4, origin[--currentnumleft]);
  if (numleft > currentnumleft)                    /*  add tank(s)   */
    while (numleft != currentnumleft && currentnumleft < 4)
      putpixmap(4, origin[currentnumleft++]);
  if (sens && !currentsens) {           /* change to high gear       */
    removepixmap(3, blswitch); // Eric Fogelin: added - orig did not work
    putpixmap(2, bswitch);
    currentsens = sens;
  }
  else if (!sens && currentsens) {      /* change to low gear        */
    removepixmap(2, bswitch);  // Eric Fogelin: added - orig did not work
    putpixmap(3, blswitch);
    currentsens = sens;
  }
  gprsetclippingactive(True);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl %r8d, -0x18(%rbp)
movl %r9d, -0x1c(%rbp)
xorl %edi, %edi
movb $0x0, %al
callq 0x98e0
cmpl $0x0, -0x1c(%rbp)
je 0xa95a
movl $0x0, 0xf286(%rip)      # 0x19bcc
movl $0x0, 0xf278(%rip)      # 0x19bc8
movl $0x1, 0xeb66(%rip)      # 0x194c0
cmpl $0x0, 0xf267(%rip)      # 0x19bc8
je 0xa969
cmpl $0x0, -0x4(%rbp)
je 0xa978
cmpl $0x0, 0xf258(%rip)      # 0x19bc8
jne 0xa98f
cmpl $0x0, -0x4(%rbp)
je 0xa98f
movl -0x4(%rbp), %eax
movl %eax, 0xf247(%rip)      # 0x19bc8
leaq 0xeaf8(%rip), %rdi      # 0x19480
movb $0x0, %al
callq 0x97b0
cmpl $0x0, 0xf236(%rip)      # 0x19bcc
je 0xa99e
cmpl $0x0, -0x8(%rbp)
je 0xa9ad
cmpl $0x0, 0xf227(%rip)      # 0x19bcc
jne 0xa9c4
cmpl $0x0, -0x8(%rbp)
je 0xa9c4
movl -0x8(%rbp), %eax
movl %eax, 0xf216(%rip)      # 0x19bcc
leaq 0xead3(%rip), %rdi      # 0x19490
movb $0x0, %al
callq 0x97b0
movq -0x10(%rbp), %rax
movslq 0xea95(%rip), %rcx      # 0x19464
cmpq %rcx, %rax
je 0xaa1d
movq -0x10(%rbp), %rax
movl %eax, 0xea86(%rip)      # 0x19464
leaq -0x27(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq 0x9e1d(%rip), %rsi      # 0x1480a
movb $0x0, %al
callq 0x52d0
leaq -0x27(%rbp), %rax
movq %rax, -0x30(%rbp)
leaq -0x27(%rbp), %rdi
callq 0x5270
movq -0x30(%rbp), %rdx
movq %rax, %rcx
movl $0x260, %edi            # imm = 0x260
movl $0x21e, %esi            # imm = 0x21E
movb $0x0, %al
callq 0x9490
movl -0x14(%rbp), %eax
cmpl 0xf1aa(%rip), %eax      # 0x19bd0
jge 0xaa6a
cmpl $0x0, -0x14(%rbp)
jl 0xaa6a
jmp 0xaa30
movl -0x14(%rbp), %eax
cmpl 0xf197(%rip), %eax      # 0x19bd0
je 0xaa68
movl 0xf18f(%rip), %eax      # 0x19bd0
addl $-0x1, %eax
movl %eax, 0xf186(%rip)      # 0x19bd0
cltq
leaq 0xea4d(%rip), %rsi      # 0x194a0
shlq $0x3, %rax
addq %rax, %rsi
movl $0x4, %edi
movb $0x0, %al
callq 0xa290
jmp 0xaa30
jmp 0xaa6a
movl -0x14(%rbp), %eax
cmpl 0xf15d(%rip), %eax      # 0x19bd0
jle 0xaace
jmp 0xaa77
movl -0x14(%rbp), %ecx
xorl %eax, %eax
cmpl 0xf14e(%rip), %ecx      # 0x19bd0
movb %al, -0x31(%rbp)
je 0xaa94
cmpl $0x4, 0xf142(%rip)      # 0x19bd0
setl %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0xaa9d
jmp 0xaacc
movl 0xf12d(%rip), %eax      # 0x19bd0
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0xf122(%rip)      # 0x19bd0
cltq
leaq 0xe9e9(%rip), %rsi      # 0x194a0
shlq $0x3, %rax
addq %rax, %rsi
movl $0x4, %edi
movb $0x0, %al
callq 0xa1d0
jmp 0xaa77
jmp 0xaace
cmpl $0x0, -0x18(%rbp)
je 0xab0e
cmpl $0x0, 0xe9e5(%rip)      # 0x194c0
jne 0xab0e
movl $0x3, %edi
leaq 0xe987(%rip), %rsi      # 0x19470
movb $0x0, %al
callq 0xa290
movl $0x2, %edi
leaq 0xe96c(%rip), %rsi      # 0x19468
movb $0x0, %al
callq 0xa1d0
movl -0x18(%rbp), %eax
movl %eax, 0xe9b4(%rip)      # 0x194c0
jmp 0xab4e
cmpl $0x0, -0x18(%rbp)
jne 0xab4c
cmpl $0x0, 0xe9a5(%rip)      # 0x194c0
je 0xab4c
movl $0x2, %edi
leaq 0xe93f(%rip), %rsi      # 0x19468
movb $0x0, %al
callq 0xa290
movl $0x3, %edi
leaq 0xe934(%rip), %rsi      # 0x19470
movb $0x0, %al
callq 0xa1d0
movl -0x18(%rbp), %eax
movl %eax, 0xe974(%rip)      # 0x194c0
jmp 0xab4e
movl $0x1, %edi
movb $0x0, %al
callq 0x98e0
addq $0x40, %rsp
popq %rbp
retq