#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*/ FILE;

/* Variables and functions */
unsigned long CRYPTO_thread_id();
int ERR_TXT_STRING;
int /*<<< orphan*/ ERR_error_string(unsigned long, char *);
unsigned long ERR_get_error_line_data(char const **, int *, char const **,
                                      int *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, unsigned long,
                           int /*<<< orphan*/, char const *, int, char const *);
void ERR_print_errors_fp(FILE *fp) {
  unsigned long l;
  char buf[200];
  const char *file, *data;
  int line, flags;
  unsigned long es;
  es = CRYPTO_thread_id();
  while ((l = ERR_get_error_line_data(&file, &line, &data, &flags)) != 0) {
    fprintf(fp, "%lu:%s:%s:%d:%s\n", es, ERR_error_string(l, buf), file, line,
            (flags & ERR_TXT_STRING) ? data : "");
  }
}


x86 assembly (clang, -O0):
<ERR_print_errors_fp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1050 <CRYPTO_thread_id@plt>
mov    %rax,-0x100(%rbp)
lea    -0xe8(%rbp),%rdi
lea    -0xf4(%rbp),%rsi
lea    -0xf0(%rbp),%rdx
lea    -0xf8(%rbp),%rcx
call   1060 <ERR_get_error_line_data@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1251 <ERR_print_errors_fp+0x111>
mov    -0x8(%rbp),%rax
mov    %rax,-0x128(%rbp)
mov    -0x100(%rbp),%rax
mov    %rax,-0x120(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1040 <ERR_error_string@plt>
mov    %eax,-0x114(%rbp)
mov    -0xe8(%rbp),%rax
mov    %rax,-0x110(%rbp)
mov    -0xf4(%rbp),%eax
mov    %eax,-0x104(%rbp)
mov    -0xf8(%rbp),%eax
mov    0x2e16(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1200 <ERR_print_errors_fp+0xc0>
mov    -0xf0(%rbp),%rax
mov    %rax,-0x130(%rbp)
jmp    1213 <ERR_print_errors_fp+0xd3>
lea    0xe09(%rip),%rax
mov    %rax,-0x130(%rbp)
jmp    1213 <ERR_print_errors_fp+0xd3>
mov    -0x104(%rbp),%r9d
mov    -0x110(%rbp),%r8
mov    -0x114(%rbp),%ecx
mov    -0x120(%rbp),%rdx
mov    -0x128(%rbp),%rdi
mov    -0x130(%rbp),%rax
lea    0xdbd(%rip),%rsi
mov    %rax,(%rsp)
call   1030 <fprintf@plt>
jmp    115d <ERR_print_errors_fp+0x1d>
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ERR_print_errors_fp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
mov    %rdi,%r14
xor    %eax,%eax
call   1050 <CRYPTO_thread_id@plt>
mov    %rax,%rbx
lea    0x18(%rsp),%rdi
lea    0xc(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1060 <ERR_get_error_line_data@plt>
test   %rax,%rax
je     1202 <ERR_print_errors_fp+0xc2>
lea    0x18(%rsp),%r13
lea    0xc(%rsp),%rbp
lea    0x10(%rsp),%r15
lea    0x8(%rsp),%r12
jmp    11d8 <ERR_print_errors_fp+0x98>
cs nopw 0x0(%rax,%rax,1)
mov    0x18(%rsp),%r8
mov    0xc(%rsp),%r9d
mov    %rcx,(%rsp)
mov    %r14,%rdi
lea    0xe48(%rip),%rsi
mov    %rbx,%rdx
mov    %eax,%ecx
call   1030 <fprintf@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1060 <ERR_get_error_line_data@plt>
test   %rax,%rax
je     1202 <ERR_print_errors_fp+0xc2>
mov    %rax,%rdi
lea    0x20(%rsp),%rsi
call   1040 <ERR_error_string@plt>
mov    0x2e0c(%rip),%rcx
mov    (%rcx),%edx
lea    0xe1b(%rip),%rcx
and    0x8(%rsp),%edx
je     11a0 <ERR_print_errors_fp+0x60>
mov    0x10(%rsp),%rcx
jmp    11a0 <ERR_print_errors_fp+0x60>
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"%lu:%s:%s:%d:%s\0A\00"
@ERR_TXT_STRING = global i32 0
@.str.1 = [1 x i8] zeroinitializer
define void @ERR_print_errors_fp(i32* %0) {
%2 = alloca i32*
%3 = alloca i64
%4 = alloca [200 x i8]
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
store i32* %0, i32** %2
%10 = call i64 (...) @CRYPTO_thread_id()
store i64 %10, i64* %9
br label %11
11: ; preds = %29, %1
%12 = call i64 @ERR_get_error_line_data(i8** %5, i32* %7, i8** %6, i32* %8)
store i64 %12, i64* %3
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %32
14: ; preds = %11
%15 = load i32*, i32** %2
%16 = load i64, i64* %9
%17 = load i64, i64* %3
%18 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%19 = call i32 @ERR_error_string(i64 %17, i8* %18)
%20 = load i8*, i8** %5
%21 = load i32, i32* %7
%22 = load i32, i32* %8
%23 = load i32, i32* @ERR_TXT_STRING
%24 = and i32 %22, %23
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %14
%27 = load i8*, i8** %6
br label %29
28: ; preds = %14
br label %29
29: ; preds = %28, %26
%30 = phi i8* [ %27, %26 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %28 ]
%31 = call i32 @fprintf(i32* %15, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 %16, i32 %19, i8* %20, i32 %21, i8* %30)
br label %11
32: ; preds = %11
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"%lu:%s:%s:%d:%s\0A\00"
@ERR_TXT_STRING = global i32 0
@.str.1 = [1 x i8] zeroinitializer
define void @ERR_print_errors_fp(i32* nocapture %0) {
%2 = alloca [200 x i8]
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%8 = bitcast i8** %3 to i8*
%9 = bitcast i8** %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = bitcast i32* %6 to i8*
%12 = tail call i64 (...) @CRYPTO_thread_id()
%13 = call i64 @ERR_get_error_line_data(i8** %3, i32* %5, i8** %4, i32* %6)
%14 = icmp eq i64 %13, 0
br i1 %14, label %29, label %15
15: ; preds = %1, %15
%16 = phi i64 [ %27, %15 ], [ %13, %1 ]
%17 = call i32 @ERR_error_string(i64 %16, i8* %7)
%18 = load i8*, i8** %3
%19 = load i32, i32* %5
%20 = load i32, i32* %6
%21 = load i32, i32* @ERR_TXT_STRING
%22 = and i32 %21, %20
%23 = icmp eq i32 %22, 0
%24 = load i8*, i8** %4
%25 = select i1 %23, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %24
%26 = call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 %12, i32 %17, i8* %18, i32 %19, i8* %25)
%27 = call i64 @ERR_get_error_line_data(i8** %3, i32* %5, i8** %4, i32* %6)
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %15
29: ; preds = %15, %1
ret void
}