#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 */
typedef int /*<<< orphan*/ ENGINE;

/* Variables and functions */
int /*<<< orphan*/ *ENGINE_get_first();
char *ENGINE_get_id(int /*<<< orphan*/ *);
char *ENGINE_get_name(int /*<<< orphan*/ *);
int /*<<< orphan*/ *ENGINE_get_next(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
void list_engines(void) {
  ENGINE *eg;
  printf("Engine Listing\n");
  eg = ENGINE_get_first();
  while (eg) {
    printf("'%s' %s\n", ENGINE_get_id(eg), ENGINE_get_name(eg));
    eg = ENGINE_get_next(eg);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<list_engines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <ENGINE_get_first@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11b9 <list_engines+0x69>
mov    -0x8(%rbp),%rdi
call   1070 <ENGINE_get_id@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ENGINE_get_name@plt>
mov    -0x10(%rbp),%rsi
mov    %rax,%rdx
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1050 <ENGINE_get_next@plt>
mov    %rax,-0x8(%rbp)
jmp    1171 <list_engines+0x21>
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_engines>:
push   %r15
push   %r14
push   %rbx
lea    0xe8d(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1080 <ENGINE_get_first@plt>
test   %rax,%rax
je     11d3 <list_engines+0x63>
mov    %rax,%rbx
lea    0xe69(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1090 <ENGINE_get_id@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1050 <ENGINE_get_name@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1070 <ENGINE_get_next@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    11a0 <list_engines+0x30>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"Engine Listing\0A\00"
@.str.1 = [9 x i8] c"'%s' %s\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @list_engines() {
%1 = alloca i32*
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%3 = call i32* (...) @ENGINE_get_first()
store i32* %3, i32** %1
br label %4
4: ; preds = %7, %0
%5 = load i32*, i32** %1
%6 = icmp ne i32* %5, null
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load i32*, i32** %1
%9 = call i8* @ENGINE_get_id(i32* %8)
%10 = load i32*, i32** %1
%11 = call i8* @ENGINE_get_name(i32* %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %9, i8* %11)
%13 = load i32*, i32** %1
%14 = call i32* @ENGINE_get_next(i32* %13)
store i32* %14, i32** %1
br label %4
15: ; preds = %4
%16 = 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.1 = [9 x i8] c"'%s' %s\0A\00"
@str = [15 x i8] c"Engine Listing\00"
define void @list_engines() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%2 = tail call i32* (...) @ENGINE_get_first()
%3 = icmp eq i32* %2, null
br i1 %3, label %11, label %4
4: ; preds = %0, %4
%5 = phi i32* [ %9, %4 ], [ %2, %0 ]
%6 = tail call i8* @ENGINE_get_id(i32* %5)
%7 = tail call i8* @ENGINE_get_name(i32* %5)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %6, i8* %7)
%9 = tail call i32* @ENGINE_get_next(i32* %5)
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %4
11: ; preds = %4, %0
%12 = tail call i32 @putchar(i32 10)
ret void
}