#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 */
size_t libgamma_list_methods(int *, int, int);
char *method_name(int);
int /*<<< orphan*/ printf(char *, ...);
void list_methods(const char *description, int *methods, int operation) {
  size_t i, n = libgamma_list_methods(methods, 6, operation);
  printf("%s:", description);
  for (i = 0; i < n; i++)
    printf(" %s", method_name(methods[i]));
  printf("\n");
}


x86 assembly (clang, -O0):
<list_methods>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    $0x6,%esi
call   1040 <libgamma_list_methods@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    11b2 <list_methods+0x82>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1050 <method_name@plt>
mov    %rax,%rsi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1172 <list_methods+0x42>
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_methods>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsi,%rdi
mov    $0x6,%esi
call   1050 <libgamma_list_methods@plt>
mov    %rax,%r12
lea    0xe9b(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r12,%r12
je     119f <list_methods+0x5f>
lea    0xe89(%rip),%r15
xor    %ebx,%ebx
nopl   (%rax)
mov    (%r14,%rbx,4),%edi
call   1060 <method_name@plt>
mov    %r15,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1180 <list_methods+0x40>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

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