#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ *key_vector;
};
typedef TYPE_1__ XKeymapEvent;
typedef int /*<<< orphan*/ XEvent;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void do_KeymapNotify(XEvent *eventp) {
  XKeymapEvent *e = (XKeymapEvent *)eventp;
  int i;
  printf("    keys:  ");
  for (i = 0; i < 32; i++) {
    if (i == 16)
      printf("\n           ");
    printf("%-3u ", (unsigned int)e->key_vector[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<do_KeymapNotify>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x20,-0x14(%rbp)
jge    1188 <do_KeymapNotify+0x78>
cmpl   $0x10,-0x14(%rbp)
jne    115b <do_KeymapNotify+0x4b>
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %eax,%esi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <do_KeymapNotify+0x29>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_KeymapNotify>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r12
lea    0xece(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecc(%rip),%r14
lea    0xed2(%rip),%r15
xor    %ebx,%ebx
jmp    116b <do_KeymapNotify+0x4b>
nopl   0x0(%rax,%rax,1)
mov    (%r12),%rax
mov    (%rax,%rbx,8),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0x20,%rbx
je     117d <do_KeymapNotify+0x5d>
cmp    $0x10,%rbx
jne    1150 <do_KeymapNotify+0x30>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1150 <do_KeymapNotify+0x30>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64* }
@.str = [12 x i8] c" keys: \00"
@.str.1 = [13 x i8] c"\0A \00"
@.str.2 = [6 x i8] c"%-3u \00"
@.str.3 = [2 x i8] c"\0A\00"
define void @do_KeymapNotify(i32* %0) {
%2 = alloca i32*
%3 = alloca %struct.TYPE_2__*
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = bitcast i32* %5 to %struct.TYPE_2__*
store %struct.TYPE_2__* %6, %struct.TYPE_2__** %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %8
8: ; preds = %26, %1
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 32
br i1 %10, label %11, label %29
11: ; preds = %8
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 16
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %11
%17 = load %struct.TYPE_2__*, %struct.TYPE_2__** %3
%18 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %17, i32 0, i32 0
%19 = load i64*, i64** %18
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i64, i64* %19, i64 %21
%23 = load i64, i64* %22
%24 = trunc i64 %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %16
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %8
29: ; preds = %8
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c" keys: \00"
@.str.1 = [13 x i8] c"\0A \00"
@.str.2 = [6 x i8] c"%-3u \00"
define void @do_KeymapNotify(i32* nocapture %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = bitcast i32* %0 to i64**
br label %4
4: ; preds = %1, %9
%5 = phi i64 [ 0, %1 ], [ %15, %9 ]
%6 = icmp eq i64 %5, 16
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %7, %4
%10 = load i64*, i64** %3
%11 = getelementptr inbounds i64, i64* %10, i64 %5
%12 = load i64, i64* %11
%13 = trunc i64 %12 to i32
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = add nuw nsw i64 %5, 1
%16 = icmp eq i64 %15, 32
br i1 %16, label %17, label %4
17: ; preds = %9
%18 = tail call i32 @putchar(i32 10)
ret void
}