// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/g_save.c
// Function: ReadGame
void ReadGame(char* filename)
{
	FILE* f;
	int		i;
	char	str[MAX_INFO_STRING] = { 0 };
	size_t	count;

	gi.FreeTags(TAG_GAME);

	f = fopen(filename, "rb");
	if (!f)
	{
		gi.error("Couldn't open %s", filename);
		return;
	}

	count = fread(str, sizeof(str), 1, f);
	if (count)
		; // don't worry, be happy
	if (strcmp(str, __DATE__))
	{
		fclose(f);
		gi.error("Savegame from an older version.\n");
	}

	g_edicts = gi.TagMalloc(game.maxentities * sizeof(g_edicts[0]), TAG_GAME);
	globals.edicts = g_edicts;

	count = fread(&game, sizeof(game), 1, f);
	game.clients = gi.TagMalloc(game.maxclients * sizeof(game.clients[0]), TAG_GAME);
	for (i = 0; i < game.maxclients; i++)
		ReadClient(f, &game.clients[i]);

	fclose(f);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
movq %rdi, -0x8(%rbp)
leaq -0x220(%rbp), %rdi
xorl %esi, %esi
movl $0x200, %edx            # imm = 0x200
callq 0x188f0
movl $0x2fd, %edi            # imm = 0x2FD
movq 0x38a22(%rip), %rax     # 0x82600
callq *0x118(%rax)
movq -0x8(%rbp), %rdi
leaq 0x2a55d(%rip), %rsi     # 0x7414c
callq 0x196a0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x49c1e
movq 0x389fa(%rip), %rax     # 0x82600
movq 0x38(%rax), %rcx
movq -0x8(%rbp), %rsi
leaq 0x272ac(%rip), %rdi     # 0x70ec1
movb $0x0, %al
callq *%rcx
jmp 0x49d80
leaq -0x220(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x200, %esi            # imm = 0x200
movl $0x1, %edx
callq 0x18430
movq %rax, -0x228(%rbp)
cmpq $0x0, -0x228(%rbp)
je 0x49c4b
jmp 0x49c4b
leaq -0x220(%rbp), %rdi
leaq 0x28ce8(%rip), %rsi     # 0x72941
callq 0x18bf0
cmpl $0x0, %eax
je 0x49c7f
movq -0x10(%rbp), %rdi
callq 0x18600
leaq 0x2b13e(%rip), %rdi     # 0x74db1
movq 0x38986(%rip), %rcx     # 0x82600
movb $0x0, %al
callq *0x38(%rcx)
movq 0x3897a(%rip), %rax     # 0x82600
movq 0x108(%rax), %rax
movq 0x390ac(%rip), %rcx     # 0x82d40
movslq 0x614(%rcx), %rcx
imulq $0x4a8, %rcx, %rcx      # imm = 0x4A8
movl %ecx, %edi
movl $0x2fd, %esi            # imm = 0x2FD
callq *%rax
movq %rax, %rcx
movq 0x388a3(%rip), %rax     # 0x82558
movq %rcx, (%rax)
movq 0x38899(%rip), %rax     # 0x82558
movq (%rax), %rcx
movq 0x38e3f(%rip), %rax     # 0x82b08
movq %rcx, 0x80(%rax)
movq -0x10(%rbp), %rcx
movq 0x39065(%rip), %rdi     # 0x82d40
movl $0x628, %esi            # imm = 0x628
movl $0x1, %edx
callq 0x18430
movq %rax, -0x228(%rbp)
movq 0x38908(%rip), %rax     # 0x82600
movq 0x108(%rax), %rax
movq 0x3903a(%rip), %rcx     # 0x82d40
movslq 0x610(%rcx), %rcx
imulq $0x9140, %rcx, %rcx     # imm = 0x9140
movl %ecx, %edi
movl $0x2fd, %esi            # imm = 0x2FD
callq *%rax
movq %rax, %rcx
movq 0x39019(%rip), %rax     # 0x82d40
movq %rcx, 0x408(%rax)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq 0x39001(%rip), %rcx     # 0x82d40
cmpl 0x610(%rcx), %eax
jge 0x49d77
movq -0x10(%rbp), %rdi
movq 0x38fee(%rip), %rax     # 0x82d40
movq 0x408(%rax), %rsi
movslq -0x14(%rbp), %rax
imulq $0x9140, %rax, %rax     # imm = 0x9140
addq %rax, %rsi
callq 0x19490
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x49d35
movq -0x10(%rbp), %rdi
callq 0x18600
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
nopl (%rax)