// File: /workspace/github_c_makefile_star2_O0/derhass[P]glx_hook/glx_hook.c
// Function: GH_swap_mode_from_str
static void GH_swap_mode_from_str(GH_config volatile *cfg, const char *str)
{
	static const char *mode_str[GH_SWAP_MODES_COUNT+1]={
		"nop",
		"ignore",
		"clamp",
		"force",
		"disable",
		"enable",
		"min",
		"max",
		NULL
	};

	size_t l=0;
	int idx;
	char *nstr;

	cfg->swap_mode=GH_SWAP_MODE_NOP;
	
	if (str == NULL)
		return;

	for (idx=0; mode_str[idx]; idx++) {
		l=strlen(mode_str[idx]);
		if (!strncmp(str, mode_str[idx], l)) {
			break;
		}
	}

	if (idx >= 0 && idx<(int)GH_SWAP_MODES_COUNT) {
		cfg->swap_mode=(GH_swap_mode)idx;
	}

	str += l;

	/* read up to 2 ints as arguments */
	while(*str && !isdigit(*str))
		str++;
	cfg->swap_param[0]=(int)strtol(str, &nstr, 0);
	str=nstr;
	while(*str && !isdigit(*str))
		str++;
	cfg->swap_param[1]=(int)strtol(str, &nstr,0);
	GH_verbose(GH_MSG_DEBUG, "SWAP_MODE: %d %d %d\n",
				cfg->swap_mode,cfg->swap_param[0],cfg->swap_param[1]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rax
movl $0x0, (%rax)
cmpq $0x0, -0x10(%rbp)
jne 0x22be
jmp 0x243c
movl $0x0, -0x1c(%rbp)
movslq -0x1c(%rbp), %rcx
leaq 0x2e20(%rip), %rax      # 0x50f0
cmpq $0x0, (%rax,%rcx,8)
je 0x231f
movslq -0x1c(%rbp), %rcx
leaq 0x2e0e(%rip), %rax      # 0x50f0
movq (%rax,%rcx,8), %rdi
callq 0x1080
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x1c(%rbp), %rcx
leaq 0x2df2(%rip), %rax      # 0x50f0
movq (%rax,%rcx,8), %rsi
movq -0x18(%rbp), %rdx
callq 0x1040
cmpl $0x0, %eax
jne 0x2312
jmp 0x231f
jmp 0x2314
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x22c5
cmpl $0x0, -0x1c(%rbp)
jl 0x2334
cmpl $0x8, -0x1c(%rbp)
jge 0x2334
movl -0x1c(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
addq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x29(%rbp)
je 0x2377
callq 0x1140
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0x29(%rbp)
movb -0x29(%rbp), %al
testb $0x1, %al
jne 0x2380
jmp 0x238e
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x2340
movq -0x10(%rbp), %rdi
leaq -0x28(%rbp), %rsi
xorl %edx, %edx
callq 0x10d0
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x2a(%rbp)
je 0x23e5
callq 0x1140
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0x2a(%rbp)
movb -0x2a(%rbp), %al
testb $0x1, %al
jne 0x23ee
jmp 0x23fc
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x23ae
movq -0x10(%rbp), %rdi
leaq -0x28(%rbp), %rsi
xorl %edx, %edx
callq 0x10d0
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rax
movl (%rax), %edx
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x8(%rbp), %rax
movl 0xc(%rax), %r8d
movl $0x4, %edi
leaq 0xee7(%rip), %rsi       # 0x331c
movb $0x0, %al
callq 0x16c0
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)