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

/* Variables and functions */
unsigned char *OPENSSL_malloc(int);
int SSL_TLSEXT_ERR_ALERT_FATAL;
int SSL_TLSEXT_ERR_OK;
int /*<<< orphan*/ SSL_set_tlsext_status_ocsp_resp(int /*<<< orphan*/ *,
                                                   unsigned char *, int);
int server_ocsp_cb(SSL *s, void *arg) {
  unsigned char *resp;
  resp = OPENSSL_malloc(1);
  if (resp == NULL)
    return SSL_TLSEXT_ERR_ALERT_FATAL;
  *resp = *(unsigned char *)arg;
  if (!SSL_set_tlsext_status_ocsp_resp(s, resp, 1))
    return SSL_TLSEXT_ERR_ALERT_FATAL;
  return SSL_TLSEXT_ERR_OK;
}


x86 assembly (clang, -O0):
<server_ocsp_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    $0x1,%edi
call   1030 <OPENSSL_malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    115a <server_ocsp_cb+0x3a>
mov    0x2e88(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    119e <server_ocsp_cb+0x7e>
mov    -0x18(%rbp),%rax
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x1,%edx
call   1040 <SSL_set_tlsext_status_ocsp_resp@plt>
cmp    $0x0,%eax
jne    1192 <server_ocsp_cb+0x72>
mov    0x2e50(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    119e <server_ocsp_cb+0x7e>
mov    0x2e5f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<server_ocsp_cb>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    $0x1,%edi
call   1030 <OPENSSL_malloc@plt>
test   %rax,%rax
je     1151 <server_ocsp_cb+0x31>
mov    (%rbx),%cl
mov    %cl,(%rax)
mov    %r14,%rdi
mov    %rax,%rsi
mov    $0x1,%edx
call   1040 <SSL_set_tlsext_status_ocsp_resp@plt>
test   %eax,%eax
jne    115a <server_ocsp_cb+0x3a>
mov    0x2e80(%rip),%rax
jmp    1161 <server_ocsp_cb+0x41>
mov    0x2e97(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@SSL_TLSEXT_ERR_ALERT_FATAL = global i32 0
@SSL_TLSEXT_ERR_OK = global i32 0
define i32 @server_ocsp_cb(i32* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
store i32* %0, i32** %4
store i8* %1, i8** %5
%7 = call i8* @OPENSSL_malloc(i32 1)
store i8* %7, i8** %6
%8 = load i8*, i8** %6
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load i32, i32* @SSL_TLSEXT_ERR_ALERT_FATAL
store i32 %11, i32* %3
br label %24
12: ; preds = %2
%13 = load i8*, i8** %5
%14 = load i8, i8* %13
%15 = load i8*, i8** %6
store i8 %14, i8* %15
%16 = load i32*, i32** %4
%17 = load i8*, i8** %6
%18 = call i32 @SSL_set_tlsext_status_ocsp_resp(i32* %16, i8* %17, i32 1)
%19 = icmp ne i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %12
%21 = load i32, i32* @SSL_TLSEXT_ERR_ALERT_FATAL
store i32 %21, i32* %3
br label %24
22: ; preds = %12
%23 = load i32, i32* @SSL_TLSEXT_ERR_OK
store i32 %23, i32* %3
br label %24
24: ; preds = %22, %20, %10
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
@SSL_TLSEXT_ERR_ALERT_FATAL = global i32 0
@SSL_TLSEXT_ERR_OK = global i32 0
define i32 @server_ocsp_cb(i32* %0, i8* nocapture %1) {
%3 = tail call i8* @OPENSSL_malloc(i32 1)
%4 = icmp eq i8* %3, null
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = load i8, i8* %1
store i8 %6, i8* %3
%7 = tail call i32 @SSL_set_tlsext_status_ocsp_resp(i32* %0, i8* %3, i32 1)
%8 = icmp eq i32 %7, 0
%9 = select i1 %8, i32* @SSL_TLSEXT_ERR_ALERT_FATAL, i32* @SSL_TLSEXT_ERR_OK
br label %10
10: ; preds = %5, %2
%11 = phi i32* [ @SSL_TLSEXT_ERR_ALERT_FATAL, %2 ], [ %9, %5 ]
%12 = load i32, i32* %11
ret i32 %12
}