#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 */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int, ...);
scalar_t__ rmap_event(unsigned int, char **, char **);
unsigned int strtoul(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(int ac, char **av) {
  while (*++av) {
    unsigned event = strtoul(*av, NULL, 0);
    char *name, *desc;
    if (rmap_event(event, &name, &desc) == 0)
      printf("%x: %s : %s\n", event, name, desc);
    else
      printf("%x not found\n", event);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
cmpq   $0x0,0x8(%rax)
je     11c3 <main+0x93>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1040 <strtoul@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1050 <rmap_event@plt>
cmp    $0x0,%rax
jne    11ad <main+0x7d>
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11be <main+0x8e>
mov    -0x14(%rbp),%esi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    0x8(%rsi),%rdi
test   %rdi,%rdi
je     11bd <main+0x8d>
mov    %rsi,%rbx
add    $0x10,%rbx
lea    0x10(%rsp),%r14
lea    0x8(%rsp),%r15
lea    0xea1(%rip),%r12
lea    0xea7(%rip),%r13
jmp    1188 <main+0x58>
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
je     11bd <main+0x8d>
xor    %esi,%esi
xor    %edx,%edx
call   1040 <strtoul@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <rmap_event@plt>
test   %rax,%rax
jne    1170 <main+0x40>
mov    0x10(%rsp),%rdx
mov    0x8(%rsp),%rcx
mov    %r12,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    117c <main+0x4c>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"%x: %s : %s\0A\00"
@.str.1 = [14 x i8] c"%x not found\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %9
9: ; preds = %29, %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i32 1
store i8** %11, i8*** %5
%12 = load i8*, i8** %11
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %30
14: ; preds = %9
%15 = load i8**, i8*** %5
%16 = load i8*, i8** %15
%17 = call i32 @strtoul(i8* %16, i32* null, i32 0)
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = call i64 @rmap_event(i32 %18, i8** %7, i8** %8)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %26
21: ; preds = %14
%22 = load i32, i32* %6
%23 = load i8*, i8** %7
%24 = load i8*, i8** %8
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %22, i8* %23, i8* %24)
br label %29
26: ; preds = %14
%27 = load i32, i32* %6
%28 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %26, %21
br label %9
30: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"%x: %s : %s\0A\00"
@.str.1 = [14 x i8] c"%x not found\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = icmp eq i8* %6, null
br i1 %7, label %27, label %8
8: ; preds = %2
%9 = bitcast i8** %3 to i8*
%10 = bitcast i8** %4 to i8*
br label %11
11: ; preds = %8, %23
%12 = phi i8* [ %6, %8 ], [ %25, %23 ]
%13 = phi i8** [ %5, %8 ], [ %24, %23 ]
%14 = call i32 @strtoul(i8* nocapture %12, i32* null, i32 0)
%15 = call i64 @rmap_event(i32 %14, i8** %3, i8** %4)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %11
%18 = load i8*, i8** %3
%19 = load i8*, i8** %4
%20 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %14, i8* %18, i8* %19)
br label %23
21: ; preds = %11
%22 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %14)
br label %23
23: ; preds = %21, %17
%24 = getelementptr inbounds i8*, i8** %13, i64 1
%25 = load i8*, i8** %24
%26 = icmp eq i8* %25, null
br i1 %26, label %27, label %11
27: ; preds = %23, %2
ret i32 0
}