// File: /workspace/github_c_makefile_star2_O2/PARKINHYO[P]BlackjackGame/shm/shm_server.c
// Function: play_game_one
void* play_game_one(void *data)
{
  int gnShmID2;      /* Shared Memory Indicator */
  int gnSemID2;      /* Semapore Indicator */
  int id = (intptr_t)data;
  int shmId = (intptr_t)data + 60100;
  int semId = (intptr_t)data+1 +60100;
  char buffer[BUFFER_SIZE];
  int nwritten;
  int player_sum, dealer_sum;
  int *player_hand_values = players_hand_values[id], *dealer_hand_values = dealers_hand_values[id];
  int *player_hand_suits = players_hand_suits[id], *dealer_hand_suits = dealers_hand_suits[id];
  int i;

  /* Shared Memory */
  key_t keyShm;       /* Shared Memory Key */
  _ST_SHM *shared_data;      /* 공용 메모리 구조체 */

  /* Semapore */
  key_t keySem;       /* Semapore Key */
  union semun sem_union;
  struct sembuf mysem_open  = {0, -1, SEM_UNDO}; // 세마포어 얻기
  struct sembuf mysem_close = {0, 1, SEM_UNDO};  // 세마포어 돌려주기

  /* Shared Memory의 키값을 생성한다. */
  keyShm = (key_t)shmId;
  /* Semapore 키값을 생성한다. */
  keySem = (key_t)semId;
  /* 공유 메모리 세그먼트를 연다 - 필요하면 만든다. */
  if((gnShmID2 = shmget( keyShm, SEGSIZE, IPC_CREAT | IPC_EXCL | 0666 )) == -1)
  {
    printf("Shared memory segment exist - opening as client\n");
    /* 세그먼트가 이미 존재한다면 - try as a client */
    if( (gnShmID2 = shmget( keyShm, SEGSIZE, 0 )) == -1 )
    {
      perror("shmget");
      exit(1);
          }
  }
  else
  {
    printf("Creating new shared memory segment\n");
  }
  /* 현재 프로세스에 공유 메모리 세그먼트를 연결한다. */
  if((shared_data = (_ST_SHM *)shmat(gnShmID2, 0, 0)) == NULL)
  {
    perror("shmat");
    exit(1);
  }
  /* 공유 Semapore 세그먼트를 연다 - 필요하면 만든다. */
  if((gnSemID2 = semget( keySem, 1, IPC_CREAT | IPC_EXCL | 0666 )) == -1)
  {
    printf("Semapore segment exist - opening as client\n");
    /* 세그먼트가 이미 존재한다면 - try as a client */
    if( (gnSemID2 = semget( keySem, 0, 0 )) == -1 )
    {
      perror("semget");
      exit(1);
    }
  }
  else
  {
    printf("Creating new semapore segment\n");
  }

  /* 공유 메모리 초기화 */
  shared_data->check = 0;
  shared_data->check2 = 0;
  shared_data->finalcheck=0;
  /* Semapore 초기화 */
  sem_union.val = 1;
  semctl( gnSemID2, 0, SETVAL, sem_union );

  /*첫 카드 뽑기*/
  nplayers[id] = 0;
	ndealers[id] = 0;
  /*딜러들의 카드덱은 공유 - mutex로 raceCondition 제어*/
  pthread_mutex_lock(&card_mutex);
	{
		for (i = 0; i < 2; ++i)
		{
			player_hand_values[nplayers[id]] = card_values[ncard];
			player_hand_suits[nplayers[id]] = card_suits[ncard];
			++ncard;
			++nplayers[id];
		}

		dealer_hand_values[ndealers[id]] = card_values[ncard];
		dealer_hand_suits[ndealers[id]] = card_suits[ncard];
		++ncard;
		++ndealers[id];
	}
	pthread_mutex_unlock(&card_mutex);

  buffer[0] = value_codes[player_hand_values[0]];
	buffer[1] = suit_codes[player_hand_suits[0]];
	buffer[2] = value_codes[player_hand_values[1]];
	buffer[3] = suit_codes[player_hand_suits[1]];
	buffer[4] = value_codes[dealer_hand_values[0]];
	buffer[5] = suit_codes[dealer_hand_suits[0]];
	buffer[6] = 0;

  /******* 임계영역 *******/
  if( semop(gnSemID2, &mysem_open, 1) == -1 )
	{
		perror("semop");
		exit(1);
	}
  /* shared memory 전송 */
  strncpy(shared_data->data, buffer, BUFFER_SIZE);
	printf("send: first cardset\n");
  shared_data->check = 1;
  semop(gnSemID2, &mysem_close, 1);
  /******* 임계영역 *******/

  while(shared_data->check) {
     sleep(1);
     printf("waiting...\n");
   }
  /* 첫 카드를 주고서*/
  printf("\n");
  printf("Player %d Hand: ", id );
  display_state(player_hand_values, player_hand_suits, nplayers[id]);
  printf("Dealer Hand with player %d: ", id);
  display_state(dealer_hand_values, dealer_hand_suits, ndealers[id]);

  while(TRUE){
    if(!shared_data->check2){
      if( semop(gnSemID2, &mysem_open, 1) == -1 ) // 대기상태
      {
        perror("semop");
        exit(1);
      }
    }
    /* HIT, STAND signal 빋기*/
    if(!shared_data->check2)
    {
      strncpy(buffer, shared_data->data, BUFFER_SIZE);
      shared_data->check2=1;
      printf("I received from player %d: %s\n", id, buffer);
      strncpy(shared_data->data, "\0", BUFFER_SIZE);

      /* HIT 결과 전송 */

      if (strcmp(buffer, HIT) == 0)
      {
        pthread_mutex_lock(&card_mutex);
        {
          player_hand_values[nplayers[id]] = card_values[ncard];
          player_hand_suits[nplayers[id]] = card_suits[ncard];

          buffer[0] = value_codes[player_hand_values[nplayers[id]]];
          buffer[1] = suit_codes[player_hand_suits[nplayers[id]]];
          buffer[2] = 0;

          ++ncard;
          ++nplayers[id];
        }
        pthread_mutex_unlock(&card_mutex);

        strncpy(shared_data->data, buffer, BUFFER_SIZE);
        printf("I send to player %d: %s\n", id, buffer);
        shared_data->check=2;
        buffer[0] = '\0';
        semop(gnSemID2, &mysem_close, 1);

        /* 플레이어 결과가 21이 넘을 경우*/
        if (calc_sum(player_hand_values, nplayers[id]) > 21)
        {
          printf("Player %d busted. Dealer wins.\n", id);
          break;
        }
        /* 플레이어 결과가 21일 경우 이기기 때문에 break */
        else if (calc_sum(player_hand_values, nplayers[id]) == 21)
          break;
      }
      /* 플레이어의 signal이 STAND인 경우 stop*/
      else if (strcmp(buffer, STAND) == 0){
        //shared_data->finalcheck=1;
        shared_data->check=0;
        semop(gnSemID2, &mysem_close, 1);
        break;
      }
    }
  }
  i=0;
  while (calc_sum(dealer_hand_values, ndealers[id]) < 17)
  {
    dealer_hand_values[ndealers[id]] = card_values[ncard];
    dealer_hand_suits[ndealers[id]] = card_suits[ncard];
    buffer[i++] = value_codes[dealer_hand_values[ndealers[id]]];
    buffer[i++] = suit_codes[dealer_hand_suits[ndealers[id]]];
    ++ncard;
    ++ndealers[id];
  }
  buffer[i] = 0;

  printf("\n");
  printf("Player %d Hand: ", id);
  display_state(player_hand_values, player_hand_suits, nplayers[id]);
  printf("Dealer %d Hand: ", id);
  display_state(dealer_hand_values, dealer_hand_suits, ndealers[id]);

  if( semop(gnSemID2, &mysem_open, 1) == -1 )
  {
          perror("semop");
          exit(1);
  }
  strncpy(shared_data->data, buffer, BUFFER_SIZE);
  shared_data->finalcheck=1;
  semop(gnSemID2, &mysem_close, 1);

  player_sum = calc_sum(player_hand_values, nplayers[id]);
  dealer_sum = calc_sum(dealer_hand_values, ndealers[id]);

  if (dealer_sum > 21)
    printf("\nDealer busted! Player %d wins!\n", id);
  else if (player_sum == dealer_sum)
    printf("\nPlayer %d and dealer have the same score. It's a push!\n", id);
  else if (player_sum < dealer_sum)
    printf("\nDealer has a higher score than player %d. Dealer wins!\n", id);
  else
    printf("\nPlayer %d has a higher score. Player wins!\n", id);


    /* 세마포어, shared memory 제거*/
  if(shmdt(shared_data) == -1) {
     perror("shmdt failed");
     exit(1);
  }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, %r12
leal 0xeac4(%rdi), %ebx
movw $0x1000, %ax            # imm = 0x1000
movw %ax, -0x4c(%rbp)
movl $0xffff0000, -0x50(%rbp) # imm = 0xFFFF0000
movw %ax, -0x44(%rbp)
movl $0x10000, -0x48(%rbp)   # imm = 0x10000
pushq $0x2c
popq %rsi
movl %ebx, %edi
movl $0x7b6, %edx            # imm = 0x7B6
callq 0x1160
cmpl $-0x1, %eax
je 0x1818
movl %eax, %r14d
leaq 0xa72(%rip), %rdi       # 0x2283
callq 0x1080
jmp 0x183c
leaq 0xa87(%rip), %rdi       # 0x22a6
callq 0x1080
pushq $0x2c
popq %rsi
movl %ebx, %edi
xorl %edx, %edx
callq 0x1160
movl %eax, %r14d
cmpl $-0x1, %eax
je 0x1f4f
movl %r14d, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1150
testq %rax, %rax
je 0x1f3d
movq %rax, %r14
leal 0xeac5(%r12), %ebx
pushq $0x1
popq %rsi
movl %ebx, %edi
movl $0x7b6, %edx            # imm = 0x7B6
callq 0x1030
cmpl $-0x1, %eax
je 0x1884
movl %eax, %r15d
leaq 0xa5c(%rip), %rdi       # 0x22d6
callq 0x1080
movl %r15d, %edi
jmp 0x18a6
leaq 0xa69(%rip), %rdi       # 0x22f4
callq 0x1080
movl %ebx, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1030
movl %eax, %edi
cmpl $-0x1, %eax
je 0x1f58
movq %r12, -0x38(%rbp)
movslq %r12d, %rax
movq %rax, -0x40(%rbp)
imulq $0x50, %rax, %r13
leaq 0x2aa4(%rip), %r15      # 0x4360
leaq (%r15,%r13), %rax
movq %rax, -0x60(%rbp)
leaq 0x2bd5(%rip), %rax      # 0x44a0
addq %r13, %rax
movq %rax, -0xa0(%rbp)
leaq 0x2d04(%rip), %r12      # 0x45e0
leaq (%r12,%r13), %rax
movq %rax, -0x58(%rbp)
leaq 0x2e35(%rip), %rax      # 0x4720
andq $0x0, (%r14)
addq %r13, %rax
movq %rax, -0x88(%rbp)
andl $0x0, 0x8(%r14)
xorl %ebx, %ebx
pushq $0x10
popq %rdx
pushq $0x1
popq %rcx
movl %edi, -0x2c(%rbp)
xorl %esi, %esi
xorl %eax, %eax
callq 0x1140
leaq 0x2f47(%rip), %rax      # 0x4860
movq -0x40(%rbp), %rcx
andl $0x0, (%rax,%rcx,4)
leaq 0x2f48(%rip), %rax      # 0x4870
andl $0x0, (%rax,%rcx,4)
leaq 0x2f4d(%rip), %rdi      # 0x4880
callq 0x11c0
movslq 0x2a11(%rip), %rax      # 0x4350
leaq 0x2f1a(%rip), %rcx      # 0x4860
movq -0x40(%rbp), %rdx
movslq (%rcx,%rdx,4), %rdi
movl %edi, %edx
movq %rax, %rcx
shlq $0x20, %rcx
movq %rax, %rsi
shlq $0x2, %rsi
movq %r13, -0x98(%rbp)
leaq (,%rdi,4), %rdi
addq %r13, %rdi
movabsq $0x100000000, %r8       # imm = 0x100000000
cmpl $0x2, %ebx
je 0x19ad
leaq (%rsi,%rbx,4), %r9
leaq 0x2826(%rip), %r10      # 0x41b0
movl (%r10,%r9), %r10d
leaq (%rdi,%rbx,4), %r11
movl %r10d, (%r15,%r11)
leaq 0x28e3(%rip), %r10      # 0x4280
movl (%r10,%r9), %r9d
movl %r9d, (%r12,%r11)
addq %r8, %rcx
incq %rbx
jmp 0x197a
addl %ebx, %edx
movq -0x40(%rbp), %r12
leaq 0x2ea6(%rip), %rsi      # 0x4860
movl %edx, (%rsi,%r12,4)
sarq $0x1e, %rcx
leaq 0x27e7(%rip), %rdx      # 0x41b0
movl (%rcx,%rdx), %edx
leaq 0x2e9d(%rip), %rdi      # 0x4870
movslq (%rdi,%r12,4), %rsi
movq -0xa0(%rbp), %r13
movl %edx, (%r13,%rsi,4)
leaq 0x2896(%rip), %rdx      # 0x4280
movl (%rcx,%rdx), %ecx
movq -0x88(%rbp), %r15
movl %ecx, (%r15,%rsi,4)
leal 0x1(%rax,%rbx), %eax
movl %eax, 0x294e(%rip)      # 0x4350
leal 0x1(%rsi), %eax
movl %eax, (%rdi,%r12,4)
leaq 0x2e70(%rip), %rdi      # 0x4880
callq 0x10f0
movq -0x60(%rbp), %rcx
movslq (%rcx), %rax
leaq 0x91f(%rip), %rsi       # 0x2342
movb (%rax,%rsi), %al
movb %al, -0x80(%rbp)
movq -0x58(%rbp), %rdx
movslq (%rdx), %rax
leaq 0x907(%rip), %rdi       # 0x233e
movb (%rax,%rdi), %al
movb %al, -0x7f(%rbp)
movslq 0x4(%rcx), %rax
movb (%rax,%rsi), %al
movb %al, -0x7e(%rbp)
movslq 0x4(%rdx), %rax
movb (%rax,%rdi), %al
movb %al, -0x7d(%rbp)
movslq (%r13), %rax
movb (%rax,%rsi), %al
movb %al, -0x7c(%rbp)
movslq (%r15), %rax
movb (%rax,%rdi), %al
movb %al, -0x7b(%rbp)
movb $0x0, -0x7a(%rbp)
leaq -0x50(%rbp), %rsi
pushq $0x1
popq %rdx
movl -0x2c(%rbp), %ebx
movl %ebx, %edi
callq 0x1170
cmpl $-0x1, %eax
je 0x1f29
movq %r14, %rdi
addq $0xc, %rdi
leaq -0x80(%rbp), %rsi
pushq $0x20
popq %rdx
movq %rdi, -0x90(%rbp)
callq 0x1050
leaq 0x87c(%rip), %rdi       # 0x231f
callq 0x1080
movl $0x1, (%r14)
leaq -0x48(%rbp), %rsi
pushq $0x1
popq %rdx
movl %ebx, %edi
callq 0x1170
pushq $0x1
popq %rbx
leaq 0x86c(%rip), %r15       # 0x2333
cmpl $0x0, (%r14)
je 0x1ade
movl %ebx, %edi
callq 0x11b0
movq %r15, %rdi
callq 0x1080
jmp 0x1ac7
pushq $0xa
popq %rdi
callq 0x1040
leaq 0x5a9(%rip), %rdi       # 0x2096
movq -0x38(%rbp), %r15
movl %r15d, %esi
xorl %eax, %eax
callq 0x10a0
leaq 0x2d5e(%rip), %rax      # 0x4860
movl (%rax,%r12,4), %edx
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x139c
leaq 0x58d(%rip), %rdi       # 0x20a7
movl %r15d, %esi
xorl %eax, %eax
callq 0x10a0
leaq 0x2d45(%rip), %rbx      # 0x4870
movl (%rbx,%r12,4), %edx
movq %r15, %r12
movq %r13, %rdi
movq -0x88(%rbp), %rsi
callq 0x139c
leaq -0x50(%rbp), %r13
movq -0x90(%rbp), %r15
movq %r14, -0xa8(%rbp)
cmpl $0x0, 0x4(%r14)
jne 0x1b53
movl -0x2c(%rbp), %edi
movq %r13, %rsi
pushq $0x1
popq %rdx
callq 0x1170
cmpl $-0x1, %eax
je 0x1f29
cmpl $0x0, 0x4(%r14)
jne 0x1b53
leaq -0x80(%rbp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
pushq $0x20
popq %rdx
callq 0x1050
movl $0x1, 0x4(%r14)
leaq 0x52b(%rip), %rdi       # 0x20c4
movl %r12d, %esi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x10a0
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
movups %xmm0, 0x10(%r15)
cmpl $0x544948, -0x80(%rbp)  # imm = 0x544948
jne 0x1cbb
leaq 0x2cba(%rip), %r14      # 0x4880
movq %r14, %rdi
callq 0x11c0
movslq 0x277b(%rip), %rax      # 0x4350
leaq 0x25d4(%rip), %rcx      # 0x41b0
movslq (%rcx,%rax,4), %rcx
movq -0x40(%rbp), %r13
leaq 0x2c75(%rip), %r12      # 0x4860
movslq (%r12,%r13,4), %rdx
movq %r12, %r8
movq -0x60(%rbp), %r12
movl %ecx, (%r12,%rdx,4)
leaq 0x267f(%rip), %rsi      # 0x4280
movslq (%rsi,%rax,4), %rsi
movq -0x58(%rbp), %rdi
movl %esi, (%rdi,%rdx,4)
leaq 0x72f(%rip), %rdi       # 0x2342
movb (%rcx,%rdi), %cl
movb %cl, -0x80(%rbp)
leaq 0x71e(%rip), %rcx       # 0x233e
movb (%rsi,%rcx), %cl
movb %cl, -0x7f(%rbp)
xorl %ecx, %ecx
movb %cl, -0x7e(%rbp)
incl %eax
movl %eax, 0x271d(%rip)      # 0x4350
leal 0x1(%rdx), %eax
movl %eax, (%r8,%r13,4)
movq %r14, %rdi
callq 0x10f0
movq %r15, %rdi
movq %rbx, %rsi
pushq $0x20
popq %rdx
callq 0x1050
leaq 0x48c(%rip), %rdi       # 0x20e3
movq -0x38(%rbp), %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x10a0
movq -0xa8(%rbp), %rax
movq %rax, %r14
movl $0x2, (%rax)
xorl %eax, %eax
movb %al, -0x80(%rbp)
movl -0x2c(%rbp), %edi
leaq -0x48(%rbp), %rsi
pushq $0x1
popq %rdx
callq 0x1170
leaq 0x2bd0(%rip), %rax      # 0x4860
movl (%rax,%r13,4), %esi
movq %r12, %rdi
callq 0x1351
cmpl $0x16, %eax
jge 0x1cea
cmpl $0x15, %eax
movq -0x38(%rbp), %r12
movq -0x90(%rbp), %r15
leaq -0x50(%rbp), %r13
jne 0x1b53
jmp 0x1cff
movq %rbx, %rdi
leaq 0x457(%rip), %rsi       # 0x211c
pushq $0x6
popq %rdx
callq 0x1100
testl %eax, %eax
jne 0x1b53
andl $0x0, (%r14)
leaq -0x48(%rbp), %rsi
pushq $0x1
popq %rdx
movl -0x2c(%rbp), %edi
callq 0x1170
jmp 0x1cff
leaq 0x40b(%rip), %rdi       # 0x20fc
movq -0x38(%rbp), %r12
movl %r12d, %esi
xorl %eax, %eax
callq 0x10a0
movq -0x40(%rbp), %rax
leaq 0x2b66(%rip), %rcx      # 0x4870
movl (%rcx,%rax,4), %eax
movslq 0x263c(%rip), %rbx      # 0x4350
movq %rax, -0xb8(%rbp)
movslq %eax, %rcx
movq -0x98(%rbp), %rax
movq %rcx, -0xb0(%rbp)
leaq (%rax,%rcx,4), %rax
movq %rax, -0x98(%rbp)
leal 0x1(%rbx), %r13d
shlq $0x2, %rbx
xorl %r12d, %r12d
xorl %r15d, %r15d
movq -0xb8(%rbp), %rax
leal (%rax,%r12), %esi
movq -0xa0(%rbp), %rdi
callq 0x1351
cmpl $0x10, %eax
jg 0x1ded
leaq (%rbx,%r12,4), %rax
leaq 0x2440(%rip), %rcx      # 0x41b0
movslq (%rcx,%rax), %rcx
movq -0x98(%rbp), %rdx
leaq (%rdx,%r12,4), %rdx
leaq 0x271a(%rip), %rsi      # 0x44a0
movl %ecx, (%rsi,%rdx)
leaq 0x24f0(%rip), %rsi      # 0x4280
movslq (%rsi,%rax), %rax
leaq 0x2985(%rip), %rsi      # 0x4720
movl %eax, (%rsi,%rdx)
leal (%r13,%r12), %edx
movl %edx, 0x25a7(%rip)      # 0x4350
movq -0xb0(%rbp), %rdx
leal 0x1(%rdx,%r12), %edx
movq -0x40(%rbp), %rsi
leaq 0x2ab0(%rip), %rdi      # 0x4870
movl %edx, (%rdi,%rsi,4)
leaq 0x578(%rip), %rdx       # 0x2342
movb (%rcx,%rdx), %cl
movb %cl, -0x80(%rbp,%r12,2)
leaq 0x565(%rip), %rcx       # 0x233e
movb (%rax,%rcx), %al
movb %al, -0x7f(%rbp,%r12,2)
addq $0x2, %r15
incq %r12
jmp 0x1d45
andl $-0x2, %r15d
movb $0x0, -0x80(%rbp,%r15)
pushq $0xa
popq %rdi
callq 0x1040
leaq 0x290(%rip), %rdi       # 0x2096
movq -0x38(%rbp), %rbx
movl %ebx, %esi
xorl %eax, %eax
callq 0x10a0
movq -0x40(%rbp), %r12
leaq 0x2a42(%rip), %rax      # 0x4860
movl (%rax,%r12,4), %edx
movq -0x60(%rbp), %r15
movq %r15, %rdi
movq -0x58(%rbp), %rsi
callq 0x139c
leaq 0x2e9(%rip), %rdi       # 0x2122
movl %ebx, %esi
xorl %eax, %eax
callq 0x10a0
leaq 0x2a27(%rip), %rax      # 0x4870
movl (%rax,%r12,4), %edx
movq -0xa0(%rbp), %r13
movq %r13, %rdi
movq -0x88(%rbp), %rsi
callq 0x139c
leaq -0x50(%rbp), %rsi
pushq $0x1
popq %rdx
movl -0x2c(%rbp), %ebx
movl %ebx, %edi
callq 0x1170
cmpl $-0x1, %eax
je 0x1f29
leaq -0x80(%rbp), %rsi
pushq $0x20
popq %rdx
movq -0x90(%rbp), %rdi
callq 0x1050
movl $0x1, 0x8(%r14)
leaq -0x48(%rbp), %rsi
pushq $0x1
popq %rdx
movl %ebx, %edi
callq 0x1170
leaq 0x29b3(%rip), %rax      # 0x4860
movl (%rax,%r12,4), %esi
movq %r15, %rdi
callq 0x1351
movl %eax, %ebx
leaq 0x29ae(%rip), %rax      # 0x4870
movl (%rax,%r12,4), %esi
movq %r13, %rdi
callq 0x1351
cmpl $0x15, %eax
jle 0x1ee0
leaq 0x259(%rip), %rdi       # 0x2133
movq -0x38(%rbp), %rsi
jmp 0x1f03
cmpl %eax, %ebx
movq -0x38(%rbp), %rsi
jne 0x1ef1
leaq 0x265(%rip), %rdi       # 0x2154
jmp 0x1f03
leaq 0x295(%rip), %rax       # 0x218d
leaq 0x2c7(%rip), %rdi       # 0x21c6
cmovlq %rax, %rdi
xorl %eax, %eax
callq 0x10a0
movq %r14, %rdi
callq 0x1090
cmpl $-0x1, %eax
je 0x1f46
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x153(%rip), %rdi       # 0x2083
callq 0x1130
pushq $0x1
popq %rdi
callq 0x1190
leaq 0x12c(%rip), %rdi       # 0x2070
jmp 0x1f30
leaq 0x2a6(%rip), %rdi       # 0x21f3
jmp 0x1f30
leaq 0x113(%rip), %rdi       # 0x2069
jmp 0x1f30
leaq 0x117(%rip), %rdi       # 0x2076
jmp 0x1f30