// File: /workspace/github_c_makefile_star2_O0/baskerville[P]sxhkd/src/types.c
// Function: make_chord
chord_t *make_chord(xcb_keysym_t keysym, xcb_button_t button, uint16_t modfield, uint8_t event_type, bool replay_event, bool lock_chain)
{
	chord_t *chord;
	if (button == XCB_NONE) {
		chord_t *prev = NULL;
		chord_t *orig = NULL;
		xcb_keycode_t *keycodes = keycodes_from_keysym(keysym);
		if (keycodes != NULL) {
			for (xcb_keycode_t *kc = keycodes; *kc != XCB_NO_SYMBOL; kc++) {
				xcb_keysym_t natural_keysym = xcb_key_symbols_get_keysym(symbols, *kc, 0);
				for (unsigned char col = 0; col < KEYSYMS_PER_KEYCODE; col++) {
					xcb_keysym_t ks = xcb_key_symbols_get_keysym(symbols, *kc, col);
					if (ks == keysym) {
						uint16_t implicit_modfield = (col & 1 ? XCB_MOD_MASK_SHIFT : 0) | (col & 2 ? modfield_from_keysym(Mode_switch) : 0);
						uint16_t explicit_modfield = modfield | implicit_modfield;
						chord = malloc(sizeof(chord_t));
						bool unique = true;
						for (chord_t *c = orig; unique && c != NULL; c = c->more)
							if (c->modfield == explicit_modfield && c->keysym == natural_keysym)
								unique = false;
						if (!unique) {
							free(chord);
							break;
						}
						chord->keysym = natural_keysym;
						chord->button = button;
						chord->modfield = explicit_modfield;
						chord->next = chord->more = NULL;
						chord->event_type = event_type;
						chord->replay_event = replay_event;
						chord->lock_chain = lock_chain;
						if (prev != NULL)
							prev->more = chord;
						else
							orig = chord;
						prev = chord;
						PRINTF("key chord %u %u\n", natural_keysym, explicit_modfield);
						break;
					}
				}
			}
		} else {
			warn("No keycodes found for keysym %u.\n", keysym);
		}
		free(keycodes);
		chord = orig;
	} else {
		chord = malloc(sizeof(chord_t));
		chord->keysym = keysym;
		chord->button = button;
		chord->modfield = modfield;
		chord->event_type = event_type;
		chord->replay_event = replay_event;
		chord->lock_chain = lock_chain;
		chord->next = chord->more = NULL;
		PRINTF("button chord %u %u\n", button, modfield);
	}
	return chord;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movl %r8d, -0x68(%rbp)
movl %ecx, %eax
movl -0x68(%rbp), %ecx
movl %eax, -0x64(%rbp)
movl %edx, %eax
movl -0x64(%rbp), %edx
movl %eax, -0x60(%rbp)
movl %esi, %eax
movl -0x60(%rbp), %esi
movl %eax, -0x5c(%rbp)
movl %edi, %r8d
movl -0x5c(%rbp), %edi
movb %r9b, %al
movl %r8d, -0x4(%rbp)
movb %dil, -0x5(%rbp)
movw %si, -0x8(%rbp)
movb %dl, -0x9(%rbp)
andb $0x1, %cl
movb %cl, -0xa(%rbp)
andb $0x1, %al
movb %al, -0xb(%rbp)
movzbl -0x5(%rbp), %eax
cmpq $0x0, %rax
jne 0x11f56
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movl -0x4(%rbp), %edi
callq 0x11500
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x11f2f
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movzbl (%rax), %eax
cmpq $0x0, %rax
je 0x11f2d
leaq 0x11759(%rip), %rax     # 0x23498
movq (%rax), %rdi
movq -0x38(%rbp), %rax
xorl %edx, %edx
movzbl (%rax), %esi
callq 0xe250
movl %eax, -0x3c(%rbp)
movb $0x0, -0x3d(%rbp)
movzbl -0x3d(%rbp), %eax
cmpl $0x4, %eax
jge 0x11f1a
leaq 0x1172d(%rip), %rax     # 0x23498
movq (%rax), %rdi
movq -0x38(%rbp), %rax
movb (%rax), %al
movzbl -0x3d(%rbp), %edx
movzbl %al, %esi
callq 0xe250
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x4(%rbp), %eax
jne 0x11f0b
movzbl -0x3d(%rbp), %edx
andl $0x1, %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x6c(%rbp)
movzbl -0x3d(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x11dc6
leaq 0x11b37(%rip), %rax     # 0x238f0
movl (%rax), %edi
callq 0x111f0
cwtl
movl %eax, -0x70(%rbp)
jmp 0x11dcd
xorl %eax, %eax
movl %eax, -0x70(%rbp)
jmp 0x11dcd
movl -0x6c(%rbp), %eax
movl -0x70(%rbp), %ecx
orl %ecx, %eax
movw %ax, -0x46(%rbp)
movzwl -0x8(%rbp), %eax
movzwl -0x46(%rbp), %ecx
orl %ecx, %eax
movw %ax, -0x48(%rbp)
movl $0x120, %edi            # imm = 0x120
callq 0xe270
movq %rax, -0x18(%rbp)
movb $0x1, -0x49(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x58(%rbp)
xorl %eax, %eax
testb $0x1, -0x49(%rbp)
movb %al, -0x71(%rbp)
je 0x11e17
cmpq $0x0, -0x58(%rbp)
setne %al
movb %al, -0x71(%rbp)
movb -0x71(%rbp), %al
testb $0x1, %al
jne 0x11e20
jmp 0x11e59
movq -0x58(%rbp), %rax
movzwl 0x106(%rax), %eax
movzwl -0x48(%rbp), %ecx
cmpl %ecx, %eax
jne 0x11e46
movq -0x58(%rbp), %rax
movl 0x100(%rax), %eax
cmpl -0x3c(%rbp), %eax
jne 0x11e46
movb $0x0, -0x49(%rbp)
jmp 0x11e48
movq -0x58(%rbp), %rax
movq 0x118(%rax), %rax
movq %rax, -0x58(%rbp)
jmp 0x11e01
testb $0x1, -0x49(%rbp)
jne 0x11e6d
movq -0x18(%rbp), %rdi
callq 0xe040
jmp 0x11f1a
movl -0x3c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x100(%rax)
movb -0x5(%rbp), %cl
movq -0x18(%rbp), %rax
movb %cl, 0x104(%rax)
movw -0x48(%rbp), %cx
movq -0x18(%rbp), %rax
movw %cx, 0x106(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x118(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x110(%rax)
movb -0x9(%rbp), %cl
movq -0x18(%rbp), %rax
movb %cl, 0x108(%rax)
movb -0xa(%rbp), %cl
movq -0x18(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x109(%rax)
movb -0xb(%rbp), %cl
movq -0x18(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x10a(%rax)
cmpq $0x0, -0x20(%rbp)
je 0x11ef9
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x118(%rax)
jmp 0x11f01
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x11f1a
jmp 0x11f0d
movb -0x3d(%rbp), %al
addb $0x1, %al
movb %al, -0x3d(%rbp)
jmp 0x11d57
jmp 0x11f1c
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x11d27
jmp 0x11f40
movl -0x4(%rbp), %esi
leaq 0x74a8(%rip), %rdi      # 0x193e1
movb $0x0, %al
callq 0xf640
movq -0x30(%rbp), %rdi
callq 0xe040
movq -0x28(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x11fd8
movl $0x120, %edi            # imm = 0x120
callq 0xe270
movq %rax, -0x18(%rbp)
movl -0x4(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x100(%rax)
movb -0x5(%rbp), %cl
movq -0x18(%rbp), %rax
movb %cl, 0x104(%rax)
movw -0x8(%rbp), %cx
movq -0x18(%rbp), %rax
movw %cx, 0x106(%rax)
movb -0x9(%rbp), %cl
movq -0x18(%rbp), %rax
movb %cl, 0x108(%rax)
movb -0xa(%rbp), %cl
movq -0x18(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x109(%rax)
movb -0xb(%rbp), %cl
movq -0x18(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x10a(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x118(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x110(%rax)
movq -0x18(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)