#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__ mpg123_decoders();
int /*<<< orphan*/ mpg123_exit();
int /*<<< orphan*/ mpg123_init();
int /*<<< orphan*/ printf(char *, char *);
int main() {
  mpg123_init();
  char **decoders = (char **)mpg123_decoders();
  while (*decoders != NULL) {
    printf("%s\n", *decoders);
    decoders++;
  }
  mpg123_exit();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <mpg123_init@plt>
mov    $0x0,%al
call   1030 <mpg123_decoders@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1193 <main+0x53>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe83(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1161 <main+0x21>
mov    $0x0,%al
call   1050 <mpg123_exit@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1060 <mpg123_init@plt>
xor    %eax,%eax
call   1030 <mpg123_decoders@plt>
mov    (%rax),%rsi
test   %rsi,%rsi
je     1184 <main+0x44>
mov    %rax,%rbx
add    $0x8,%rbx
lea    0xe98(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <printf@plt>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1170 <main+0x30>
xor    %eax,%eax
call   1050 <mpg123_exit@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @mpg123_init()
%2 = tail call i64 (...) @mpg123_decoders()
%3 = inttoptr i64 %2 to i8**
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %13, label %6
6: ; preds = %0, %6
%7 = phi i8* [ %11, %6 ], [ %4, %0 ]
%8 = phi i8** [ %10, %6 ], [ %3, %0 ]
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
%10 = getelementptr inbounds i8*, i8** %8, i64 1
%11 = load i8*, i8** %10
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %6
13: ; preds = %6, %0
%14 = tail call i32 (...) @mpg123_exit()
ret i32 0
}