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

/* Variables and functions */
int /*<<< orphan*/ PKCS7_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *PKCS7_new();
int /*<<< orphan*/ PKCS7_set_content(int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *);
int /*<<< orphan*/ PKCS7_set_type(int /*<<< orphan*/ *, int);
int PKCS7_content_new(PKCS7 *p7, int type) {
  PKCS7 *ret = NULL;
  if ((ret = PKCS7_new()) == NULL)
    goto err;
  if (!PKCS7_set_type(ret, type))
    goto err;
  if (!PKCS7_set_content(p7, ret))
    goto err;
  return (1);
err:
  if (ret != NULL)
    PKCS7_free(ret);
  return (0);
}


x86 assembly (clang, -O0):
<PKCS7_content_new>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
mov    $0x0,%al
call   1030 <PKCS7_new@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1171 <PKCS7_content_new+0x31>
jmp    11b2 <PKCS7_content_new+0x72>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1060 <PKCS7_set_type@plt>
cmp    $0x0,%eax
jne    118b <PKCS7_content_new+0x4b>
jmp    11b2 <PKCS7_content_new+0x72>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <PKCS7_set_content@plt>
cmp    $0x0,%eax
jne    11a6 <PKCS7_content_new+0x66>
jmp    11b2 <PKCS7_content_new+0x72>
movl   $0x1,-0x4(%rbp)
jmp    11cd <PKCS7_content_new+0x8d>
cmpq   $0x0,-0x20(%rbp)
je     11c6 <PKCS7_content_new+0x86>
mov    -0x20(%rbp),%rdi
call   1050 <PKCS7_free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PKCS7_content_new>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%r14
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <PKCS7_new@plt>
test   %rax,%rax
je     118b <PKCS7_content_new+0x4b>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15d,%esi
call   1060 <PKCS7_set_type@plt>
test   %eax,%eax
je     1181 <PKCS7_content_new+0x41>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <PKCS7_set_content@plt>
mov    $0x1,%ebp
test   %eax,%eax
jne    118b <PKCS7_content_new+0x4b>
mov    %rbx,%rdi
call   1050 <PKCS7_free@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @PKCS7_content_new(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32*
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32* null, i32** %6
%7 = call i32* (...) @PKCS7_new()
store i32* %7, i32** %6
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %10
9: ; preds = %2
br label %23
10: ; preds = %2
%11 = load i32*, i32** %6
%12 = load i32, i32* %5
%13 = call i32 @PKCS7_set_type(i32* %11, i32 %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %10
br label %23
16: ; preds = %10
%17 = load i32*, i32** %4
%18 = load i32*, i32** %6
%19 = call i32 @PKCS7_set_content(i32* %17, i32* %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %16
br label %23
22: ; preds = %16
store i32 1, i32* %3
br label %30
23: ; preds = %21, %15, %9
%24 = load i32*, i32** %6
%25 = icmp ne i32* %24, null
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = load i32*, i32** %6
%28 = call i32 @PKCS7_free(i32* %27)
br label %29
29: ; preds = %26, %23
store i32 0, i32* %3
br label %30
30: ; preds = %29, %22
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
define i32 @PKCS7_content_new(i32* %0, i32 %1) {
%3 = tail call i32* (...) @PKCS7_new()
%4 = icmp eq i32* %3, null
br i1 %4, label %13, label %5
5: ; preds = %2
%6 = tail call i32 @PKCS7_set_type(i32* %3, i32 %1)
%7 = icmp eq i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = tail call i32 @PKCS7_set_content(i32* %0, i32* %3)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %5, %8
%12 = tail call i32 @PKCS7_free(i32* %3)
br label %13
13: ; preds = %2, %11, %8
%14 = phi i32 [ 1, %8 ], [ 0, %2 ], [ 0, %11 ]
ret i32 %14
}