// File: /workspace/github_c_makefile_star2_O0/TurkeyMcMac[P]ts3d/src/do-ts3d-game.c
// Function: do_screen_tick
static void do_screen_tick(struct screen_state *state)
{
	// Sync the screen size:
	if (!state->sized) {
		update_term_size();
		state->menu.area.width =
			COLS >= MENU_WIDTH ? MENU_WIDTH : COLS;
		state->menu.area.height = LINES;
		state->title.area.width = COLS - state->menu.area.width;
		state->title.area.height = LINES;
		state->title.area.x = state->menu.area.width;
		if (state->title.initialized) {
			d3d_free_camera(state->title.cam);
			state->title.cam = camera_with_dims(
				state->title.area.width,
				state->title.area.height);
		}
		if (state->menu.initialized)
			menu_mark_area_changed(&state->menu.menu);
		state->sized = true;
	}
	// Update the screen:
	if (state->title.initialized) {
		// theta is always increasing, but at a fluctuating rate so that
		// it pauses when the camera is facing the letters:
		d3d_scalar theta = -state->title.t
			- sin(state->title.t * 4.0 - PI) / 4.0;
		// r is at its highest when the camera is facing a letter:
		d3d_scalar r = (cos(theta * 4.0) + 0.5) / 1.5
			* TITLE_SCREEN_RADIUS;
		d3d_scalar x = r * cos(theta);
		d3d_scalar y = r * sin(theta);
		d3d_vec_s pos = {
			x + d3d_board_width(state->title.board) / 2.0,
			y + d3d_board_height(state->title.board) / 2.0
		};
		d3d_draw(state->title.cam, pos, theta,
			state->title.board, 0, NULL);
		display_frame(state->title.cam, &state->title.area,
			state->title.color_map);
		state->title.t += TITLE_SCREEN_SPEED;
	}
	if (state->menu.initialized) menu_draw(&state->menu.menu);
	refresh();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x28(%rbp)
movq -0x28(%rbp), %rax
testb $0x1, (%rax)
jne 0x5498
callq 0x10690
movq 0x10c00(%rip), %rax     # 0x15fc8
cmpl $0x29, (%rax)
jl 0x53d7
movl $0x29, %eax
movl %eax, -0x5c(%rbp)
jmp 0x53e3
movq 0x10bea(%rip), %rax     # 0x15fc8
movl (%rax), %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x58(%rax)
movq 0x10bac(%rip), %rax     # 0x15fa0
movl (%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x5c(%rax)
movq 0x10bc4(%rip), %rax     # 0x15fc8
movl (%rax), %ecx
movq -0x28(%rbp), %rax
subl 0x58(%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x88(%rax)
movq 0x10b82(%rip), %rax     # 0x15fa0
movl (%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x8c(%rax)
movq -0x28(%rbp), %rax
movl 0x58(%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x80(%rax)
movq -0x28(%rbp), %rax
testb $0x1, 0x60(%rax)
je 0x5476
movq -0x28(%rbp), %rax
movq 0x68(%rax), %rdi
callq 0x2d20
movq -0x28(%rbp), %rax
movl 0x88(%rax), %edi
movq -0x28(%rbp), %rax
movl 0x8c(%rax), %esi
callq 0x105c0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x28(%rbp), %rax
testb $0x1, 0x8(%rax)
je 0x5491
movq -0x28(%rbp), %rdi
addq $0x8, %rdi
addq $0x8, %rdi
callq 0xd0d0
movq -0x28(%rbp), %rax
movb $0x1, (%rax)
movq -0x28(%rbp), %rax
testb $0x1, 0x60(%rax)
je 0x56d8
movq -0x28(%rbp), %rax
movsd 0x70(%rax), %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd 0xbc49(%rip), %xmm1     # 0x11108
movsd %xmm1, -0xb8(%rbp)
mulsd %xmm1, %xmm0
movsd 0xbb8d(%rip), %xmm1     # 0x11060
addsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rbp)
movsd -0x18(%rbp), %xmm0
callq 0x2530
movsd -0xc0(%rbp), %xmm2
movsd -0xb8(%rbp), %xmm1
movsd 0xbc12(%rip), %xmm3     # 0x11110
mulsd %xmm3, %xmm0
subsd %xmm2, %xmm0
movsd %xmm0, -0x30(%rbp)
movsd -0x30(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
callq 0x2190
movsd 0xbafd(%rip), %xmm1     # 0x11028
movsd %xmm1, -0xa0(%rbp)
addsd %xmm1, %xmm0
movsd 0xbbd9(%rip), %xmm2     # 0x11118
divsd %xmm2, %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0xb0(%rbp)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
callq 0x2190
movaps %xmm0, %xmm1
movsd -0xb0(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
movsd -0x20(%rbp), %xmm0
callq 0x2530
movaps %xmm0, %xmm1
movsd -0xa8(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
movq -0x28(%rbp), %rax
movq 0x78(%rax), %rdi
callq 0x3d20
movsd -0xa0(%rbp), %xmm2
movsd -0x98(%rbp), %xmm0
movq %rax, %xmm1
movaps 0xba84(%rip), %xmm3     # 0x11070
movaps %xmm3, -0x90(%rbp)
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
movapd 0xba81(%rip), %xmm3     # 0x11080
movaps %xmm3, -0x80(%rbp)
subpd %xmm3, %xmm1
movaps %xmm1, %xmm3
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm3, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movq -0x28(%rbp), %rax
movq 0x78(%rax), %rdi
callq 0x3d40
movaps -0x90(%rbp), %xmm3
movaps -0x80(%rbp), %xmm2
movsd -0x68(%rbp), %xmm0
movq %rax, %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
movsd 0xb9ea(%rip), %xmm2     # 0x11050
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movq -0x28(%rbp), %rax
movq 0x68(%rax), %rdi
movsd -0x30(%rbp), %xmm2
movq -0x28(%rbp), %rax
movq 0x78(%rax), %rsi
movsd -0x58(%rbp), %xmm0
movsd -0x50(%rbp), %xmm1
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x2f60
movq -0x28(%rbp), %rax
movq 0x68(%rax), %rdi
movq -0x28(%rbp), %rsi
addq $0x60, %rsi
addq $0x20, %rsi
movq -0x28(%rbp), %rax
movq 0x90(%rax), %rdx
callq 0x10480
movq -0x28(%rbp), %rax
movsd 0xba32(%rip), %xmm0     # 0x11100
addsd 0x70(%rax), %xmm0
movsd %xmm0, 0x70(%rax)
movq -0x28(%rbp), %rax
testb $0x1, 0x8(%rax)
je 0x56f3
movq -0x28(%rbp), %rdi
addq $0x8, %rdi
addq $0x8, %rdi
callq 0xd0f0
movq 0x108de(%rip), %rax     # 0x15fd8
movq (%rax), %rdi
callq 0x2220
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax,%rax)