// File: /workspace/github_c_makefile_star2_O0/tudurom[P]windowchef/wm.c
// Function: pointer_modfield_from_keysym
static int16_t
pointer_modfield_from_keysym(xcb_keysym_t keysym)
{
	uint16_t modfield = 0;
	xcb_keycode_t *keycodes = NULL, *mod_keycodes = NULL;
	xcb_get_modifier_mapping_reply_t *reply = NULL;
	xcb_key_symbols_t *symbols = xcb_key_symbols_alloc(conn);

	/* wrapped all of them in an ugly if to prevent getting values when
	   we don't need them */
	if (!((keycodes = xcb_key_symbols_get_keycode(symbols, keysym)) == NULL ||
		  (reply = xcb_get_modifier_mapping_reply(conn, xcb_get_modifier_mapping(conn), NULL)) == NULL ||
		  reply->keycodes_per_modifier < 1 ||
		  (mod_keycodes = xcb_get_modifier_mapping_keycodes(reply)) == NULL)) {

		int num_mod =
			xcb_get_modifier_mapping_keycodes_length(reply) /
			reply->keycodes_per_modifier;

		for (int i = 0; i < num_mod; i++) {
			for (int j = 0; j < reply->keycodes_per_modifier; j++) {
				xcb_keycode_t mk = mod_keycodes[i * reply->keycodes_per_modifier + j];
				if (mk != XCB_NO_SYMBOL) {
					for (xcb_keycode_t *k = keycodes; *k != XCB_NO_SYMBOL; k++) {
						if (*k == mk)
							modfield |= (1 << i);
					}
				}
			}
		}
	}

	xcb_key_symbols_free(symbols);
	free(keycodes);
	free(reply);
	return modfield;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0x4(%rbp)
movw $0x0, -0x6(%rbp)
movq $0x0, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq 0x4028(%rip), %rdi      # 0xf3d8
callq 0x3370
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movl -0x4(%rbp), %esi
callq 0x3030
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0xb50d
movq 0x3ffe(%rip), %rax      # 0xf3d8
movq %rax, -0x50(%rbp)
movq 0x3ff3(%rip), %rdi      # 0xf3d8
callq 0x36a0
movq -0x50(%rbp), %rdi
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x3540
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0xb50d
movq -0x20(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x1, %eax
jl 0xb50d
movq -0x20(%rbp), %rdi
callq 0x34e0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0xb50d
movq -0x20(%rbp), %rdi
callq 0x3620
movq -0x20(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
cltd
idivl %ecx
movl %eax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x30(%rbp), %eax
jge 0xb50b
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x20(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
cmpl %ecx, %eax
jge 0xb4fb
movq -0x18(%rbp), %rax
movl -0x34(%rbp), %ecx
movq -0x20(%rbp), %rdx
movzbl 0x1(%rdx), %edx
imull %edx, %ecx
addl -0x38(%rbp), %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %al
movb %al, -0x39(%rbp)
movzbl -0x39(%rbp), %eax
cmpq $0x0, %rax
je 0xb4eb
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movzbl (%rax), %eax
cmpq $0x0, %rax
je 0xb4e9
movq -0x48(%rbp), %rax
movzbl (%rax), %eax
movzbl -0x39(%rbp), %ecx
cmpl %ecx, %eax
jne 0xb4d9
movl -0x34(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, %ecx
movzwl -0x6(%rbp), %eax
orl %ecx, %eax
movw %ax, -0x6(%rbp)
jmp 0xb4db
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0xb4a7
jmp 0xb4eb
jmp 0xb4ed
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0xb464
jmp 0xb4fd
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xb451
jmp 0xb50d
movq -0x28(%rbp), %rdi
callq 0x34a0
movq -0x10(%rbp), %rdi
callq 0x32d0
movq -0x20(%rbp), %rdi
callq 0x32d0
movw -0x6(%rbp), %ax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)