#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 */
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  int /*<<< orphan*/ top;
};
typedef TYPE_1__ ERR_STATE;

/* Variables and functions */
TYPE_1__ *err_get_state_int();
int /*<<< orphan*/ err_set_debug(TYPE_1__ *, int /*<<< orphan*/, char const *,
                                 int, char const *);
void ERR_set_debug(const char *file, int line, const char *func) {
  ERR_STATE *es;
  es = err_get_state_int();
  if (es == NULL)
    return;
  err_set_debug(es, es->top, file, line, func);
}


x86 assembly (clang, -O0):
<ERR_set_debug>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1040 <err_get_state_int@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    114e <ERR_set_debug+0x2e>
jmp    1168 <ERR_set_debug+0x48>
mov    -0x20(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%r8
call   1030 <err_set_debug@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ERR_set_debug>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <err_get_state_int@plt>
test   %rax,%rax
je     114e <ERR_set_debug+0x2e>
mov    (%rax),%esi
mov    %rax,%rdi
mov    %rbx,%rdx
mov    %ebp,%ecx
mov    %r14,%r8
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <err_set_debug@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { i32 }
define void @ERR_set_debug(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca %struct.TYPE_4__*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = call %struct.TYPE_4__* (...) @err_get_state_int()
store %struct.TYPE_4__* %8, %struct.TYPE_4__** %7
%9 = load %struct.TYPE_4__*, %struct.TYPE_4__** %7
%10 = icmp eq %struct.TYPE_4__* %9, null
br i1 %10, label %11, label %12
11: ; preds = %3
br label %21
12: ; preds = %3
%13 = load %struct.TYPE_4__*, %struct.TYPE_4__** %7
%14 = load %struct.TYPE_4__*, %struct.TYPE_4__** %7
%15 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %14, i32 0, i32 0
%16 = load i32, i32* %15
%17 = load i8*, i8** %4
%18 = load i32, i32* %5
%19 = load i8*, i8** %6
%20 = call i32 @err_set_debug(%struct.TYPE_4__* %13, i32 %16, i8* %17, i32 %18, i8* %19)
br label %21
21: ; preds = %12, %11
ret void
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { i32 }
define void @ERR_set_debug(i8* %0, i32 %1, i8* %2) {
%4 = tail call %struct.TYPE_4__* (...) @err_get_state_int()
%5 = icmp eq %struct.TYPE_4__* %4, null
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i64 0, i32 0
%8 = load i32, i32* %7
%9 = tail call i32 @err_set_debug(%struct.TYPE_4__* %4, i32 %8, i8* %0, i32 %1, i8* %2)
br label %10
10: ; preds = %3, %6
ret void
}