#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 */
scalar_t__ libgamma_is_method_available(int);
char *method_name(int);
int /*<<< orphan*/ printf(char *, ...);
void method_availability(void) {
  int method;
  printf("Testing the availability of a non-existing adjustment method: ");
  printf("%s\n",
         libgamma_is_method_available(-1) ? "available" : "not available");
  for (method = 0; method < 6; method++) {
    printf("Testing the availability of %s: ", method_name(method));
    printf("%s\n", libgamma_is_method_available(method) ? "available"
                                                        : "not available");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<method_availability>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <libgamma_is_method_available@plt>
mov    %rax,%rcx
lea    0xee9(%rip),%rsi
lea    0xee6(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x6,-0x4(%rbp)
jge    11de <method_availability+0xae>
mov    -0x4(%rbp),%edi
call   1050 <method_name@plt>
mov    %rax,%rsi
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <libgamma_is_method_available@plt>
mov    %rax,%rcx
lea    0xe90(%rip),%rsi
lea    0xe8d(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    117e <method_availability+0x4e>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<method_availability>:
push   %r15
push   %r14
push   %rbx
lea    0xea4(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   1060 <libgamma_is_method_available@plt>
test   %rax,%rax
lea    0xec8(%rip),%r15
lea    0xec5(%rip),%rbx
mov    %rbx,%rdi
cmove  %r15,%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1070 <method_name@plt>
lea    0xeb5(%rip),%r14
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
call   1060 <libgamma_is_method_available@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmove  %r15,%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1070 <method_name@plt>
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%edi
call   1060 <libgamma_is_method_available@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmove  %r15,%rdi
call   1040 <puts@plt>
mov    $0x2,%edi
call   1070 <method_name@plt>
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x2,%edi
call   1060 <libgamma_is_method_available@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmove  %r15,%rdi
call   1040 <puts@plt>
mov    $0x3,%edi
call   1070 <method_name@plt>
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x3,%edi
call   1060 <libgamma_is_method_available@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmove  %r15,%rdi
call   1040 <puts@plt>
mov    $0x4,%edi
call   1070 <method_name@plt>
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x4,%edi
call   1060 <libgamma_is_method_available@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmove  %r15,%rdi
call   1040 <puts@plt>
mov    $0x5,%edi
call   1070 <method_name@plt>
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x5,%edi
call   1060 <libgamma_is_method_available@plt>
test   %rax,%rax
cmove  %r15,%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [63 x i8] c"Testing the availability of a non-existing adjustment method: \00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [10 x i8] c"available\00"
@.str.3 = [14 x i8] c"not available\00"
@.str.4 = [33 x i8] c"Testing the availability of %s: \00"
@.str.5 = [2 x i8] c"\0A\00"
define void @method_availability() {
%1 = alloca i32
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%3 = call i64 @libgamma_is_method_available(i32 -1)
%4 = icmp ne i64 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %6)
store i32 0, i32* %1
br label %8
8: ; preds = %21, %0
%9 = load i32, i32* %1
%10 = icmp slt i32 %9, 6
br i1 %10, label %11, label %24
11: ; preds = %8
%12 = load i32, i32* %1
%13 = call i8* @method_name(i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* %13)
%15 = load i32, i32* %1
%16 = call i64 @libgamma_is_method_available(i32 %15)
%17 = icmp ne i64 %16, 0
%18 = zext i1 %17 to i64
%19 = select i1 %17, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %11
%22 = load i32, i32* %1
%23 = add nsw i32 %22, 1
store i32 %23, i32* %1
br label %8
24: ; preds = %8
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [63 x i8] c"Testing the availability of a non-existing adjustment method: \00"
@.str.2 = [10 x i8] c"available\00"
@.str.3 = [14 x i8] c"not available\00"
@.str.4 = [33 x i8] c"Testing the availability of %s: \00"
define void @method_availability() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%2 = tail call i64 @libgamma_is_method_available(i32 -1)
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0)
%5 = tail call i32 @puts(i8* dereferenceable(1) %4)
%6 = tail call i8* @method_name(i32 0)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* %6)
%8 = tail call i64 @libgamma_is_method_available(i32 0)
%9 = icmp eq i64 %8, 0
%10 = select i1 %9, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0)
%11 = tail call i32 @puts(i8* dereferenceable(1) %10)
%12 = tail call i8* @method_name(i32 1)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* %12)
%14 = tail call i64 @libgamma_is_method_available(i32 1)
%15 = icmp eq i64 %14, 0
%16 = select i1 %15, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0)
%17 = tail call i32 @puts(i8* dereferenceable(1) %16)
%18 = tail call i8* @method_name(i32 2)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* %18)
%20 = tail call i64 @libgamma_is_method_available(i32 2)
%21 = icmp eq i64 %20, 0
%22 = select i1 %21, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0)
%23 = tail call i32 @puts(i8* dereferenceable(1) %22)
%24 = tail call i8* @method_name(i32 3)
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* %24)
%26 = tail call i64 @libgamma_is_method_available(i32 3)
%27 = icmp eq i64 %26, 0
%28 = select i1 %27, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0)
%29 = tail call i32 @puts(i8* dereferenceable(1) %28)
%30 = tail call i8* @method_name(i32 4)
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* %30)
%32 = tail call i64 @libgamma_is_method_available(i32 4)
%33 = icmp eq i64 %32, 0
%34 = select i1 %33, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0)
%35 = tail call i32 @puts(i8* dereferenceable(1) %34)
%36 = tail call i8* @method_name(i32 5)
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* %36)
%38 = tail call i64 @libgamma_is_method_available(i32 5)
%39 = icmp eq i64 %38, 0
%40 = select i1 %39, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0)
%41 = tail call i32 @puts(i8* dereferenceable(1) %40)
%42 = tail call i32 @putchar(i32 10)
ret void
}