// File: /workspace/github_c_makefile_star2_O0/derhass[P]glx_hook/glx_hook.c
// Function: swapbuffer_omission_init
static void
swapbuffer_omission_init(GH_swapbuffer_omission_t *swo)
{
	int i;
	int min_swap_usecs = get_envi("GH_MIN_SWAP_USECS",0);
	swo->swapbuffers=get_envi("GH_SWAPBUFFERS",0);
	swo->min_swap_time = 0;
	if (min_swap_usecs > 0) {
		swo->swapbuffers = 1;
		swo->min_swap_time = (uint64_t)min_swap_usecs * (uint64_t)1000UL;
	}
	swo->latency_mode = get_envi("GH_SWAP_OMISSION_LATENCY", 0);
	swo->flush_mode = get_envi("GH_SWAP_OMISSION_FLUSH", 1);
	swo->measure_mode = get_envi("GH_SWAP_OMISSION_MEASURE", 3);
	swo->limits[0] = get_envi("GH_SWAP_OMISSION_MIN",1);
	swo->limits[1] = get_envi("GH_SWAP_OMISSION_MAX",4);
	if (swo->limits[0] < 1) {
		swo->limits[0] = 1;
	}
	if (swo->limits[1] < swo->limits[0]) {
		swo->limits[1] = swo->limits[0];
	}
	swo->swapbuffer_cnt=0;
	swo->cur_pos = 0;
	swo->measure_frames_tot = get_envui("GH_SWAP_OMISSION_MEASURE_TOT", 6U);
	swo->measure_frames_avg = get_envui("GH_SWAP_OMISSION_MEASURE_AVG", 4U);
	if (swo->measure_frames_tot > GH_SWAP_OMISSION_FRAMES_MAX) {
		swo->measure_frames_tot = GH_SWAP_OMISSION_FRAMES_MAX;
	} else if (swo->measure_frames_tot < 2) {
		swo->measure_frames_tot = 2;
	}
	if (swo->measure_frames_avg >= swo->measure_frames_tot) {
		swo->measure_frames_avg = swo->measure_frames_tot - 1U;
	}
	if (swo->measure_frames_avg < 1) {
		swo->measure_frames_avg = 1;
	}

	for (i=0; i<GH_SWAP_OMISSION_FRAMES_MAX; i++) {
		timestamp_init(&swo->prev_frame_ts[i][0]);
		timestamp_init(&swo->prev_frame_ts[i][1]);
		frametime_init(&swo->prev_frames[i][0]);
		frametime_init(&swo->prev_frames[i][1]);
		swo->prev_intervals[i] = 1;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
leaq 0x337b(%rip), %rdi      # 0xa02e
xorl %esi, %esi
callq 0x5480
movl %eax, -0x10(%rbp)
leaq 0x337c(%rip), %rdi      # 0xa040
xorl %esi, %esi
callq 0x5480
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x20(%rax)
cmpl $0x0, -0x10(%rbp)
jle 0x6d02
movq -0x8(%rbp), %rax
movl $0x1, (%rax)
movslq -0x10(%rbp), %rax
imulq $0x3e8, %rax, %rcx      # imm = 0x3E8
movq -0x8(%rbp), %rax
movq %rcx, 0x20(%rax)
leaq 0x3346(%rip), %rdi      # 0xa04f
xorl %esi, %esi
callq 0x5480
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x8(%rax)
leaq 0x3348(%rip), %rdi      # 0xa068
movl $0x1, %esi
callq 0x5480
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xc(%rax)
leaq 0x3345(%rip), %rdi      # 0xa07f
movl $0x3, %esi
callq 0x5480
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x10(%rax)
leaq 0x3344(%rip), %rdi      # 0xa098
movl $0x1, %esi
callq 0x5480
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x14(%rax)
leaq 0x333f(%rip), %rdi      # 0xa0ad
movl $0x4, %esi
callq 0x5480
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x8(%rbp), %rax
cmpl $0x1, 0x14(%rax)
jge 0x6d96
movq -0x8(%rbp), %rax
movl $0x1, 0x14(%rax)
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
movq -0x8(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jge 0x6db4
movq -0x8(%rbp), %rax
movl 0x14(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x768(%rax)
leaq 0x32ee(%rip), %rdi      # 0xa0c2
movl $0x6, %esi
callq 0x74c0
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x76c(%rax)
leaq 0x32ee(%rip), %rdi      # 0xa0df
movl $0x4, %esi
callq 0x74c0
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x770(%rax)
movq -0x8(%rbp), %rax
cmpl $0x10, 0x76c(%rax)
jbe 0x6e24
movq -0x8(%rbp), %rax
movl $0x10, 0x76c(%rax)
jmp 0x6e41
movq -0x8(%rbp), %rax
cmpl $0x2, 0x76c(%rax)
jae 0x6e3f
movq -0x8(%rbp), %rax
movl $0x2, 0x76c(%rax)
jmp 0x6e41
movq -0x8(%rbp), %rax
movl 0x770(%rax), %eax
movq -0x8(%rbp), %rcx
cmpl 0x76c(%rcx), %eax
jb 0x6e6e
movq -0x8(%rbp), %rax
movl 0x76c(%rax), %ecx
subl $0x1, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x770(%rax)
movq -0x8(%rbp), %rax
cmpl $0x1, 0x770(%rax)
jae 0x6e89
movq -0x8(%rbp), %rax
movl $0x1, 0x770(%rax)
movl $0x0, -0xc(%rbp)
cmpl $0x10, -0xc(%rbp)
jge 0x6f29
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
movslq -0xc(%rbp), %rax
shlq $0x6, %rax
addq %rax, %rdi
callq 0x6f30
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
movslq -0xc(%rbp), %rax
shlq $0x6, %rax
addq %rax, %rdi
addq $0x20, %rdi
callq 0x6f30
movq -0x8(%rbp), %rdi
addq $0x428, %rdi            # imm = 0x428
movslq -0xc(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
callq 0x7510
movq -0x8(%rbp), %rdi
addq $0x428, %rdi            # imm = 0x428
movslq -0xc(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
addq $0x18, %rdi
callq 0x7510
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movl $0x1, 0x728(%rax,%rcx,4)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x6e90
addq $0x10, %rsp
popq %rbp
retq
nop