#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 */
char **event_get_supported_methods();
int /*<<< orphan*/ printf(char *, ...);
void methods() {
  int i;
  const char **methods;
  methods = event_get_supported_methods();
  printf("support methods:\n");
  for (i = 0; methods[i] != NULL; i++)
    printf("    %s\n", methods[i]);
}


x86 assembly (clang, -O0):
<methods>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <event_get_supported_methods@plt>
mov    %rax,-0x10(%rbp)
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1183 <methods+0x63>
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1148 <methods+0x28>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<methods>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <event_get_supported_methods@plt>
mov    %rax,%rbx
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%rsi
test   %rsi,%rsi
je     1176 <methods+0x46>
add    $0x8,%rbx
lea    0xea3(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1160 <methods+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c"support methods:\0A\00"
@.str.1 = [8 x i8] c" %s\0A\00"
define void @methods() {
%1 = alloca i32
%2 = alloca i8**
%3 = call i8** (...) @event_get_supported_methods()
store i8** %3, i8*** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %5
5: ; preds = %19, %0
%6 = load i8**, i8*** %2
%7 = load i32, i32* %1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8*, i8** %6, i64 %8
%10 = load i8*, i8** %9
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %22
12: ; preds = %5
%13 = load i8**, i8*** %2
%14 = load i32, i32* %1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %13, i64 %15
%17 = load i8*, i8** %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %17)
br label %19
19: ; preds = %12
%20 = load i32, i32* %1
%21 = add nsw i32 %20, 1
store i32 %21, i32* %1
br label %5
22: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c" %s\0A\00"
@str = [17 x i8] c"support methods:\00"
define void @methods() {
%1 = tail call i8** (...) @event_get_supported_methods()
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%3 = load i8*, i8** %1
%4 = icmp eq i8* %3, null
br i1 %4, label %13, label %5
5: ; preds = %0, %5
%6 = phi i64 [ %9, %5 ], [ 0, %0 ]
%7 = phi i8* [ %11, %5 ], [ %3, %0 ]
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = add nuw i64 %6, 1
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %5
13: ; preds = %5, %0
ret void
}