// File: /workspace/github_c_makefile_star2_O0/califlower[P]Multithreaded_Bank/server2.c
// Function: clientThread
void * clientThread(void * ptr)
{
	char * accountName=NULL;
	int accountId;
	
	char buffer[strSize];
	int len=strSize;
	
	connection_t * conn = (connection_t *) ptr;

	while (1)
	{
		
		read(conn->sock, &len, sizeof(int));
		buffer[len] = 0;
		read(conn->sock, buffer, len);
		
/**************************************************************
 * If client wants to exit account and close terminal
 * Set inUse to 0
 * Loop is broken
 * Client exits
*******************************************************************/
		if (strcasecmp(buffer,"exit")==0)
		{
			if (accountName)
				accountList[accountId].inUse=0;
			break;
		}
		
/**************************************************************
 * Creates a new user account
 * Handles the different return conditions
***************************************************************/
		
		else if (strcasecmp(buffer,"open")==0)
		{
			read(conn->sock, &len, sizeof(int));
			buffer[len] = 0;
			read(conn->sock, buffer, len);

			if (strcasecmp(buffer,"exit")==0)
			{
				if (accountName)
					accountList[accountId].inUse=0;
				break;
			}
			
			int x=addAccount(buffer);
			
			if (x==0)
			{
				char str[strSize]= "Account Added";
				len=strlen(str);
				write(conn->sock, &len, sizeof(int));
				write(conn->sock, str, strlen(str));
				continue;

			}
			else if (x==1)
			{
				char str[strSize]= "Too many accounts";
				len=strlen(str);
				write(conn->sock, &len, sizeof(int));
				write(conn->sock, str, len);
				continue;
			}
			else if (x==2)
			{
				char str[strSize]= "Account name too large";
				len=strlen(str);
				write(conn->sock, &len, sizeof(int));
				write(conn->sock, str, len);
				continue;

			}
			else if (x==3)
			{
				char str[strSize]= "Account already exists";
				len=strlen(str);
				write(conn->sock, &len, sizeof(int));
				write(conn->sock, str, len);
				continue;
			}
			
		}
		
/*******************************************************************
 * Starts account session
 * Deals with error conditions
 * Sets account id and name
********************************************************************/
		else if (strcasecmp(buffer,"start")==0)
		{
			read(conn->sock, &len, sizeof(int));
			buffer[len] = 0;
			read(conn->sock, buffer, len);

			if (strcasecmp(buffer,"exit")==0)
			{
				if (accountName)
					accountList[accountId].inUse=0;
				break;
			}
			
			int x=startAccount(buffer);
			
			if (x==-1)
			{
				char str[strSize]= "Account does not exist";
				len=strlen(str);
				write(conn->sock, &len, sizeof(int));
				write(conn->sock, str, strlen(str));
				continue;

			}
			else if (x==-2)
			{
				char str[strSize]= "Account in use";
				len=strlen(str);
				write(conn->sock, &len, sizeof(int));
				write(conn->sock, str, strlen(str));
				continue;

			}
			else
			{
				char str[strSize]= "Started session with account name : ";
				strcat(str, accountList[x].accountName);
				accountId=x;
				accountName=accountList[x].accountName;
				len=strlen(str);
				write(conn->sock, &len, sizeof(int));
				write(conn->sock, str, strlen(str));
				continue;
			}
		}
		
/*********************************************************************************
 * Debits the account money
 * handles error conditions from debit
 * Uses snprintf to combine strings and ints
*********************************************************************************/
		else if (strcasecmp(buffer,"debit")==0)
		{
			if (!accountName)
			{
				char str[strSize]= "No account session started";
				len=strlen(str);
				write(conn->sock, &len, sizeof(int));
				write(conn->sock, str, strlen(str));
				continue;

			}

			read(conn->sock, &len, sizeof(int));
			buffer[len] = 0;
			read(conn->sock, buffer, len);

			if (strcasecmp(buffer,"exit")==0)
			{
				if (accountName)
					accountList[accountId].inUse=0;
				break;
			}
			
			int x=debitAccount(accountId,atof(buffer));
			
			if (x==0)
			{
				char str[strSize];
				
				snprintf(str, sizeof(str), "Account debited -%f", atof(buffer));
				len=strlen(str);
				write(conn->sock, &len, sizeof(int));
				write(conn->sock, str, strlen(str));
				continue;

			}
			else if (x==1)
			{
				char str[strSize]= "Cannot debit. Not enough money in account";
				len=strlen(str);
				write(conn->sock, &len, sizeof(int));
				write(conn->sock, str, strlen(str));
				continue;

			}
			
		}
		
/****************************************************************
 * Credits the account
 * Operates the same as debit
****************************************************************/
		else if (strcasecmp(buffer,"credit")==0)
		{

			if (!accountName)
			{
				char str[strSize]= "No account session started";
				len=strlen(str);
				write(conn->sock, &len, sizeof(int));
				write(conn->sock, str, strlen(str));
				continue;

			}

			read(conn->sock, &len, sizeof(int));
			buffer[len] = 0;
			read(conn->sock, buffer, len);

			if (strcasecmp(buffer,"exit")==0)
			{
				if (accountName)
					accountList[accountId].inUse=0;
				break;
			}
			
			creditAccount(accountId,atof(buffer));
			char str[strSize];	
			snprintf(str, sizeof(str), "Account credited +%f", atof(buffer));
			len=strlen(str);
			write(conn->sock, &len, sizeof(int));
			write(conn->sock, str, strlen(str));
			continue;

			
			
		}
		
/*********************************************************************
* Gets the account balance and sends it to the client
***********************************************************************/
		else if (strcasecmp(buffer, "balance")==0)
		{
			if (!accountName)
			{
				char str[strSize]= "No account session started";
				len=strlen(str);
				write(conn->sock, &len, sizeof(int));
				write(conn->sock, str, strlen(str));
				continue;
			}
			char str[strSize];
			snprintf(str, sizeof(str), "Total Balance of Account: %f", accountList[accountId].balance);
			len=strlen(str);
			write(conn->sock, &len, sizeof(int));
			write(conn->sock, str, strlen(str));
			continue;
			
		}
		
/**********************************************************************
* Sets account and account id to -1 (honestly I hope that works)
* Sets account name to null so that a new account can be used
* Sets inuse to 0 so account can be used by someone else
* Doesnt exit thread, client still not exited either
************************************************************************/
		else if (strcasecmp(buffer, "finish")==0)
		{
			if (!accountName)
			{
				char str[strSize]= "No account session started";
				len=strlen(str);
				write(conn->sock, &len, sizeof(int));
				write(conn->sock, str, strlen(str));
				continue;
			}
			accountList[accountId].inUse=0;
			accountName=NULL;
			accountId=0;	
	
			char str[strSize]="Account released";
			len=strlen(str);
			write(conn->sock, &len, sizeof(int));
			write(conn->sock, str, strlen(str));
			
			continue;
			
		}
		
	}

	printf("Client Exiting\n");
	close(conn->sock);
	free(conn);
	pthread_exit(0);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4400, %rsp           # imm = 0x4400
movq %rdi, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
movl $0x3e8, -0x404(%rbp)    # imm = 0x3E8
movq -0x8(%rbp), %rax
movq %rax, -0x410(%rbp)
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x404(%rbp), %rsi
movl $0x4, %edx
callq 0x1140
movslq -0x404(%rbp), %rax
movb $0x0, -0x400(%rbp,%rax)
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x400(%rbp), %rsi
movslq -0x404(%rbp), %rdx
callq 0x1140
leaq -0x400(%rbp), %rdi
leaq 0x1729(%rip), %rsi      # 0x3078
callq 0x1040
cmpl $0x0, %eax
jne 0x197e
cmpq $0x0, -0x10(%rbp)
je 0x1979
movq 0x6839(%rip), %rax      # 0x81a0
movslq -0x14(%rbp), %rcx
imulq $0x6c, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x68(%rax)
jmp 0x2615
leaq -0x400(%rbp), %rdi
leaq 0x16f1(%rip), %rsi      # 0x307d
callq 0x1040
cmpl $0x0, %eax
jne 0x1c17
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x404(%rbp), %rsi
movl $0x4, %edx
callq 0x1140
movslq -0x404(%rbp), %rax
movb $0x0, -0x400(%rbp,%rax)
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x400(%rbp), %rsi
movslq -0x404(%rbp), %rdx
callq 0x1140
leaq -0x400(%rbp), %rdi
leaq 0x168b(%rip), %rsi      # 0x3078
callq 0x1040
cmpl $0x0, %eax
jne 0x1a1c
cmpq $0x0, -0x10(%rbp)
je 0x1a17
movq 0x679b(%rip), %rax      # 0x81a0
movslq -0x14(%rbp), %rcx
imulq $0x6c, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x68(%rax)
jmp 0x2615
leaq -0x400(%rbp), %rdi
callq 0x15d0
movl %eax, -0x414(%rbp)
cmpl $0x0, -0x414(%rbp)
jne 0x1ac2
leaq -0x800(%rbp), %rdi
leaq 0x1727(%rip), %rsi      # 0x3170
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x1190
leaq -0x800(%rbp), %rdi
callq 0x10b0
movl %eax, -0x404(%rbp)
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x404(%rbp), %rsi
movl $0x4, %edx
callq 0x1090
movq -0x410(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x431c(%rbp)
leaq -0x800(%rbp), %rax
movq %rax, -0x4318(%rbp)
leaq -0x800(%rbp), %rdi
callq 0x10b0
movl -0x431c(%rbp), %edi
movq -0x4318(%rbp), %rsi
movq %rax, %rdx
callq 0x1090
jmp 0x18fc
cmpl $0x1, -0x414(%rbp)
jne 0x1b30
leaq -0xbf0(%rbp), %rdi
leaq 0x1a87(%rip), %rsi      # 0x3560
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x1190
leaq -0xbf0(%rbp), %rdi
callq 0x10b0
movl %eax, -0x404(%rbp)
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x404(%rbp), %rsi
movl $0x4, %edx
callq 0x1090
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0xbf0(%rbp), %rsi
movslq -0x404(%rbp), %rdx
callq 0x1090
jmp 0x18fc
cmpl $0x2, -0x414(%rbp)
jne 0x1b9e
leaq -0xfe0(%rbp), %rdi
leaq 0x1e09(%rip), %rsi      # 0x3950
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x1190
leaq -0xfe0(%rbp), %rdi
callq 0x10b0
movl %eax, -0x404(%rbp)
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x404(%rbp), %rsi
movl $0x4, %edx
callq 0x1090
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0xfe0(%rbp), %rsi
movslq -0x404(%rbp), %rdx
callq 0x1090
jmp 0x18fc
cmpl $0x3, -0x414(%rbp)
jne 0x1c0c
leaq -0x13d0(%rbp), %rdi
leaq 0x218b(%rip), %rsi      # 0x3d40
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x1190
leaq -0x13d0(%rbp), %rdi
callq 0x10b0
movl %eax, -0x404(%rbp)
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x404(%rbp), %rsi
movl $0x4, %edx
callq 0x1090
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x13d0(%rbp), %rsi
movslq -0x404(%rbp), %rdx
callq 0x1090
jmp 0x18fc
jmp 0x1c0e
jmp 0x1c10
jmp 0x1c12
jmp 0x260e
leaq -0x400(%rbp), %rdi
leaq 0x145d(%rip), %rsi      # 0x3082
callq 0x1040
cmpl $0x0, %eax
jne 0x1eb9
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x404(%rbp), %rsi
movl $0x4, %edx
callq 0x1140
movslq -0x404(%rbp), %rax
movb $0x0, -0x400(%rbp,%rax)
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x400(%rbp), %rsi
movslq -0x404(%rbp), %rdx
callq 0x1140
leaq -0x400(%rbp), %rdi
leaq 0x13f2(%rip), %rsi      # 0x3078
callq 0x1040
cmpl $0x0, %eax
jne 0x1cb5
cmpq $0x0, -0x10(%rbp)
je 0x1cb0
movq 0x6502(%rip), %rax      # 0x81a0
movslq -0x14(%rbp), %rcx
imulq $0x6c, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x68(%rax)
jmp 0x2615
leaq -0x400(%rbp), %rdi
callq 0x1760
movl %eax, -0x13d4(%rbp)
cmpl $-0x1, -0x13d4(%rbp)
jne 0x1d5b
leaq -0x17c0(%rbp), %rdi
leaq 0x244e(%rip), %rsi      # 0x4130
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x1190
leaq -0x17c0(%rbp), %rdi
callq 0x10b0
movl %eax, -0x404(%rbp)
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x404(%rbp), %rsi
movl $0x4, %edx
callq 0x1090
movq -0x410(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x432c(%rbp)
leaq -0x17c0(%rbp), %rax
movq %rax, -0x4328(%rbp)
leaq -0x17c0(%rbp), %rdi
callq 0x10b0
movl -0x432c(%rbp), %edi
movq -0x4328(%rbp), %rsi
movq %rax, %rdx
callq 0x1090
jmp 0x18fc
cmpl $-0x2, -0x13d4(%rbp)
jne 0x1def
leaq -0x1bb0(%rbp), %rdi
leaq 0x27aa(%rip), %rsi      # 0x4520
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x1190
leaq -0x1bb0(%rbp), %rdi
callq 0x10b0
movl %eax, -0x404(%rbp)
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x404(%rbp), %rsi
movl $0x4, %edx
callq 0x1090
movq -0x410(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x433c(%rbp)
leaq -0x1bb0(%rbp), %rax
movq %rax, -0x4338(%rbp)
leaq -0x1bb0(%rbp), %rdi
callq 0x10b0
movl -0x433c(%rbp), %edi
movq -0x4338(%rbp), %rsi
movq %rax, %rdx
callq 0x1090
jmp 0x18fc
leaq -0x1fa0(%rbp), %rdi
leaq 0x2b13(%rip), %rsi      # 0x4910
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x1190
leaq -0x1fa0(%rbp), %rdi
movq 0x638b(%rip), %rsi      # 0x81a0
movslq -0x13d4(%rbp), %rax
imulq $0x6c, %rax, %rax
addq %rax, %rsi
callq 0x1240
movl -0x13d4(%rbp), %eax
movl %eax, -0x14(%rbp)
movq 0x6368(%rip), %rax      # 0x81a0
movslq -0x13d4(%rbp), %rcx
imulq $0x6c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
leaq -0x1fa0(%rbp), %rdi
callq 0x10b0
movl %eax, -0x404(%rbp)
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x404(%rbp), %rsi
movl $0x4, %edx
callq 0x1090
movq -0x410(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x434c(%rbp)
leaq -0x1fa0(%rbp), %rax
movq %rax, -0x4348(%rbp)
leaq -0x1fa0(%rbp), %rdi
callq 0x10b0
movl -0x434c(%rbp), %edi
movq -0x4348(%rbp), %rsi
movq %rax, %rdx
callq 0x1090
jmp 0x18fc
leaq -0x400(%rbp), %rdi
leaq 0x11c1(%rip), %rsi      # 0x3088
callq 0x1040
cmpl $0x0, %eax
jne 0x215e
cmpq $0x0, -0x10(%rbp)
jne 0x1f67
leaq -0x2390(%rbp), %rdi
leaq 0x2e12(%rip), %rsi      # 0x4d00
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x1190
leaq -0x2390(%rbp), %rdi
callq 0x10b0
movl %eax, -0x404(%rbp)
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x404(%rbp), %rsi
movl $0x4, %edx
callq 0x1090
movq -0x410(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x435c(%rbp)
leaq -0x2390(%rbp), %rax
movq %rax, -0x4358(%rbp)
leaq -0x2390(%rbp), %rdi
callq 0x10b0
movl -0x435c(%rbp), %edi
movq -0x4358(%rbp), %rsi
movq %rax, %rdx
callq 0x1090
jmp 0x18fc
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x404(%rbp), %rsi
movl $0x4, %edx
callq 0x1140
movslq -0x404(%rbp), %rax
movb $0x0, -0x400(%rbp,%rax)
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x400(%rbp), %rsi
movslq -0x404(%rbp), %rdx
callq 0x1140
leaq -0x400(%rbp), %rdi
leaq 0x10be(%rip), %rsi      # 0x3078
callq 0x1040
cmpl $0x0, %eax
jne 0x1fe9
cmpq $0x0, -0x10(%rbp)
je 0x1fe4
movq 0x61ce(%rip), %rax      # 0x81a0
movslq -0x14(%rbp), %rcx
imulq $0x6c, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x68(%rax)
jmp 0x2615
movl -0x14(%rbp), %eax
movl %eax, -0x4360(%rbp)
leaq -0x400(%rbp), %rdi
callq 0x1080
movl -0x4360(%rbp), %edi
cvtsd2ss %xmm0, %xmm0
callq 0x1830
movl %eax, -0x2394(%rbp)
cmpl $0x0, -0x2394(%rbp)
jne 0x20c3
leaq -0x2780(%rbp), %rax
movq %rax, -0x4378(%rbp)
leaq -0x400(%rbp), %rdi
callq 0x1080
movq -0x4378(%rbp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
leaq 0x1041(%rip), %rdx      # 0x308e
movb $0x1, %al
callq 0x10f0
leaq -0x2780(%rbp), %rdi
callq 0x10b0
movl %eax, -0x404(%rbp)
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x404(%rbp), %rsi
movl $0x4, %edx
callq 0x1090
movq -0x410(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x436c(%rbp)
leaq -0x2780(%rbp), %rax
movq %rax, -0x4368(%rbp)
leaq -0x2780(%rbp), %rdi
callq 0x10b0
movl -0x436c(%rbp), %edi
movq -0x4368(%rbp), %rsi
movq %rax, %rdx
callq 0x1090
jmp 0x18fc
cmpl $0x1, -0x2394(%rbp)
jne 0x2157
leaq -0x2b70(%rbp), %rdi
leaq 0x3012(%rip), %rsi      # 0x50f0
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x1190
leaq -0x2b70(%rbp), %rdi
callq 0x10b0
movl %eax, -0x404(%rbp)
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x404(%rbp), %rsi
movl $0x4, %edx
callq 0x1090
movq -0x410(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4384(%rbp)
leaq -0x2b70(%rbp), %rax
movq %rax, -0x4380(%rbp)
leaq -0x2b70(%rbp), %rdi
callq 0x10b0
movl -0x4384(%rbp), %edi
movq -0x4380(%rbp), %rsi
movq %rax, %rdx
callq 0x1090
jmp 0x18fc
jmp 0x2159
jmp 0x260a
leaq -0x400(%rbp), %rdi
leaq 0xf36(%rip), %rsi       # 0x30a2
callq 0x1040
cmpl $0x0, %eax
jne 0x2355
cmpq $0x0, -0x10(%rbp)
jne 0x220c
leaq -0x2f60(%rbp), %rdi
leaq 0x334d(%rip), %rsi      # 0x54e0
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x1190
leaq -0x2f60(%rbp), %rdi
callq 0x10b0
movl %eax, -0x404(%rbp)
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x404(%rbp), %rsi
movl $0x4, %edx
callq 0x1090
movq -0x410(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4394(%rbp)
leaq -0x2f60(%rbp), %rax
movq %rax, -0x4390(%rbp)
leaq -0x2f60(%rbp), %rdi
callq 0x10b0
movl -0x4394(%rbp), %edi
movq -0x4390(%rbp), %rsi
movq %rax, %rdx
callq 0x1090
jmp 0x18fc
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x404(%rbp), %rsi
movl $0x4, %edx
callq 0x1140
movslq -0x404(%rbp), %rax
movb $0x0, -0x400(%rbp,%rax)
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x400(%rbp), %rsi
movslq -0x404(%rbp), %rdx
callq 0x1140
leaq -0x400(%rbp), %rdi
leaq 0xe19(%rip), %rsi       # 0x3078
callq 0x1040
cmpl $0x0, %eax
jne 0x228e
cmpq $0x0, -0x10(%rbp)
je 0x2289
movq 0x5f29(%rip), %rax      # 0x81a0
movslq -0x14(%rbp), %rcx
imulq $0x6c, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x68(%rax)
jmp 0x2615
movl -0x14(%rbp), %eax
movl %eax, -0x43b4(%rbp)
leaq -0x400(%rbp), %rdi
callq 0x1080
movl -0x43b4(%rbp), %edi
cvtsd2ss %xmm0, %xmm0
callq 0x18a0
leaq -0x3350(%rbp), %rax
movq %rax, -0x43b0(%rbp)
leaq -0x400(%rbp), %rdi
callq 0x1080
movq -0x43b0(%rbp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
leaq 0xdca(%rip), %rdx       # 0x30a9
movb $0x1, %al
callq 0x10f0
leaq -0x3350(%rbp), %rdi
callq 0x10b0
movl %eax, -0x404(%rbp)
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x404(%rbp), %rsi
movl $0x4, %edx
callq 0x1090
movq -0x410(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x43a4(%rbp)
leaq -0x3350(%rbp), %rax
movq %rax, -0x43a0(%rbp)
leaq -0x3350(%rbp), %rdi
callq 0x10b0
movl -0x43a4(%rbp), %edi
movq -0x43a0(%rbp), %rsi
movq %rax, %rdx
callq 0x1090
jmp 0x18fc
leaq -0x400(%rbp), %rdi
leaq 0xd5b(%rip), %rsi       # 0x30be
callq 0x1040
cmpl $0x0, %eax
jne 0x24a7
cmpq $0x0, -0x10(%rbp)
jne 0x2403
leaq -0x3740(%rbp), %rdi
leaq 0x3546(%rip), %rsi      # 0x58d0
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x1190
leaq -0x3740(%rbp), %rdi
callq 0x10b0
movl %eax, -0x404(%rbp)
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x404(%rbp), %rsi
movl $0x4, %edx
callq 0x1090
movq -0x410(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x43c4(%rbp)
leaq -0x3740(%rbp), %rax
movq %rax, -0x43c0(%rbp)
leaq -0x3740(%rbp), %rdi
callq 0x10b0
movl -0x43c4(%rbp), %edi
movq -0x43c0(%rbp), %rsi
movq %rax, %rdx
callq 0x1090
jmp 0x18fc
leaq -0x3b30(%rbp), %rdi
movq 0x5d8f(%rip), %rax      # 0x81a0
movslq -0x14(%rbp), %rcx
imulq $0x6c, %rcx, %rcx
addq %rcx, %rax
movss 0x64(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movl $0x3e8, %esi            # imm = 0x3E8
leaq 0xc95(%rip), %rdx       # 0x30c6
movb $0x1, %al
callq 0x10f0
leaq -0x3b30(%rbp), %rdi
callq 0x10b0
movl %eax, -0x404(%rbp)
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x404(%rbp), %rsi
movl $0x4, %edx
callq 0x1090
movq -0x410(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x43d4(%rbp)
leaq -0x3b30(%rbp), %rax
movq %rax, -0x43d0(%rbp)
leaq -0x3b30(%rbp), %rdi
callq 0x10b0
movl -0x43d4(%rbp), %edi
movq -0x43d0(%rbp), %rsi
movq %rax, %rdx
callq 0x1090
jmp 0x18fc
leaq -0x400(%rbp), %rdi
leaq 0xc2e(%rip), %rsi       # 0x30e3
callq 0x1040
cmpl $0x0, %eax
jne 0x2604
cmpq $0x0, -0x10(%rbp)
jne 0x2555
leaq -0x3f20(%rbp), %rdi
leaq 0x37e4(%rip), %rsi      # 0x5cc0
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x1190
leaq -0x3f20(%rbp), %rdi
callq 0x10b0
movl %eax, -0x404(%rbp)
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x404(%rbp), %rsi
movl $0x4, %edx
callq 0x1090
movq -0x410(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x43e4(%rbp)
leaq -0x3f20(%rbp), %rax
movq %rax, -0x43e0(%rbp)
leaq -0x3f20(%rbp), %rdi
callq 0x10b0
movl -0x43e4(%rbp), %edi
movq -0x43e0(%rbp), %rsi
movq %rax, %rdx
callq 0x1090
jmp 0x18fc
movq 0x5c44(%rip), %rax      # 0x81a0
movslq -0x14(%rbp), %rcx
imulq $0x6c, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x68(%rax)
movq $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
leaq -0x4310(%rbp), %rdi
leaq 0x3b25(%rip), %rsi      # 0x60b0
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x1190
leaq -0x4310(%rbp), %rdi
callq 0x10b0
movl %eax, -0x404(%rbp)
movq -0x410(%rbp), %rax
movl (%rax), %edi
leaq -0x404(%rbp), %rsi
movl $0x4, %edx
callq 0x1090
movq -0x410(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x43f4(%rbp)
leaq -0x4310(%rbp), %rax
movq %rax, -0x43f0(%rbp)
leaq -0x4310(%rbp), %rdi
callq 0x10b0
movl -0x43f4(%rbp), %edi
movq -0x43f0(%rbp), %rsi
movq %rax, %rdx
callq 0x1090
jmp 0x18fc
jmp 0x2606
jmp 0x2608
jmp 0x260a
jmp 0x260c
jmp 0x260e
jmp 0x2610
jmp 0x18fc
leaq 0xace(%rip), %rdi       # 0x30ea
movb $0x0, %al
callq 0x10e0
movq -0x410(%rbp), %rax
movl (%rax), %edi
callq 0x1120
movq -0x410(%rbp), %rdi
callq 0x1030
xorl %eax, %eax
movl %eax, %edi
callq 0x11b0
nopw %cs:(%rax,%rax)