// File: kazzmir[P]xborder/src/main.cpp
// Function: delete_properties(_XDisplay*, unsigned long)
void delete_properties(Display * display, Window window){
    int count = 0;
    Atom * atoms = XListProperties(display, window, &count);
    for (int i = 0; i < count; i++){
        const Atom & atom = atoms[i];
        char * name = XGetAtomName(display, atom);
        std::string sname = name;


        bool destroy = true;
        if (sname == "XKLAVIER_STATE" ||
            sname == "_NET_WM_STATE" ||
            sname == "_NET_FRAME_EXTENTS" ||
            sname == "_NET_WM_DESKTOP" ||
            sname == "WM_NAME"){
            destroy = false;
        }

        if (destroy){
            std::cout << "Delete property '" << name << "'" << std::endl;
        }
        XFree(name);

        if (destroy){
            XDeleteProperty(display, window, atom);
        }
    }
    XFree(atoms);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x14(%rbp), %rdx
callq 0x3460
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x4afb
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
leaq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rsi
callq 0x3690
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0x59(%rbp), %rdi
movq %rdi, -0x78(%rbp)
callq 0x3630
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
leaq -0x58(%rbp), %rdi
callq 0x5bc0
jmp 0x494e
leaq -0x59(%rbp), %rdi
callq 0x33a0
movb $0x1, -0x6d(%rbp)
leaq 0x28ab(%rip), %rsi      # 0x720d
leaq -0x58(%rbp), %rdi
callq 0x5c70
movb %al, -0x81(%rbp)
jmp 0x4973
movb -0x81(%rbp), %al
testb $0x1, %al
jne 0x4a13
jmp 0x4983
leaq 0x2892(%rip), %rsi      # 0x721c
leaq -0x58(%rbp), %rdi
callq 0x5c70
movb %al, -0x82(%rbp)
jmp 0x499b
movb -0x82(%rbp), %al
testb $0x1, %al
jne 0x4a13
jmp 0x49a7
leaq 0x287c(%rip), %rsi      # 0x722a
leaq -0x58(%rbp), %rdi
callq 0x5c70
movb %al, -0x83(%rbp)
jmp 0x49bf
movb -0x83(%rbp), %al
testb $0x1, %al
jne 0x4a13
jmp 0x49cb
leaq 0x286b(%rip), %rsi      # 0x723d
leaq -0x58(%rbp), %rdi
callq 0x5c70
movb %al, -0x84(%rbp)
jmp 0x49e3
movb -0x84(%rbp), %al
testb $0x1, %al
jne 0x4a13
jmp 0x49ef
leaq 0x2857(%rip), %rsi      # 0x724d
leaq -0x58(%rbp), %rdi
callq 0x5c70
movb %al, -0x85(%rbp)
jmp 0x4a07
movb -0x85(%rbp), %al
testb $0x1, %al
jne 0x4a13
jmp 0x4a4d
movb $0x0, -0x6d(%rbp)
jmp 0x4a4d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x59(%rbp), %rdi
callq 0x33a0
jmp 0x4b0d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x31d0
jmp 0x4b0d
testb $0x1, -0x6d(%rbp)
je 0x4abb
movq 0x5576(%rip), %rdi      # 0x9fd0
leaq 0x27f4(%rip), %rsi      # 0x7255
callq 0x3310
movq %rax, -0x90(%rbp)
jmp 0x4a6f
movq -0x90(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x3310
movq %rax, -0x98(%rbp)
jmp 0x4a88
movq -0x98(%rbp), %rdi
leaq 0x27cf(%rip), %rsi      # 0x7265
callq 0x3310
movq %rax, -0xa0(%rbp)
jmp 0x4aa4
movq -0xa0(%rbp), %rdi
movq 0x550e(%rip), %rsi      # 0x9fc0
callq 0x3370
jmp 0x4ab9
jmp 0x4abb
movq -0x38(%rbp), %rdi
callq 0x3430
jmp 0x4ac6
testb $0x1, -0x6d(%rbp)
je 0x4ae4
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rax
movq (%rax), %rdx
callq 0x35f0
jmp 0x4ae2
jmp 0x4ae4
leaq -0x58(%rbp), %rdi
callq 0x31d0
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x48f6
movq -0x20(%rbp), %rdi
callq 0x3430
addq $0xa0, %rsp
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x3620
nopw %cs:(%rax,%rax)