#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_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int max_keypermod;
  scalar_t__ *modifiermap;
};
typedef TYPE_1__ XModifierKeymap;
typedef scalar_t__ KeyCode;

/* Variables and functions */
int ClearModifier(XModifierKeymap **mapp, int modifier) {
  int i;
  XModifierKeymap *map = *mapp;
  KeyCode *kcp;
  kcp = &map->modifiermap[modifier * map->max_keypermod];
  for (i = 0; i < map->max_keypermod; i++) {
    *kcp++ = (KeyCode)0;
  }
  return (0);
}


x86 assembly (clang, -O0):
<ClearModifier>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%rdx
imul   (%rdx),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    1170 <ClearModifier+0x70>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x20(%rbp)
movq   $0x0,(%rax)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113d <ClearModifier+0x3d>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ClearModifier>:
push   %rax
mov    (%rdi),%rax
mov    (%rax),%edx
test   %edx,%edx
jle    1133 <ClearModifier+0x23>
imul   %edx,%esi
movslq %esi,%rdi
shl    $0x3,%rdi
add    0x8(%rax),%rdi
shl    $0x3,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i64* }
define i32 @ClearModifier(%struct.TYPE_3__** %0, i32 %1) {
%3 = alloca %struct.TYPE_3__**
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.TYPE_3__*
%7 = alloca i64*
store %struct.TYPE_3__** %0, %struct.TYPE_3__*** %3
store i32 %1, i32* %4
%8 = load %struct.TYPE_3__**, %struct.TYPE_3__*** %3
%9 = load %struct.TYPE_3__*, %struct.TYPE_3__** %8
store %struct.TYPE_3__* %9, %struct.TYPE_3__** %6
%10 = load %struct.TYPE_3__*, %struct.TYPE_3__** %6
%11 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i32 0, i32 1
%12 = load i64*, i64** %11
%13 = load i32, i32* %4
%14 = load %struct.TYPE_3__*, %struct.TYPE_3__** %6
%15 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %14, i32 0, i32 0
%16 = load i32, i32* %15
%17 = mul nsw i32 %13, %16
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i64, i64* %12, i64 %18
store i64* %19, i64** %7
store i32 0, i32* %5
br label %20
20: ; preds = %29, %2
%21 = load i32, i32* %5
%22 = load %struct.TYPE_3__*, %struct.TYPE_3__** %6
%23 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %22, i32 0, i32 0
%24 = load i32, i32* %23
%25 = icmp slt i32 %21, %24
br i1 %25, label %26, label %32
26: ; preds = %20
%27 = load i64*, i64** %7
%28 = getelementptr inbounds i64, i64* %27, i32 1
store i64* %28, i64** %7
store i64 0, i64* %27
br label %29
29: ; preds = %26
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %20
32: ; preds = %20
ret i32 0
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i64* }
define i32 @ClearModifier(%struct.TYPE_3__** nocapture %0, i32 %1) {
%3 = load %struct.TYPE_3__*, %struct.TYPE_3__** %0
%4 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i64 0, i32 0
%5 = load i32, i32* %4
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %2
%8 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i64 0, i32 1
%9 = load i64*, i64** %8
%10 = mul nsw i32 %5, %1
%11 = sext i32 %10 to i64
%12 = getelementptr i64, i64* %9, i64 %11
%13 = bitcast i64* %12 to i8*
%14 = zext i32 %5 to i64
%15 = shl nuw nsw i64 %14, 3
br label %16
16: ; preds = %7, %2
ret i32 0
}