// File: /workspace/github_c_makefile_star2_O1/hyc[P]trek73c/trekx.c
// Function: TrekInit
void TrekInit()
{
  register int I, J, K;
  int FORLIM;
  double Junk;
  Object *WITH;
  Srec *WITH1;
  int FORLIM1;
  WINDOW *Twin, *subwin();
  boolean Intro, Ok;
  char *Trash, *Temp, *Temp2, c;

  clear();
  mvaddstr(0,31,"*** Star Trek ***");
  mvaddstr(2,29,"Version 1.01 - curses:");
  refresh();
  mvaddstr(3,10,
	 "\"Novice\" has 60 seconds for response, otherwise 10 seconds.");
  
  mvaddstr(6,0,"Captain: My last name is ");
  do {
    move(6,25);
    clrtoeol();
    mygetstr(stdscr,scrstr,true);
     J = strlen(scrstr);
  } while (J <= 1);
  Name=Namebuf;
  strncpy(Name,scrstr,20);

  cheat = false;
  if (Name[0] == '*' || Name[0] == '!') {
    if (Name[0] == '!')
	cheat = true;
    Name++;
    J--;
    Intro = false;
  } else
    Intro = true;
  for (I = 0; I < J; I++) {
    if (isupper(Name[I]))
      Name[I] = tolower(Name[I]);
  }
  if (!strcmp(Name, "novice"))
    Timer = 59;
  else
    Timer = 10;
  Name[0] = toupper(Name[0]);

  mvaddstr(8,0, Name);
  addstr(": My sex is ");
  mygetstr(stdscr,scrstr,true);
  scrstr[0] = toupper(scrstr[0]);
  if (scrstr[0] == 'M')
    Title = Male;
  else if (scrstr[0] == 'F')
    Title = Female;
  else
    Title = Slurs[_randint(5)];
  do {
    Ok = true;
    move(9,3);
    addstr("I'm expecting [1-9] enemy vessels: ");
    clrtobot();
    mygetstr(stdscr,scrstr,true);
    I=atoi(scrstr);
    if (I < 1 || I > 9) {
      Ok = false;
      sprintf(scrstr,"Uhura: %s, Starfleet Command reports that it can only\n",
	     Title);
      mvaddstr(11,0,scrstr);
      addstr("   be from 1 to 9.\n\n");
      refresh();

      Delay(500L);

      addstr(Name);
      addstr(": Correct, Lieutenant - just testing your attention.");
      refresh();
      getch();
    }
  } while (!Ok);
  Enemies = I;
  Vessels = Enemies + 1;
  ObjCount = Vessels;
  for (I = 0; I < 4; I++)
    Ct[I] = 0;
  Win = 0;
  for (I = 0; I < 100; I++)
    Objects[I] = NULL;
  FORLIM = Vessels;
  for (I = 0; I < FORLIM; I++) {
    Objects[I] = (Object *)Malloc(sizeof(Object));
    WITH = Objects[I];
    WITH->Act_Spd = 0.0;
    WITH->Des_Spd = 0.0;
    WITH->Act_Crs = 0.0;
    WITH->Des_Crs = 0.0;
    WITH->Fuel = 150.0;
    WITH->Tim_Del = 0.0;
    WITH->Prx_Del = 0.0;
    WITH->XPos = 0.0;
    WITH->YPos = 0.0;
    WITH->Trgt = 0;
    WITH->ObTyp = I;
  }
  for (I = 0; I < 10; I++)
    Shps[I] = I;
  for (I = 1; I < 9; I++) {
    J = _randint(10 - I) + I;
    K = Shps[I];
    Shps[I] = Shps[J];
    Shps[J] = K;
  }
  FORLIM = Vessels;
  for (I = 1; I < FORLIM; I++)
    Snams[I] = Badguys[Shps[I]-1];
  Snams[0] = Feds[_randint(12)];

  for (I = 1; I < FORLIM; I++)
    Objects[I]->ObTyp = Shps[I];
  Enemy = EnemNms[_randint(5)];
  Capt = Captains[_randint(10)];
  Twin = subwin(stdscr, 0, 0, 0, 7);
  scrollok(Twin,TRUE);

  clear();
  refresh();
  if (Intro) {
    mvwaddstr(Twin,1,6,"Space, the final frontier.");
    mvwaddstr(Twin,2,6,"These are the voyages of the Starship ** ");
    waddstr(Twin,Snams[0]);
    waddstr(Twin," **.");
    mvwaddstr(Twin,3,6,"Its five year mission: To explore strange new worlds,");
    mvwaddstr(Twin,4,6,"to seek out new life and new civilizations,");
    mvwaddstr(Twin,5,6,"to boldly go where no man has gone before!");
    mvwaddstr(Twin,7,24,"S T A R   T R E K");
    wmove(Twin,8,0);
    wrefresh(Twin);
    Delay(3000);

    Junk = (_randint(50) + 50) * 100 + _randint(1000) / 10.0;
    sprintf(scrstr,"\nCaptain's Log, stardate %6.1f\n\n", Junk);
    waddstr(Twin, scrstr);

    J = 0;
    FORLIM = _randint(20);
    for (I = 0; I <= FORLIM;) {
      if (Missions[J][0] == ' ')
	 I++;
      J++;
    }
    Temp = Missions[J-1];
    sprintf(scrstr,"  %s\n", Temp);
    waddstr(Twin, scrstr);
    do {
      Temp = Missions[J];
      J++;
      if (Temp[0] != ' ') {        
	sprintf(scrstr,"   %s\n", Temp);
        waddstr(Twin,scrstr);
      }
    } while (Temp[0] != ' ');
    c="a23456789"[Enemies - 1];
    if (Enemies > 1)
      Trash = "s";
    else
      Trash = "";
    wrefresh(Twin);
    Delay(2000);
    sprintf(scrstr,"\nSulu: %s, I'm picking up %c vessel%s on interception\n",
	   Title, c, Trash);
    waddstr(Twin,scrstr);
    sprintf(scrstr,"   course%s with the %s.\n\n", Trash, Snams[0]);
    waddstr(Twin,scrstr);
    wrefresh(Twin);
    Delay(1500);
    if (Enemies > 1) {
      Temp = "them";
      Temp2 = "";
    } else {
      Temp = "it";
      Temp2 = "a ";
    }
    sprintf(scrstr,"Spock: Sensors identify %s as %s%s battle\n", Temp, Temp2,
	 Enemy);
    waddstr(Twin,scrstr);
    sprintf(scrstr,"   cruiser%s, probably under the command of Captain %s.\n",
	   Trash, Capt);
    waddstr(Twin,scrstr);
    wrefresh(Twin);
    Delay(1000);
    sprintf(scrstr,"\n%s: Sound General Quarters, Lieutenant!\n", Name);
    waddstr(Twin,scrstr);
    wrefresh(Twin);
    Delay(1000);
    sprintf(scrstr,"\nUhura: Aye, %s!\n", Title);
    waddstr(Twin,scrstr);
    wrefresh(Twin);
    Delay(1000);
  }
  sprintf(scrstr,"\nComputer: The %ss are attacking the %s with the\n",
	 Enemy, Snams[0]);
  waddstr(Twin,scrstr);
  waddstr(Twin,"  ");
  FORLIM = Vessels;
  for (I = 1; I < FORLIM; I++) {
    if (I == 7)
      waddstr(Twin,"\n  ");
    waddch(Twin,' ');
    waddstr(Twin,Snams[I]);
    if (I != Enemies) {
      if (Enemies > 2)
	waddch(Twin,',');
      if (I == Vessels - 2)
	waddstr(Twin," and the");
    }
  }
  waddstr(Twin,".\n\n\n[Press a key to continue]");
  wrefresh(Twin);
  getch();
  for (I = 0; I < 10; I++)
    Ships[I] = NULL;
  FORLIM = Vessels;
  for (I = 0; I < FORLIM; I++) {
    Ships[I] = (Srec *)Malloc(sizeof(Srec));
    WITH1 = Ships[I];
    WITH1->Weff = 0.75;
    WITH1->Fcap = 200;
    WITH1->Regen = 10.0;
    FORLIM1 = Phasers;
    for (J = 0; J < FORLIM1; J++) {
      WITH1->PChrg[J] = 10.0;
      WITH1->PCrts[J] = 10.0;
      WITH1->Pstat[J] = 0;
    }
    WITH1->Pstat[Phasers] = 10;
    WITH1->Pstat[Phasers + 1] = 100;
    WITH1->Pdepl[0] = 90.0;
    WITH1->Pdepl[1] = 0.0;
    WITH1->Pdepl[2] = 0.0;
    WITH1->Pdepl[3] = 270.0;
    for (J = 0; J < 6; J++) {
      WITH1->Tstat[J] = 0;
      WITH1->Tengy[J] = 0;
    }
    WITH1->Tstat[Tubes] = 12;
    WITH1->Tstat[Tubes + 1] = 10;
    WITH1->Tstat[Tubes + 2] = 200;
    WITH1->TDepl[0] = 120.0;
    WITH1->TDepl[1] = 60.0;
    WITH1->TDepl[2] = 0.0;
    WITH1->TDepl[3] = 0.0;
    WITH1->TDepl[4] = 300.0;
    WITH1->TDepl[5] = 240.0;
    for (CC = Comp; (long)CC <= (long)Engn; CC = (Damages)((long)CC + 1))
      WITH1->Dmge[(long)CC] = false;
    for (J = 0; J < 4; J++) {
      WITH1->Sdrns[J] = 1.0;
      WITH1->Seff[J] = 100.0;
    }
    WITH1->Crew = 350;
  }
  WITH1 = Ships[0];
  WITH1->Fcap = 250;
  WITH1->Crew = 450;
  WITH1->Weff = 1.0;
  FORLIM = Vessels;
  for (I = 0; I < FORLIM; I++) {
    WITH = Objects[I];
    WITH->Act_Spd = 1.0;
    WITH->Des_Spd = 1.0;
    WITH->Act_Crs = _randint(360);
    WITH->Des_Crs = WITH->Act_Crs;
    WITH->Trgt = 0;
    WITH->Tim_Del = 1.0;
    WITH->Prx_Del = 0.0;
    J = _randint(500) + 4300;
    Junk = _randint(360) * M_PI / 180.0;
    WITH->XPos = J * cos(Junk);
    WITH->YPos = -J * sin(Junk);
  }
  WITH = Objects[0];
  WITH->Act_Crs = 0.0;
  WITH->Des_Crs = 0.0;
  WITH->Tim_Del = 0.0;
  WITH->Fuel = 200.0;
  WITH->XPos = 0.0;
  WITH->YPos = 0.0;
  delwin(Twin);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq 0x10971(%rip), %r13     # 0x12fe8
movq (%r13), %rdi
callq 0x2050
movq (%r13), %rdi
xorl %esi, %esi
movl $0x1f, %edx
callq 0x21e0
cmpl $-0x1, %eax
je 0x26aa
movq (%r13), %rdi
leaq 0xb490(%rip), %rsi      # 0xdb30
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq (%r13), %rdi
movl $0x2, %esi
movl $0x1d, %edx
callq 0x21e0
cmpl $-0x1, %eax
je 0x26d7
movq (%r13), %rdi
leaq 0xb475(%rip), %rsi      # 0xdb42
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq (%r13), %rdi
callq 0x2190
movq (%r13), %rdi
movl $0x3, %esi
movl $0xa, %edx
callq 0x21e0
cmpl $-0x1, %eax
je 0x270d
movq (%r13), %rdi
leaq 0xb456(%rip), %rsi      # 0xdb59
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq (%r13), %rdi
movl $0x6, %esi
xorl %edx, %edx
callq 0x21e0
cmpl $-0x1, %eax
je 0x2737
movq (%r13), %rdi
leaq 0xb468(%rip), %rsi      # 0xdb95
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
leaq 0x10d72(%rip), %r14     # 0x134b0
movq (%r13), %rdi
movl $0x6, %esi
movl $0x19, %edx
callq 0x21e0
movq (%r13), %rdi
callq 0x2220
movq (%r13), %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x249f
movq %r14, %rdi
callq 0x2150
movq %rax, %rbx
cmpl $0x2, %ebx
jl 0x273e
leaq 0x10e2e(%rip), %rdi     # 0x135b0
movq %rdi, 0x10e3f(%rip)     # 0x135c8
leaq 0x10d20(%rip), %rsi     # 0x134b0
movl $0x14, %edx
callq 0x2270
movb $0x0, 0x10e2f(%rip)     # 0x135d0
movzbl 0x10e08(%rip), %eax     # 0x135b0
cmpl $0x2a, %eax
je 0x27b9
cmpl $0x21, %eax
jne 0x27d0
movb $0x1, 0x10e17(%rip)     # 0x135d0
leaq 0x10df1(%rip), %rax     # 0x135b1
movq %rax, 0x10e01(%rip)     # 0x135c8
decl %ebx
movb $0x1, %al
movl %eax, (%rsp)
jmp 0x27d7
movl $0x0, (%rsp)
testl %ebx, %ebx
jle 0x2815
callq 0x2170
movq %rax, %r14
movl %ebx, %ebx
xorl %r15d, %r15d
movq (%r14), %rax
movq 0x10dd6(%rip), %r12     # 0x135c8
movsbq (%r12,%r15), %rbp
testb $0x1, 0x1(%rax,%rbp,2)
je 0x280d
callq 0x2260
movq (%rax), %rax
movb (%rax,%rbp,4), %al
movb %al, (%r12,%r15)
incq %r15
cmpq %r15, %rbx
jne 0x27e8
movq 0x10dac(%rip), %r14     # 0x135c8
leaq 0xb38c(%rip), %rsi      # 0xdbaf
movq %r14, %rdi
callq 0x2230
testl %eax, %eax
movl $0x3b, %eax
movl $0xa, %ecx
cmovel %eax, %ecx
movb %cl, 0x10d91(%rip)      # 0x135d1
callq 0x2110
movq %rax, %rbx
movq (%rax), %rax
movsbq (%r14), %rcx
movb (%rax,%rcx,4), %al
movb %al, (%r14)
movq (%r13), %rdi
movl $0x8, %esi
xorl %edx, %edx
callq 0x21e0
cmpl $-0x1, %eax
je 0x287f
movq (%r13), %rdi
movq 0x10d53(%rip), %rsi     # 0x135c8
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq (%r13), %rdi
leaq 0xb32c(%rip), %rsi      # 0xdbb6
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq (%r13), %rdi
leaq 0x10c11(%rip), %rsi     # 0x134b0
movl $0x1, %edx
callq 0x249f
movq (%rbx), %rax
movsbq 0x10bfc(%rip), %rcx     # 0x134b0
movzbl (%rax,%rcx,4), %eax
movb %al, 0x10bf2(%rip)      # 0x134b0
cmpl $0x4d, %eax
je 0x28d1
cmpl $0x46, %eax
jne 0x28da
leaq 0x10929(%rip), %rax     # 0x131f8
jmp 0x290a
leaq 0x10918(%rip), %rax     # 0x131f0
jmp 0x290a
callq 0x22e0
sarl $0x3, %eax
cltq
imulq $0x66666667, %rax, %rcx # imm = 0x66666667
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x21, %rcx
addl %edx, %ecx
leal (%rcx,%rcx,4), %ecx
subl %ecx, %eax
cltq
leaq 0x109da(%rip), %rcx     # 0x132e0
leaq (%rcx,%rax,8), %rax
movq (%rax), %rax
movq %rax, 0x10cc4(%rip)     # 0x135d8
leaq 0x10b95(%rip), %r14     # 0x134b0
leaq 0xb2fc(%rip), %r12      # 0xdc1e
leaq 0x10(%rsp), %rbx
leaq 0xb305(%rip), %rbp      # 0xdc33
movq (%r13), %rdi
movl $0x9, %esi
movl $0x3, %edx
callq 0x21e0
movq (%r13), %rdi
leaq 0xb277(%rip), %rsi      # 0xdbc3
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq (%r13), %rdi
callq 0x22c0
movq (%r13), %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x249f
movq %r14, %rdi
callq 0x21d0
movl %eax, %r15d
leal -0xa(%r15), %eax
cmpl $-0xa, %eax
ja 0x2a3f
movq 0x10c49(%rip), %rdx     # 0x135d8
movq %r14, %rdi
leaq 0xb24e(%rip), %rsi      # 0xdbe7
xorl %eax, %eax
callq 0x21a0
movq (%r13), %rdi
movl $0xb, %esi
xorl %edx, %edx
callq 0x21e0
cmpl $-0x1, %eax
je 0x29c6
movq (%r13), %rdi
movq %r14, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq (%r13), %rdi
movq %r12, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq (%r13), %rdi
callq 0x2190
movq $0x7a120, 0x18(%rsp)    # imm = 0x7A120
movq $0x0, 0x10(%rsp)
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movq %rbx, %r8
callq 0x20c0
movq (%r13), %rdi
movq 0x10bbb(%rip), %rsi     # 0x135c8
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq (%r13), %rdi
movq %rbp, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq (%r13), %rdi
callq 0x2190
movq (%r13), %rdi
callq 0x2300
jmp 0x292e
movb %r15b, 0x10b9a(%rip)    # 0x135e0
incb %r15b
movb %r15b, 0x10b91(%rip)    # 0x135e1
movb %r15b, 0x10b8b(%rip)    # 0x135e2
movl $0x0, 0x10b83(%rip)     # 0x135e4
movb $0x0, 0x10b80(%rip)     # 0x135e8
leaq 0x10b81(%rip), %rbx     # 0x135f0
xorl %r14d, %r14d
movl $0x320, %edx            # imm = 0x320
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2040
movzbl %r15b, %r15d
movabsq $0x4062c00000000000, %r12 # imm = 0x4062C00000000000
movl $0x50, %edi
callq 0x20e0
movq %rax, (%rbx)
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movupd %xmm0, 0x10(%rax)
movq %r12, 0x20(%rax)
movupd %xmm0, 0x38(%rax)
movupd %xmm0, 0x28(%rax)
movw $0x0, 0x48(%rax)
movw %r14w, 0x4a(%rax)
incq %r14
addq $0x8, %rbx
cmpq %r14, %r15
jne 0x2a8f
leaq 0x10e3b(%rip), %rax     # 0x13910
xorl %ecx, %ecx
movw %cx, (%rax)
incq %rcx
addq $0x2, %rax
cmpq $0xa, %rcx
jne 0x2ad7
movl $0x1, %r14d
movl $0x9, %ebp
leaq 0x10e17(%rip), %rbx     # 0x13910
callq 0x22e0
sarl $0x3, %eax
cltd
idivl %ebp
movzwl (%rbx,%r14,2), %eax
movslq %edx, %rcx
addq %r14, %rcx
movzwl (%rbx,%rcx,2), %edx
movw %dx, (%rbx,%r14,2)
movw %ax, (%rbx,%rcx,2)
incq %r14
decl %ebp
cmpq $0x9, %r14
jne 0x2af9
movzbl 0x10ab2(%rip), %r14d    # 0x135e1
cmpq $0x2, %r14
jb 0x2b5e
movl $0x1, %eax
leaq 0x106bf(%rip), %rcx     # 0x13200
leaq 0x10de8(%rip), %rdx     # 0x13930
movswq (%rbx,%rax,2), %rsi
movq -0x8(%rcx,%rsi,8), %rsi
movq %rsi, (%rdx,%rax,8)
incq %rax
cmpq %rax, %r14
jne 0x2b48
callq 0x22e0
sarl $0x3, %eax
cltq
imulq $0x2aaaaaab, %rax, %rcx # imm = 0x2AAAAAAB
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x21, %rcx
addl %edx, %ecx
shll $0x2, %ecx
leal (%rcx,%rcx,2), %ecx
subl %ecx, %eax
cltq
leaq 0x106c3(%rip), %rcx     # 0x13250
movq (%rcx,%rax,8), %rax
movq %rax, 0x10d98(%rip)     # 0x13930
cmpb $0x2, %r14b
jb 0x2bbe
movl $0x1, %eax
leaq 0x10a46(%rip), %rcx     # 0x135f0
movzwl (%rbx,%rax,2), %edx
movq (%rcx,%rax,8), %rsi
movw %dx, 0x4a(%rsi)
incq %rax
cmpq %rax, %r14
jne 0x2baa
callq 0x22e0
sarl $0x3, %eax
cltq
imulq $0x66666667, %rax, %rcx # imm = 0x66666667
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x21, %rcx
addl %edx, %ecx
leal (%rcx,%rcx,4), %ecx
subl %ecx, %eax
cltq
leaq 0x106c6(%rip), %rcx     # 0x132b0
movq (%rcx,%rax,8), %rax
movq %rax, 0x10d8b(%rip)     # 0x13980
callq 0x22e0
sarl $0x3, %eax
cltq
imulq $0x66666667, %rax, %rcx # imm = 0x66666667
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x22, %rcx
addl %edx, %ecx
addl %ecx, %ecx
leal (%rcx,%rcx,4), %ecx
subl %ecx, %eax
cltq
leaq 0x106ed(%rip), %rcx     # 0x13310
movq (%rcx,%rax,8), %rax
movq %rax, 0x10d5a(%rip)     # 0x13988
movq (%r13), %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movl $0x7, %r8d
callq 0x2320
movq %rax, %rbp
movq %rax, %rdi
movl $0x1, %esi
callq 0x2250
movq (%r13), %rdi
callq 0x2050
movq (%r13), %rdi
callq 0x2190
cmpb $0x0, (%rsp)
movq %rbp, (%rsp)
jne 0x315e
movq %rbp, %rdi
movl $0x1, %esi
movl $0x6, %edx
callq 0x21e0
cmpl $-0x1, %eax
je 0x2c9e
leaq 0xafd7(%rip), %rsi      # 0xdc68
movq %rbp, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq %rbp, %rdi
movl $0x2, %esi
movl $0x6, %edx
callq 0x21e0
cmpl $-0x1, %eax
je 0x2cc9
leaq 0xafc7(%rip), %rsi      # 0xdc83
movq %rbp, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq 0x10c60(%rip), %rsi     # 0x13930
movq %rbp, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
leaq 0xafc9(%rip), %rsi      # 0xdcad
movq %rbp, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq %rbp, %rdi
movl $0x3, %esi
movl $0x6, %edx
callq 0x21e0
cmpl $-0x1, %eax
je 0x2d1c
leaq 0xafa3(%rip), %rsi      # 0xdcb2
movq %rbp, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq %rbp, %rdi
movl $0x4, %esi
movl $0x6, %edx
callq 0x21e0
cmpl $-0x1, %eax
je 0x2d47
leaq 0xafae(%rip), %rsi      # 0xdce8
movq %rbp, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq %rbp, %rdi
movl $0x5, %esi
movl $0x6, %edx
callq 0x21e0
cmpl $-0x1, %eax
je 0x2d72
leaq 0xafaf(%rip), %rsi      # 0xdd14
movq %rbp, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq %rbp, %rdi
movl $0x7, %esi
movl $0x18, %edx
callq 0x21e0
cmpl $-0x1, %eax
je 0x2d9d
leaq 0xafaf(%rip), %rsi      # 0xdd3f
movq %rbp, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
xorl %r15d, %r15d
movq %rbp, %rdi
movl $0x8, %esi
xorl %edx, %edx
callq 0x21e0
movq %rbp, %rdi
callq 0x2190
leaq 0x10(%rsp), %r8
movq $0x0, 0x8(%r8)
movq $0x3, (%r8)
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x20c0
callq 0x22e0
sarl $0x3, %eax
cltq
imulq $0x51eb851f, %rax, %rcx # imm = 0x51EB851F
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x24, %rcx
addl %edx, %ecx
imull $0x32, %ecx, %ecx
subl %ecx, %eax
imull $0x64, %eax, %eax
addl $0x1388, %eax           # imm = 0x1388
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x8(%rsp)
callq 0x22e0
sarl $0x3, %eax
cltq
imulq $0x10624dd3, %rax, %rcx # imm = 0x10624DD3
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x26, %rcx
addl %edx, %ecx
imull $0x3e8, %ecx, %ecx      # imm = 0x3E8
subl %ecx, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0xa1c6(%rip), %xmm0     # 0xd008
addsd 0x8(%rsp), %xmm0
leaq 0x10661(%rip), %r14     # 0x134b0
leaq 0xaefb(%rip), %rsi      # 0xdd51
movq %r14, %rdi
movb $0x1, %al
callq 0x21a0
movq %rbp, %rdi
movq %r14, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
callq 0x22e0
sarl $0x3, %eax
cltq
imulq $0x66666667, %rax, %rcx # imm = 0x66666667
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x23, %rcx
addl %edx, %ecx
shll $0x2, %ecx
leal (%rcx,%rcx,4), %ecx
subl %ecx, %eax
js 0x2ebd
leaq 0x104c1(%rip), %rcx     # 0x13360
xorl %r15d, %r15d
xorl %edx, %edx
movq (%rcx), %rsi
xorl %edi, %edi
cmpb $0x20, (%rsi)
sete %dil
addl %edi, %edx
addq $0x8, %rcx
incl %r15d
cmpl %eax, %edx
jle 0x2ea4
movslq %r15d, %rbx
leaq 0x10499(%rip), %r15     # 0x13360
movq -0x8(%r15,%rbx,8), %rdx
leaq 0x105dd(%rip), %r14     # 0x134b0
leaq 0xae99(%rip), %rsi      # 0xdd73
movq %r14, %rdi
xorl %eax, %eax
callq 0x21a0
movq %rbp, %rdi
movq %r14, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movl %ebx, %eax
leaq (%r15,%rax,8), %rbx
leaq 0xae71(%rip), %r15      # 0xdd72
movq (%rbx), %r12
cmpb $0x20, (%r12)
je 0x2f2b
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x21a0
movq %rbp, %rdi
movq %r14, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
addq $0x8, %rbx
cmpb $0x20, (%r12)
jne 0x2f01
movzbl 0x106a3(%rip), %eax     # 0x135e0
cmpq $0x2, %rax
leaq 0xae31(%rip), %rcx      # 0xdd79
movsbl -0x1(%rax,%rcx), %ebp
leaq 0xb029(%rip), %r15      # 0xdf7d
leaq 0xacd7(%rip), %rbx      # 0xdc32
cmovbq %rbx, %r15
movq (%rsp), %rdi
callq 0x2190
xorl %eax, %eax
leaq 0x10(%rsp), %r12
movq %rax, 0x8(%r12)
movq $0x2, (%r12)
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r12, %r8
callq 0x20c0
movq 0x10645(%rip), %rdx     # 0x135d8
leaq 0x10516(%rip), %r14     # 0x134b0
leaq 0xade2(%rip), %rsi      # 0xdd83
movq %r14, %rdi
movl %ebp, %ecx
movq %r15, %r8
xorl %eax, %eax
callq 0x21a0
movq (%rsp), %rdi
movq %r14, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq 0x10968(%rip), %rcx     # 0x13930
leaq 0xadeb(%rip), %rsi      # 0xddba
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x21a0
movq (%rsp), %rdi
movq %r14, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq (%rsp), %rdi
callq 0x2190
movq $0x7a120, 0x8(%r12)     # imm = 0x7A120
movl $0x1, %ebp
movq %rbp, (%r12)
leaq 0x10(%rsp), %r12
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r12, %r8
callq 0x20c0
cmpb $0x2, 0x105bc(%rip)     # 0x135e0
leaq 0xadaa(%rip), %rax      # 0xddd5
leaq 0xb8f0(%rip), %rdx      # 0xe922
cmovaeq %rax, %rdx
leaq 0xad9d(%rip), %rcx      # 0xddda
cmovaeq %rbx, %rcx
movq 0x10938(%rip), %r8      # 0x13980
leaq 0xad8e(%rip), %rsi      # 0xdddd
movq %r14, %rdi
xorl %eax, %eax
callq 0x21a0
movq (%rsp), %rdi
movq %r14, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq 0x10917(%rip), %rcx     # 0x13988
leaq 0xad90(%rip), %rsi      # 0xde08
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x21a0
movq (%rsp), %rdi
movq %r14, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq (%rsp), %rdi
callq 0x2190
xorl %ebx, %ebx
movq %rbx, 0x8(%r12)
movq %rbp, (%r12)
leaq 0x10(%rsp), %r15
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r15, %r8
callq 0x20c0
movq 0x10502(%rip), %rdx     # 0x135c8
leaq 0xad74(%rip), %rsi      # 0xde41
movq %r14, %rdi
xorl %eax, %eax
callq 0x21a0
movq (%rsp), %rdi
movq %r14, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq (%rsp), %rdi
callq 0x2190
movq %rbx, 0x8(%r15)
xorl %ebx, %ebx
movq %rbp, (%r15)
leaq 0x10(%rsp), %r15
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r15, %r8
callq 0x20c0
movq 0x104c2(%rip), %rdx     # 0x135d8
leaq 0xad4e(%rip), %rsi      # 0xde6b
movq %r14, %rdi
xorl %eax, %eax
callq 0x21a0
movq (%rsp), %rdi
movq %r14, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq (%rsp), %rdi
callq 0x2190
movq %rbx, 0x8(%r15)
movq %rbp, (%r15)
movq (%rsp), %rbp
leaq 0x10(%rsp), %r8
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x20c0
movq 0x1081b(%rip), %rdx     # 0x13980
movq 0x107c4(%rip), %rcx     # 0x13930
leaq 0x1033d(%rip), %r14     # 0x134b0
leaq 0xad03(%rip), %rsi      # 0xde7d
movq %r14, %rdi
xorl %eax, %eax
callq 0x21a0
movq %rbp, %rdi
movq %r14, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
leaq 0xad15(%rip), %rsi      # 0xdeb0
movq %rbp, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movzbl 0x10432(%rip), %ebx     # 0x135e1
cmpq $0x2, %rbx
jb 0x3251
movl $0x1, %r12d
leaq 0xace9(%rip), %r14      # 0xdeaf
leaq 0x10763(%rip), %rbp     # 0x13930
movq (%rsp), %r15
cmpq $0x7, %r12
jne 0x31e8
movq (%rsp), %rdi
movq %r14, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq %r15, %rdi
movl $0x20, %esi
callq 0x2160
movq (%rbp,%r12,8), %rsi
movq %r15, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movzbl 0x103d2(%rip), %eax     # 0x135e0
cmpq %rax, %r12
je 0x3249
cmpb $0x3, %al
jb 0x3225
movq (%rsp), %rdi
movl $0x2c, %esi
callq 0x2160
movzbl 0x103b5(%rip), %eax     # 0x135e1
addl $-0x2, %eax
cmpq %rax, %r12
jne 0x3249
movq (%rsp), %rdi
leaq 0xac74(%rip), %rsi      # 0xdeb3
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
incq %r12
cmpq %r12, %rbx
jne 0x31d1
leaq 0xac64(%rip), %rsi      # 0xdebc
movq (%rsp), %rbx
movq %rbx, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq %rbx, %rdi
callq 0x2190
movq (%r13), %rdi
callq 0x2300
xorpd %xmm0, %xmm0
movapd %xmm0, 0x1070a(%rip)    # 0x13990
movapd %xmm0, 0x10712(%rip)    # 0x139a0
movapd %xmm0, 0x1071a(%rip)    # 0x139b0
movapd %xmm0, 0x10722(%rip)    # 0x139c0
movapd %xmm0, 0x1072a(%rip)    # 0x139d0
movzbl 0x10333(%rip), %r13d    # 0x135e1
movabsq $0x3ff0000000000000, %r15 # imm = 0x3FF0000000000000
testq %r13, %r13
je 0x3442
movzbl 0xfef7(%rip), %r12d     # 0x131c0
movzbl 0xfef1(%rip), %eax      # 0x131c1
movq %rax, 0x8(%rsp)
xorl %ebp, %ebp
movabsq $0x4024000000000000, %rbx # imm = 0x4024000000000000
movabsq $0x4059000000000000, %r14 # imm = 0x4059000000000000
movl $0x128, %edi            # imm = 0x128
callq 0x20e0
leaq 0x10694(%rip), %rcx     # 0x13990
movq %rax, (%rcx,%rbp,8)
movabsq $0x3fe8000000000000, %rcx # imm = 0x3FE8000000000000
movq %rcx, 0x8(%rax)
movb $-0x38, 0x18(%rax)
movq %rbx, (%rax)
testq %r12, %r12
je 0x3338
xorl %ecx, %ecx
movq %rbx, 0x20(%rax,%rcx,8)
movq %rbx, 0x40(%rax,%rcx,8)
movw $0x0, 0xd2(%rax,%rcx,2)
incq %rcx
cmpq %rcx, %r12
jne 0x331c
movl $0x64000a, 0xd2(%rax,%r12,2) # imm = 0x64000A
movabsq $0x4056800000000000, %rcx # imm = 0x4056800000000000
movq %rcx, 0x60(%rax)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x68(%rax)
movabsq $0x4070e00000000000, %rcx # imm = 0x4070E00000000000
movq %rcx, 0x78(%rax)
movq $0x0, 0xc6(%rax)
movl $0x0, 0xce(%rax)
xorl %ecx, %ecx
movw $0x0, 0x110(%rax,%rcx,2)
incq %rcx
cmpq $0x6, %rcx
jne 0x3380
movq 0x8(%rsp), %rcx
movw $0xc, 0x110(%rax,%rcx,2)
movl $0xc8000a, 0x112(%rax,%rcx,2) # imm = 0xC8000A
movabsq $0x405e000000000000, %rcx # imm = 0x405E000000000000
movq %rcx, 0xe0(%rax)
movabsq $0x404e000000000000, %rcx # imm = 0x404E000000000000
movq %rcx, 0xe8(%rax)
movupd %xmm0, 0xf0(%rax)
movabsq $0x4072c00000000000, %rcx # imm = 0x4072C00000000000
movq %rcx, 0x100(%rax)
movabsq $0x406e000000000000, %rcx # imm = 0x406E000000000000
movq %rcx, 0x108(%rax)
movl $0x0, 0xc0(%rax)
movb $0x0, 0xc4(%rax)
movq $-0x4, %rcx
movq %r15, 0xa0(%rax,%rcx,8)
movq %r14, 0xc0(%rax,%rcx,8)
incq %rcx
jne 0x3411
movw $0x15e, 0x1a(%rax)      # imm = 0x15E
incq %rbp
cmpq %r13, %rbp
jne 0x32eb
movl $0x5, 0x1059e(%rip)     # 0x139e0
movq 0x10547(%rip), %rax     # 0x13990
movb $-0x6, 0x18(%rax)
movw $0x1c2, 0x1a(%rax)      # imm = 0x1C2
movq %r15, 0x8(%rax)
testq %r13, %r13
je 0x3596
shll $0x3, %r13d
xorl %r12d, %r12d
leaq 0x10182(%rip), %rax     # 0x135f0
movq (%r12,%rax), %rbp
movq %r15, (%rbp)
movq %r15, 0x8(%rbp)
callq 0x22e0
sarl $0x3, %eax
cltq
imulq $-0x49f49f49, %rax, %rcx # imm = 0xB60B60B7
shrq $0x20, %rcx
addl %eax, %ecx
movl %ecx, %edx
shrl $0x1f, %edx
sarl $0x8, %ecx
addl %edx, %ecx
imull $0x168, %ecx, %ecx      # imm = 0x168
subl %ecx, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x10(%rbp)
movsd %xmm0, 0x18(%rbp)
movw $0x0, 0x48(%rbp)
movq %r15, 0x30(%rbp)
movq $0x0, 0x28(%rbp)
callq 0x22e0
sarl $0x3, %eax
cltq
imulq $0x10624dd3, %rax, %rcx # imm = 0x10624DD3
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rcx
sarl $0x5, %ecx
addl %edx, %ecx
imull $0x1f4, %ecx, %ecx      # imm = 0x1F4
movl %eax, %edx
subl %ecx, %edx
movl $0xffffef34, %ebx       # imm = 0xFFFFEF34
subl %edx, %ebx
negl %ecx
leal (%rax,%rcx), %r14d
addl $0x10cc, %r14d          # imm = 0x10CC
callq 0x22e0
sarl $0x3, %eax
cltq
imulq $-0x49f49f49, %rax, %rcx # imm = 0xB60B60B7
shrq $0x20, %rcx
addl %eax, %ecx
movl %ecx, %edx
shrl $0x1f, %edx
sarl $0x8, %ecx
addl %edx, %ecx
imull $0x168, %ecx, %ecx      # imm = 0x168
subl %ecx, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x9ad3(%rip), %xmm0     # 0xd010
divsd 0x9ad3(%rip), %xmm0     # 0xd018
movsd %xmm0, 0x8(%rsp)
cvtsi2sd %r14d, %xmm1
movsd %xmm1, 0x20(%rsp)
callq 0x20f0
mulsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x38(%rbp)
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x2310
mulsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x40(%rbp)
addq $0x8, %r12
cmpq %r12, %r13
jne 0x3467
movq 0x10053(%rip), %rax     # 0x135f0
movq $0x0, 0x30(%rax)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rax)
movabsq $0x4069000000000000, %rcx # imm = 0x4069000000000000
movq %rcx, 0x20(%rax)
movupd %xmm0, 0x38(%rax)
movq (%rsp), %rdi
callq 0x21c0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq