#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*/ TS_VERIFY_CTX;
typedef int /*<<< orphan*/ TS_TST_INFO;
typedef int /*<<< orphan*/ TS_RESP;
typedef int /*<<< orphan*/ PKCS7;

/* Variables and functions */
int /*<<< orphan*/ *TS_RESP_get_token(int /*<<< orphan*/ *);
int /*<<< orphan*/ *TS_RESP_get_tst_info(int /*<<< orphan*/ *);
int /*<<< orphan*/ TS_check_status_info(int /*<<< orphan*/ *);
int /*<<< orphan*/ int_TS_RESP_verify_token(int /*<<< orphan*/ *,
                                            int /*<<< orphan*/ *,
                                            int /*<<< orphan*/ *);
int TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response) {
  PKCS7 *token = TS_RESP_get_token(response);
  TS_TST_INFO *tst_info = TS_RESP_get_tst_info(response);
  int ret = 0;
  if (!TS_check_status_info(response))
    goto err;
  if (!int_TS_RESP_verify_token(ctx, token, tst_info))
    goto err;
  ret = 1;
err:
  return ret;
}


x86 assembly (clang, -O0):
<TS_RESP_verify_response>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <TS_RESP_get_token@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <TS_RESP_get_tst_info@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <TS_check_status_info@plt>
cmp    $0x0,%eax
jne    1188 <TS_RESP_verify_response+0x48>
jmp    11ae <TS_RESP_verify_response+0x6e>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <int_TS_RESP_verify_token@plt>
cmp    $0x0,%eax
jne    11a7 <TS_RESP_verify_response+0x67>
jmp    11ae <TS_RESP_verify_response+0x6e>
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TS_RESP_verify_response>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1050 <TS_RESP_get_token@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1060 <TS_RESP_get_tst_info@plt>
mov    %rax,%r12
mov    %rbx,%rdi
call   1030 <TS_check_status_info@plt>
test   %eax,%eax
je     1189 <TS_RESP_verify_response+0x49>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1040 <int_TS_RESP_verify_token@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
setne  %al
jmp    118b <TS_RESP_verify_response+0x4b>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @TS_RESP_verify_response(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%8 = load i32*, i32** %4
%9 = call i32* @TS_RESP_get_token(i32* %8)
store i32* %9, i32** %5
%10 = load i32*, i32** %4
%11 = call i32* @TS_RESP_get_tst_info(i32* %10)
store i32* %11, i32** %6
store i32 0, i32* %7
%12 = load i32*, i32** %4
%13 = call i32 @TS_check_status_info(i32* %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %2
br label %24
16: ; preds = %2
%17 = load i32*, i32** %3
%18 = load i32*, i32** %5
%19 = load i32*, i32** %6
%20 = call i32 @int_TS_RESP_verify_token(i32* %17, i32* %18, i32* %19)
%21 = icmp ne i32 %20, 0
br i1 %21, label %23, label %22
22: ; preds = %16
br label %24
23: ; preds = %16
store i32 1, i32* %7
br label %24
24: ; preds = %23, %22, %15
%25 = load i32, i32* %7
ret i32 %25
}

LLVM IR (-O2):
define i32 @TS_RESP_verify_response(i32* %0, i32* %1) {
%3 = tail call i32* @TS_RESP_get_token(i32* %1)
%4 = tail call i32* @TS_RESP_get_tst_info(i32* %1)
%5 = tail call i32 @TS_check_status_info(i32* %1)
%6 = icmp eq i32 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %2
%8 = tail call i32 @int_TS_RESP_verify_token(i32* %0, i32* %3, i32* %4)
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %7, %2
%12 = phi i32 [ 0, %2 ], [ %10, %7 ]
ret i32 %12
}