// File: /workspace/github_c_makefile_star2_O0/sonicse[P]dbf2mysql/mysql2dbf.c
// Function: main
int main(int argc, char **argv) {
	int             i;
	MYSQL		*SQLsock,mysql;
	extern int      optind;
	extern char     *optarg;
	char            *query = NULL;

	dbhead          *dbh;
	field			*rec;
	MYSQL_RES		*qres;
	MYSQL_ROW			qrow;
	MYSQL_FIELD			*qfield;
	u_long			numfields, numrows, t;

	while ((i = getopt(argc, argv, "lucvq:h:d:t:p:U:P:")) != EOF) {
		switch(i) {
			case 'q':
				query = strdup(optarg);
				break;
			case 'v':
				verbose++;
				break;
			case 'c':
				create = 1;
				break;
			case 'l':
				if (upper) {
					usage();
					printf("Can't use -u and -l at the same time!\n");
					exit(1);
				}
				lower = 1;
				break;
			case 'u':
				if (lower) {
					usage();
					printf("Can't use -u and -l at the same time!\n");
					exit(1);
				}
				upper = 1;
				break;
			case 'h':
				host = (char *)strdup(optarg);
				break;
			case 'd':
				dbase = (char *)strdup(optarg);
				break;
			case 't':
				table = (char *)strdup(optarg);
				break;
		        case 'P':
				pass = (char *)strdup(optarg);
				break;
		        case 'U':
			        user = (char *)strdup(optarg);
				break;
			case ':':
				usage();
				printf("Missing argument!\n");
				exit(1);
			case '?':
				usage();
				printf("Unknown argument: %s\n", argv[0]);
				exit(1);
			default:
				break;
		}
	}

	argc -= optind;
	argv = &argv[optind];

	if (argc != 1) {
		usage();
		exit(1);
	}

	if ((dbase == NULL) || ((table == NULL) && (query == NULL))) {
		usage();
		printf("Dbase and table *must* be specified!\n");
		exit(1);
	}

	if (query == NULL) {
		query = (char *)malloc(14+strlen(table));
		sprintf(query, "SELECT * FROM %s", table);
	}

	if (verbose > 1) {
		printf("Opening %s for writing (previous contents will be lost)\n",
																	argv[0]);
	}

	if ((dbh = dbf_open_new(argv[0], O_WRONLY | O_CREAT | O_TRUNC)) == (dbhead *)DBF_ERROR) {
		fprintf(stderr, "Couldn't open xbase-file for writing: %s\n", argv[0]);
		exit(1);
	}

	if (verbose > 1) {
		printf("Making connection with mySQL-server\n");
	}

        mysql_init(&mysql);
        
    if (!(SQLsock = mysql_real_connect(&mysql,host,user,pass, NULL, 0, NULL, 0))) {
        fprintf(stderr, "Couldn't get a connection with the ");
        fprintf(stderr, "designated host!\n");
        fprintf(stderr, "Detailed report: %s\n", mysql_error(&mysql));
        close(dbh->db_fd);
        free(dbh);
        exit(1);
    }

    if (verbose > 1) {
        printf("Selecting database\n");
    }

    if ((mysql_select_db(SQLsock, dbase)) == -1) {
        fprintf(stderr, "Couldn't select database %s.\n", dbase);
        fprintf(stderr, "Detailed report: %s\n", mysql_error(SQLsock));
        close(dbh->db_fd);
        free(dbh);
        mysql_close(SQLsock);
        exit(1);
    }

	if (verbose > 1) {
		printf("Sending query\n");
	}
	

	if (mysql_query(SQLsock, query) == -1) {
		fprintf(stderr, "Error sending query.\nDetailed report: %s\n",
				mysql_error(SQLsock));
		if (verbose > 1) {
			fprintf(stderr, "%s\n", query);
		}
		mysql_close(SQLsock);
		close(dbh->db_fd);
		free(dbh);
		exit(1);
	}

	qres            = mysql_store_result(SQLsock);
	numfields       = mysql_num_fields(qres);
	numrows			= mysql_num_rows(qres);

	while ((qfield = mysql_fetch_field(qres))) {
	  
	  strtoupper(qfield->name);
	  switch (qfield->type) {
	    /* assume INT's have a max. of 10 digits (4^32 has 10 digits) */
	  case FIELD_TYPE_CHAR:
	  case FIELD_TYPE_SHORT:
	  case FIELD_TYPE_LONG:
	  
	    dbf_add_field(dbh, qfield->name, 'N', 10, 0);
	    if (verbose > 1) {
	      printf("Adding field: %s, INT_TYPE, %ld\n", qfield->name,
		     qfield->length);
	    
	    }
	    break;
				/* do we have to make the same assumption here? */
	  case FIELD_TYPE_DOUBLE:
	  case FIELD_TYPE_FLOAT:
	  case FIELD_TYPE_DECIMAL:
	    dbf_add_field(dbh, qfield->name, 'N', qfield->length,
			  qfield->decimals);
	    if (verbose > 1) {
	      printf("Adding field: %s, INT_REAL, %ld\n", qfield->name,
		     qfield->length);
	    }
	    break;
	  case FIELD_TYPE_STRING:
	  case FIELD_TYPE_VAR_STRING:
	  case FIELD_TYPE_BLOB:
	  case FIELD_TYPE_TINY_BLOB:
	  case FIELD_TYPE_MEDIUM_BLOB:
	  case FIELD_TYPE_LONG_BLOB:
	    dbf_add_field(dbh, qfield->name, 'C', qfield->length, 0);
	    if (verbose > 1) {
	      printf("Adding field: %s, INT_CHAR, %ld\n", qfield->name,
		     qfield->length);
	    }
	    break;
	  case FIELD_TYPE_DATETIME:
	  case FIELD_TYPE_TIMESTAMP:
	    dbf_add_field(dbh, qfield->name, 'T', qfield->length, 0);
	    if (verbose > 1) {
	     printf("Adding field: %s, FIELD_TYPE_DATETIME, %ld\n", qfield->name,
	        qfield->length);
	    }
	    break;
	  case FIELD_TYPE_DATE:
	  case FIELD_TYPE_NEWDATE:
	    //dbf_add_field(dbh, qfield->name, 'D', qfield->length, 0);
	    dbf_add_field(dbh, qfield->name, 'D', 8, 0); // date is 8 in dbf, Mysql returns 10 ?!
	    if (verbose > 1) {
	      printf("Adding field: %s, FIELD_TYPE_DATE, %d\n", qfield->name,8);
	      //qfield->length);
	    }
	    break;
	  default:
	    break;
	  }
	}
	
	if (verbose > 1) {
	  printf("Writing out header\n");
	}
	
	dbf_write_head(dbh);
	if (verbose > 1) {
	  printf("Writing out field-descriptions\n");
	}
	dbf_put_fields(dbh);
	if (verbose > 1) {
	  printf("Writing out data\n");
	}
	if (numrows) {
	  while ((qrow = mysql_fetch_row(qres)) != NULL) {

	    if ((rec = dbf_build_record(dbh)) != (field *)DBF_ERROR) {
	       
	      for (t = 0; t < numfields; t++) {
		//printf("ROW: %s\n",qrow[t]);
		if (qrow[t] != 0) {
		  strcpy(rec[t].db_contents, qrow[t]);
		} else {
		  rec[t].db_contents[0] = '\0';
		}
		if (upper) {
		  strtoupper(rec[t].db_contents);
		}
		if (lower) {
		  strtolower(rec[t].db_contents);
		}
	      }
	 
	      dbf_put_record(dbh, rec, dbh->db_records + 1);
	    
	      dbf_free_record(dbh, rec);
	  
	    }
	  }
	}
	
	if (verbose > 1) {
		printf("Writing out header\n");
	}

	dbf_write_head(dbh);

	if (verbose > 1) {
		printf("Closing up\n");
	}
				
	mysql_free_result(qres);
	mysql_close(SQLsock);
	close(dbh->db_fd);
	free(dbh);
	exit(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x530, %rsp            # imm = 0x530
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x4b0(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x3d49(%rip), %rdx      # 0x617b
callq 0x2060
movl %eax, -0x14(%rbp)
cmpl $-0x1, %eax
je 0x25e0
movl -0x14(%rbp), %eax
addl $-0x3a, %eax
movl %eax, %ecx
movq %rcx, -0x4f8(%rbp)
subl $0x3c, %eax
ja 0x25d9
movq -0x4f8(%rbp), %rax
leaq 0x3b9b(%rip), %rcx      # 0x6004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x5b4f(%rip), %rax      # 0x7fc8
movq (%rax), %rdi
callq 0x2280
movq %rax, -0x4b0(%rbp)
jmp 0x25db
movl 0x5d95(%rip), %eax      # 0x8228
addl $0x1, %eax
movl %eax, 0x5d8c(%rip)      # 0x8228
jmp 0x25db
movl $0x1, 0x5d89(%rip)      # 0x8234
jmp 0x25db
cmpl $0x0, 0x5d75(%rip)      # 0x822c
je 0x24d6
callq 0x23c0
leaq 0x3cc9(%rip), %rdi      # 0x618e
movb $0x0, %al
callq 0x2040
movl $0x1, %edi
callq 0x21e0
movl $0x1, 0x5d50(%rip)      # 0x8230
jmp 0x25db
cmpl $0x0, 0x5d44(%rip)      # 0x8230
je 0x250b
callq 0x23c0
leaq 0x3c94(%rip), %rdi      # 0x618e
movb $0x0, %al
callq 0x2040
movl $0x1, %edi
callq 0x21e0
movl $0x1, 0x5d17(%rip)      # 0x822c
jmp 0x25db
movq 0x5aa7(%rip), %rax      # 0x7fc8
movq (%rax), %rdi
callq 0x2280
movq %rax, 0x5d08(%rip)      # 0x8238
jmp 0x25db
movq 0x5a8c(%rip), %rax      # 0x7fc8
movq (%rax), %rdi
callq 0x2280
movq %rax, 0x5cf5(%rip)      # 0x8240
jmp 0x25db
movq 0x5a71(%rip), %rax      # 0x7fc8
movq (%rax), %rdi
callq 0x2280
movq %rax, 0x5ce2(%rip)      # 0x8248
jmp 0x25db
movq 0x5a59(%rip), %rax      # 0x7fc8
movq (%rax), %rdi
callq 0x2280
movq %rax, 0x5cd2(%rip)      # 0x8250
jmp 0x25db
movq 0x5a41(%rip), %rax      # 0x7fc8
movq (%rax), %rdi
callq 0x2280
movq %rax, 0x5cc2(%rip)      # 0x8258
jmp 0x25db
callq 0x23c0
leaq 0x3c11(%rip), %rdi      # 0x61b5
movb $0x0, %al
callq 0x2040
movl $0x1, %edi
callq 0x21e0
callq 0x23c0
movq -0x10(%rbp), %rax
movq (%rax), %rsi
leaq 0x3c00(%rip), %rdi      # 0x61c8
movb $0x0, %al
callq 0x2040
movl $0x1, %edi
callq 0x21e0
jmp 0x25db
jmp 0x2424
movq 0x59f9(%rip), %rax      # 0x7fe0
movl (%rax), %ecx
movl -0x8(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x8(%rbp)
movq -0x10(%rbp), %rax
movq 0x59e4(%rip), %rcx      # 0x7fe0
movslq (%rcx), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
cmpl $0x1, -0x8(%rbp)
je 0x261f
callq 0x23c0
movl $0x1, %edi
callq 0x21e0
cmpq $0x0, 0x5c19(%rip)      # 0x8240
je 0x263d
cmpq $0x0, 0x5c17(%rip)      # 0x8248
jne 0x265a
cmpq $0x0, -0x4b0(%rbp)
jne 0x265a
callq 0x23c0
leaq 0x3b95(%rip), %rdi      # 0x61de
movb $0x0, %al
callq 0x2040
movl $0x1, %edi
callq 0x21e0
cmpq $0x0, -0x4b0(%rbp)
jne 0x269f
movq 0x5bdd(%rip), %rdi      # 0x8248
callq 0x2090
movq %rax, %rdi
addq $0xe, %rdi
callq 0x2200
movq %rax, -0x4b0(%rbp)
movq -0x4b0(%rbp), %rdi
movq 0x5bb7(%rip), %rdx      # 0x8248
leaq 0x3b6c(%rip), %rsi      # 0x6204
movb $0x0, %al
callq 0x2050
cmpl $0x1, 0x5b82(%rip)      # 0x8228
jle 0x26bd
movq -0x10(%rbp), %rax
movq (%rax), %rsi
leaq 0x3b5f(%rip), %rdi      # 0x6215
movb $0x0, %al
callq 0x2040
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl $0x241, %esi            # imm = 0x241
callq 0x3fd0
movq %rax, -0x4b8(%rbp)
movq $-0x1, %rcx
cmpq %rcx, %rax
jne 0x270a
movq 0x58f0(%rip), %rax      # 0x7fd8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
leaq 0x3b55(%rip), %rsi      # 0x624e
movb $0x0, %al
callq 0x2220
movl $0x1, %edi
callq 0x21e0
cmpl $0x1, 0x5b17(%rip)      # 0x8228
jle 0x2721
leaq 0x3b5e(%rip), %rdi      # 0x6278
movb $0x0, %al
callq 0x2040
leaq -0x4a8(%rbp), %rdi
callq 0x20a0
movq 0x5b04(%rip), %rsi      # 0x8238
movq 0x5b1d(%rip), %rdx      # 0x8258
movq 0x5b0e(%rip), %rcx      # 0x8250
leaq -0x4a8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %r8d
xorl %r9d, %r9d
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
callq 0x20b0
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0x27fe
movq 0x585c(%rip), %rax      # 0x7fd8
movq (%rax), %rdi
leaq 0x3b17(%rip), %rsi      # 0x629d
movb $0x0, %al
callq 0x2220
movq 0x5844(%rip), %rax      # 0x7fd8
movq (%rax), %rdi
leaq 0x3b23(%rip), %rsi      # 0x62c1
movb $0x0, %al
callq 0x2220
movq 0x582c(%rip), %rax      # 0x7fd8
movq (%rax), %rax
movq %rax, -0x500(%rbp)
leaq -0x4a8(%rbp), %rdi
callq 0x2080
movq -0x500(%rbp), %rdi
movq %rax, %rdx
leaq 0x3b56(%rip), %rsi      # 0x6329
movb $0x0, %al
callq 0x2220
movq -0x4b8(%rbp), %rax
movl (%rax), %edi
callq 0x22b0
movq -0x4b8(%rbp), %rdi
callq 0x21c0
movl $0x1, %edi
callq 0x21e0
cmpl $0x1, 0x5a23(%rip)      # 0x8228
jle 0x2815
leaq 0x3ac5(%rip), %rdi      # 0x62d3
movb $0x0, %al
callq 0x2040
movq -0x20(%rbp), %rdi
movq 0x5a20(%rip), %rsi      # 0x8240
callq 0x2160
cmpl $-0x1, %eax
jne 0x28a8
movq 0x57a7(%rip), %rax      # 0x7fd8
movq (%rax), %rdi
movq 0x5a05(%rip), %rdx      # 0x8240
leaq 0x3aa5(%rip), %rsi      # 0x62e7
movb $0x0, %al
callq 0x2220
movq 0x5788(%rip), %rax      # 0x7fd8
movq (%rax), %rax
movq %rax, -0x508(%rbp)
movq -0x20(%rbp), %rdi
callq 0x2080
movq -0x508(%rbp), %rdi
movq %rax, %rdx
leaq 0x3ab5(%rip), %rsi      # 0x6329
movb $0x0, %al
callq 0x2220
movq -0x4b8(%rbp), %rax
movl (%rax), %edi
callq 0x22b0
movq -0x4b8(%rbp), %rdi
callq 0x21c0
movq -0x20(%rbp), %rdi
callq 0x2210
movl $0x1, %edi
callq 0x21e0
cmpl $0x1, 0x5979(%rip)      # 0x8228
jle 0x28bf
leaq 0x3a4d(%rip), %rdi      # 0x6305
movb $0x0, %al
callq 0x2040
movq -0x20(%rbp), %rdi
movq -0x4b0(%rbp), %rsi
callq 0x2100
cmpl $-0x1, %eax
jne 0x295f
movq 0x56f9(%rip), %rax      # 0x7fd8
movq (%rax), %rax
movq %rax, -0x510(%rbp)
movq -0x20(%rbp), %rdi
callq 0x2080
movq -0x510(%rbp), %rdi
movq %rax, %rdx
leaq 0x3a11(%rip), %rsi      # 0x6314
movb $0x0, %al
callq 0x2220
cmpl $0x1, 0x5917(%rip)      # 0x8228
jle 0x2932
movq 0x56be(%rip), %rax      # 0x7fd8
movq (%rax), %rdi
movq -0x4b0(%rbp), %rdx
leaq 0x3949(%rip), %rsi      # 0x6274
movb $0x0, %al
callq 0x2220
movq -0x20(%rbp), %rdi
callq 0x2210
movq -0x4b8(%rbp), %rax
movl (%rax), %edi
callq 0x22b0
movq -0x4b8(%rbp), %rdi
callq 0x21c0
movl $0x1, %edi
callq 0x21e0
movq -0x20(%rbp), %rdi
callq 0x20d0
movq %rax, -0x4c8(%rbp)
movq -0x4c8(%rbp), %rdi
callq 0x2250
movl %eax, %eax
movq %rax, -0x4e0(%rbp)
movq -0x4c8(%rbp), %rdi
callq 0x2150
movq %rax, -0x4e8(%rbp)
movq -0x4c8(%rbp), %rdi
callq 0x20f0
movq %rax, -0x4d8(%rbp)
cmpq $0x0, %rax
je 0x2c24
movq -0x4d8(%rbp), %rax
movq (%rax), %rdi
callq 0x5c30
movq -0x4d8(%rbp), %rax
movl 0x70(%rax), %eax
movl %eax, -0x514(%rbp)
testl %eax, %eax
je 0x2ab1
jmp 0x29dd
movl -0x514(%rbp), %eax
decl %eax
subl $0x3, %eax
jb 0x2a5d
jmp 0x29ec
movl -0x514(%rbp), %eax
addl $-0x4, %eax
subl $0x2, %eax
jb 0x2ab1
jmp 0x2a00
movl -0x514(%rbp), %eax
subl $0x7, %eax
je 0x2b78
jmp 0x2a11
movl -0x514(%rbp), %eax
subl $0xa, %eax
je 0x2bd2
jmp 0x2a22
movl -0x514(%rbp), %eax
subl $0xc, %eax
je 0x2b78
jmp 0x2a33
movl -0x514(%rbp), %eax
subl $0xe, %eax
je 0x2bd2
jmp 0x2a44
movl -0x514(%rbp), %eax
addl $0xffffff07, %eax       # imm = 0xFFFFFF07
subl $0x6, %eax
jb 0x2b1b
jmp 0x2c1d
movq -0x4b8(%rbp), %rdi
movq -0x4d8(%rbp), %rax
movq (%rax), %rsi
movl $0x4e, %edx
movl $0xa, %ecx
xorl %r8d, %r8d
callq 0x3e80
cmpl $0x1, 0x57a1(%rip)      # 0x8228
jle 0x2aac
movq -0x4d8(%rbp), %rax
movq (%rax), %rsi
movq -0x4d8(%rbp), %rax
movq 0x38(%rax), %rdx
leaq 0x3899(%rip), %rdi      # 0x633e
movb $0x0, %al
callq 0x2040
jmp 0x2c1f
movq -0x4b8(%rbp), %rdi
movq -0x4d8(%rbp), %rax
movq (%rax), %rsi
movq -0x4d8(%rbp), %rax
movq 0x38(%rax), %rax
movb %al, %cl
movq -0x4d8(%rbp), %rax
movl 0x68(%rax), %eax
movl $0x4e, %edx
movzbl %cl, %ecx
movzbl %al, %r8d
callq 0x3e80
cmpl $0x1, 0x5737(%rip)      # 0x8228
jle 0x2b16
movq -0x4d8(%rbp), %rax
movq (%rax), %rsi
movq -0x4d8(%rbp), %rax
movq 0x38(%rax), %rdx
leaq 0x3850(%rip), %rdi      # 0x635f
movb $0x0, %al
callq 0x2040
jmp 0x2c1f
movq -0x4b8(%rbp), %rdi
movq -0x4d8(%rbp), %rax
movq (%rax), %rsi
movq -0x4d8(%rbp), %rax
movq 0x38(%rax), %rax
movl $0x43, %edx
xorl %r8d, %r8d
movzbl %al, %ecx
callq 0x3e80
cmpl $0x1, 0x56da(%rip)      # 0x8228
jle 0x2b73
movq -0x4d8(%rbp), %rax
movq (%rax), %rsi
movq -0x4d8(%rbp), %rax
movq 0x38(%rax), %rdx
leaq 0x3814(%rip), %rdi      # 0x6380
movb $0x0, %al
callq 0x2040
jmp 0x2c1f
movq -0x4b8(%rbp), %rdi
movq -0x4d8(%rbp), %rax
movq (%rax), %rsi
movq -0x4d8(%rbp), %rax
movq 0x38(%rax), %rax
movl $0x54, %edx
xorl %r8d, %r8d
movzbl %al, %ecx
callq 0x3e80
cmpl $0x1, 0x567d(%rip)      # 0x8228
jle 0x2bd0
movq -0x4d8(%rbp), %rax
movq (%rax), %rsi
movq -0x4d8(%rbp), %rax
movq 0x38(%rax), %rdx
leaq 0x37d8(%rip), %rdi      # 0x63a1
movb $0x0, %al
callq 0x2040
jmp 0x2c1f
movq -0x4b8(%rbp), %rdi
movq -0x4d8(%rbp), %rax
movq (%rax), %rsi
movl $0x44, %edx
movl $0x8, %ecx
xorl %r8d, %r8d
callq 0x3e80
cmpl $0x1, 0x562c(%rip)      # 0x8228
jle 0x2c1b
movq -0x4d8(%rbp), %rax
movq (%rax), %rsi
leaq 0x37be(%rip), %rdi      # 0x63cd
movl $0x8, %edx
movb $0x0, %al
callq 0x2040
jmp 0x2c1f
jmp 0x2c1f
jmp 0x2997
cmpl $0x1, 0x55fd(%rip)      # 0x8228
jle 0x2c3b
leaq 0x37c0(%rip), %rdi      # 0x63f4
movb $0x0, %al
callq 0x2040
movq -0x4b8(%rbp), %rdi
callq 0x3c40
cmpl $0x1, 0x55da(%rip)      # 0x8228
jle 0x2c5e
leaq 0x37b1(%rip), %rdi      # 0x6408
movb $0x0, %al
callq 0x2040
movq -0x4b8(%rbp), %rdi
callq 0x3d50
cmpl $0x1, 0x55b7(%rip)      # 0x8228
jle 0x2c81
leaq 0x37ae(%rip), %rdi      # 0x6428
movb $0x0, %al
callq 0x2040
cmpq $0x0, -0x4e8(%rbp)
je 0x2df6
jmp 0x2c91
movq -0x4c8(%rbp), %rdi
callq 0x21a0
movq %rax, -0x4d0(%rbp)
cmpq $0x0, %rax
je 0x2df4
movq -0x4b8(%rbp), %rdi
callq 0x5310
movq %rax, -0x4c0(%rbp)
movq $-0x1, %rcx
cmpq %rcx, %rax
je 0x2def
movq $0x0, -0x4f0(%rbp)
movq -0x4f0(%rbp), %rax
cmpq -0x4e0(%rbp), %rax
jae 0x2dba
movq -0x4d0(%rbp), %rax
movq -0x4f0(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x2d37
movq -0x4c0(%rbp), %rax
movq -0x4f0(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rdi
movq -0x4d0(%rbp), %rax
movq -0x4f0(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x2180
jmp 0x2d53
movq -0x4c0(%rbp), %rax
movq -0x4f0(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movb $0x0, (%rax)
cmpl $0x0, 0x54d2(%rip)      # 0x822c
je 0x2d7a
movq -0x4c0(%rbp), %rax
movq -0x4f0(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rdi
callq 0x5c30
cmpl $0x0, 0x54af(%rip)      # 0x8230
je 0x2da1
movq -0x4c0(%rbp), %rax
movq -0x4f0(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rdi
callq 0x5c70
jmp 0x2da3
movq -0x4f0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x4f0(%rbp)
jmp 0x2cdc
movq -0x4b8(%rbp), %rdi
movq -0x4c0(%rbp), %rsi
movq -0x4b8(%rbp), %rax
movq 0x20(%rax), %rdx
addq $0x1, %rdx
callq 0x5630
movq -0x4b8(%rbp), %rdi
movq -0x4c0(%rbp), %rsi
callq 0x55d0
jmp 0x2c91
jmp 0x2df6
cmpl $0x1, 0x542b(%rip)      # 0x8228
jle 0x2e0d
leaq 0x35ee(%rip), %rdi      # 0x63f4
movb $0x0, %al
callq 0x2040
movq -0x4b8(%rbp), %rdi
callq 0x3c40
cmpl $0x1, 0x5408(%rip)      # 0x8228
jle 0x2e30
leaq 0x3611(%rip), %rdi      # 0x643a
movb $0x0, %al
callq 0x2040
movq -0x4c8(%rbp), %rdi
callq 0x2190
movq -0x20(%rbp), %rdi
callq 0x2210
movq -0x4b8(%rbp), %rax
movl (%rax), %edi
callq 0x22b0
movq -0x4b8(%rbp), %rdi
callq 0x21c0
xorl %edi, %edi
callq 0x21e0
nopw %cs:(%rax,%rax)