// File: thjaeger[P]bindbutton/bindbutton.cc
// Function: grab_buttons()
void grab_buttons() {
	if (always_grab) {
		printf("Grabbing XInput devices...\n");
		for (std::list<XiDevice>::iterator j = devices.begin(); j != devices.end(); j++)
			j->grab();
	}
	for (std::map<unsigned int, Commands>::iterator i = commands.begin(); i != commands.end(); i++) {
		XGrabButton(dpy, i->first, AnyModifier, ROOT, False, ButtonPressMask,
				GrabModeSync, GrabModeAsync, None, None);
		if (always_grab)
			continue;
		for (std::list<XiDevice>::iterator j = devices.begin(); j != devices.end(); j++) {
			if (i->first > j->num_buttons)
				continue;
			XGrabDeviceButton(dpy, j->dev, i->first, AnyModifier, NULL,
					ROOT, False, 2, j->classes, GrabModeAsync, GrabModeAsync);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
testb $0x1, 0x8867(%rip)      # 0xb169
je 0x2969
leaq 0x47d7(%rip), %rdi      # 0x70e2
movb $0x0, %al
callq 0x2030
leaq 0x885f(%rip), %rdi      # 0xb178
callq 0x33c0
movq %rax, -0x8(%rbp)
leaq 0x884f(%rip), %rdi      # 0xb178
callq 0x3420
movq %rax, -0x10(%rbp)
leaq -0x8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x33f0
testb $0x1, %al
jne 0x2945
jmp 0x2967
leaq -0x8(%rbp), %rdi
callq 0x3450
movq %rax, %rdi
callq 0x3470
leaq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x3570
movq %rax, -0x18(%rbp)
jmp 0x2922
jmp 0x2969
leaq 0x8820(%rip), %rdi      # 0xb190
callq 0x35a0
movq %rax, -0x20(%rbp)
leaq 0x8810(%rip), %rdi      # 0xb190
callq 0x3600
movq %rax, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x35d0
testb $0x1, %al
jne 0x299f
jmp 0x2b4f
movq 0x87ba(%rip), %rax      # 0xb160
movq %rax, -0x50(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x3630
movq -0x50(%rbp), %rdi
movl (%rax), %esi
movq 0x87a0(%rip), %rax      # 0xb160
movq 0xe8(%rax), %rax
movq 0x8792(%rip), %rcx      # 0xb160
movslq 0xe0(%rcx), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rcx
movl $0x8000, %edx           # imm = 0x8000
xorl %r8d, %r8d
movl $0x4, %r9d
xorl %eax, %eax
movl $0x0, (%rsp)
movl $0x1, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
callq 0x2270
testb $0x1, 0x874c(%rip)      # 0xb169
je 0x2a24
jmp 0x2b3b
leaq 0x874d(%rip), %rdi      # 0xb178
callq 0x33c0
movq %rax, -0x30(%rbp)
leaq 0x873d(%rip), %rdi      # 0xb178
callq 0x3420
movq %rax, -0x38(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x33f0
testb $0x1, %al
jne 0x2a5a
jmp 0x2b39
leaq -0x20(%rbp), %rdi
callq 0x3630
movl (%rax), %eax
movl %eax, -0x54(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3450
movq %rax, %rcx
movl -0x54(%rbp), %eax
cmpl 0x20(%rcx), %eax
jbe 0x2a81
jmp 0x2b25
movq 0x86d8(%rip), %rax      # 0xb160
movq %rax, -0x78(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3450
movq (%rax), %rax
movq %rax, -0x70(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x3630
movl (%rax), %eax
movl %eax, -0x64(%rbp)
movq 0x86af(%rip), %rax      # 0xb160
movq 0xe8(%rax), %rax
movq 0x86a1(%rip), %rcx      # 0xb160
movslq 0xe0(%rcx), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq %rax, -0x60(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3450
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rsi
movl -0x64(%rbp), %edx
movq -0x60(%rbp), %r9
addq $0x8, %rax
movl $0x8000, %ecx           # imm = 0x8000
xorl %r8d, %r8d
xorl %r10d, %r10d
movl $0x0, (%rsp)
movl $0x2, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movl $0x1, 0x18(%rsp)
movl $0x1, 0x20(%rsp)
callq 0x2200
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
callq 0x3570
movq %rax, -0x40(%rbp)
jmp 0x2a34
jmp 0x2b3b
leaq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0x3650
movq %rax, -0x48(%rbp)
jmp 0x2979
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax,%rax)