#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_set_id(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ ENGINE_set_name(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ printf(char *);
int simple_engine_bind(ENGINE *e, const char *id) {
  printf("Loading simple engine!\n");
  if (!ENGINE_set_id(e, "simple") || !ENGINE_set_name(e, "simple engine")) {
    return 0;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<simple_engine_bind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    0xec1(%rip),%rsi
call   1050 <ENGINE_set_id@plt>
cmp    $0x0,%eax
je     117e <simple_engine_bind+0x4e>
mov    -0x10(%rbp),%rdi
lea    0xeaf(%rip),%rsi
call   1040 <ENGINE_set_name@plt>
cmp    $0x0,%eax
jne    118a <simple_engine_bind+0x5a>
movl   $0x0,-0x4(%rbp)
jmp    1191 <simple_engine_bind+0x61>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<simple_engine_bind>:
push   %rbx
mov    %rdi,%rbx
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rsi
mov    %rbx,%rdi
call   1050 <ENGINE_set_id@plt>
test   %eax,%eax
je     116d <simple_engine_bind+0x3d>
lea    0xead(%rip),%rsi
mov    %rbx,%rdi
call   1040 <ENGINE_set_name@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
setne  %al
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Loading simple engine!\0A\00"
@.str.1 = [7 x i8] c"simple\00"
@.str.2 = [14 x i8] c"simple engine\00"
define i32 @simple_engine_bind(i32* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8*
store i32* %0, i32** %4
store i8* %1, i8** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%7 = load i32*, i32** %4
%8 = call i32 @ENGINE_set_id(i32* %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i32*, i32** %4
%12 = call i32 @ENGINE_set_name(i32* %11, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp ne i32 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %10, %2
store i32 0, i32* %3
br label %16
15: ; preds = %10
store i32 1, i32* %3
br label %16
16: ; preds = %15, %14
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"simple\00"
@.str.2 = [14 x i8] c"simple engine\00"
@str = [23 x i8] c"Loading simple engine!\00"
define i32 @simple_engine_bind(i32* %0, i8* nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @ENGINE_set_id(i32* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = tail call i32 @ENGINE_set_name(i32* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %2
%11 = phi i32 [ 0, %2 ], [ %9, %6 ]
ret i32 %11
}