#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_5__ TYPE_1__;

/* Type definitions */
struct TYPE_5__ {
  int /*<<< orphan*/ gN_cache;
  int /*<<< orphan*/ users_pwd;
  int /*<<< orphan*/ *seed_key;
  int /*<<< orphan*/ *default_N;
  int /*<<< orphan*/ *default_g;
};
typedef TYPE_1__ SRP_VBASE;

/* Variables and functions */
int /*<<< orphan*/ *BUF_strdup(char *);
int /*<<< orphan*/ free(TYPE_1__ *);
TYPE_1__ *malloc(int);
int /*<<< orphan*/ sk_SRP_gN_cache_free(int /*<<< orphan*/);
int /*<<< orphan*/ sk_SRP_gN_cache_new_null();
int /*<<< orphan*/ sk_SRP_user_pwd_free(int /*<<< orphan*/);
int /*<<< orphan*/ sk_SRP_user_pwd_new_null();
SRP_VBASE *SRP_VBASE_new(char *seed_key) {
  SRP_VBASE *vb = malloc(sizeof(SRP_VBASE));
  if (vb == NULL)
    return NULL;
  if (!(vb->users_pwd = sk_SRP_user_pwd_new_null()) ||
      !(vb->gN_cache = sk_SRP_gN_cache_new_null())) {
    free(vb);
    return NULL;
  }
  vb->default_g = NULL;
  vb->default_N = NULL;
  vb->seed_key = NULL;
  if ((seed_key != NULL) && (vb->seed_key = BUF_strdup(seed_key)) == NULL) {
    sk_SRP_user_pwd_free(vb->users_pwd);
    sk_SRP_gN_cache_free(vb->gN_cache);
    free(vb);
    return NULL;
  }
  return vb;
}


x86 assembly (clang, -O0):
<SRP_VBASE_new>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x20,%edi
call   1070 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11a2 <SRP_VBASE_new+0x32>
movq   $0x0,-0x8(%rbp)
jmp    1264 <SRP_VBASE_new+0xf4>
mov    $0x0,%al
call   1040 <sk_SRP_user_pwd_new_null@plt>
mov    -0x18(%rbp),%rcx
mov    %eax,0x4(%rcx)
cmp    $0x0,%eax
je     11cf <SRP_VBASE_new+0x5f>
mov    $0x0,%al
call   1060 <sk_SRP_gN_cache_new_null@plt>
mov    -0x18(%rbp),%rcx
mov    %eax,(%rcx)
cmp    $0x0,%eax
jne    11e5 <SRP_VBASE_new+0x75>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
jmp    1264 <SRP_VBASE_new+0xf4>
mov    -0x18(%rbp),%rax
movq   $0x0,0x18(%rax)
mov    -0x18(%rbp),%rax
movq   $0x0,0x10(%rax)
mov    -0x18(%rbp),%rax
movq   $0x0,0x8(%rax)
cmpq   $0x0,-0x10(%rbp)
je     125c <SRP_VBASE_new+0xec>
mov    -0x10(%rbp),%rdi
call   1090 <BUF_strdup@plt>
mov    -0x18(%rbp),%rcx
mov    %rax,0x8(%rcx)
cmp    $0x0,%rax
jne    125c <SRP_VBASE_new+0xec>
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%edi
call   1080 <sk_SRP_user_pwd_free@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1050 <sk_SRP_gN_cache_free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
jmp    1264 <SRP_VBASE_new+0xf4>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SRP_VBASE_new>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r14
mov    $0x20,%edi
call   1070 <malloc@plt>
test   %rax,%rax
je     11f0 <SRP_VBASE_new+0x80>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <sk_SRP_user_pwd_new_null@plt>
mov    %eax,0x4(%rbx)
test   %eax,%eax
je     11e8 <SRP_VBASE_new+0x78>
mov    %eax,%ebp
xor    %eax,%eax
call   1060 <sk_SRP_gN_cache_new_null@plt>
mov    %eax,(%rbx)
test   %eax,%eax
je     11e8 <SRP_VBASE_new+0x78>
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rbx)
movq   $0x0,0x18(%rbx)
test   %r14,%r14
je     11f2 <SRP_VBASE_new+0x82>
mov    %eax,%r15d
mov    %rbx,%r12
add    $0x8,%r12
mov    %r14,%rdi
call   1090 <BUF_strdup@plt>
mov    %rax,(%r12)
test   %rax,%rax
jne    11f2 <SRP_VBASE_new+0x82>
mov    %ebp,%edi
call   1080 <sk_SRP_user_pwd_free@plt>
mov    %r15d,%edi
call   1050 <sk_SRP_gN_cache_free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { i32, i32, i32*, i32*, i32* }
define %struct.TYPE_5__* @SRP_VBASE_new(i8* %0) {
%2 = alloca %struct.TYPE_5__*
%3 = alloca i8*
%4 = alloca %struct.TYPE_5__*
store i8* %0, i8** %3
%5 = call %struct.TYPE_5__* @malloc(i32 32)
store %struct.TYPE_5__* %5, %struct.TYPE_5__** %4
%6 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%7 = icmp eq %struct.TYPE_5__* %6, null
br i1 %7, label %8, label %9
8: ; preds = %1
store %struct.TYPE_5__* null, %struct.TYPE_5__** %2
br label %50
9: ; preds = %1
%10 = call i32 (...) @sk_SRP_user_pwd_new_null()
%11 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%12 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %11, i32 0, i32 1
store i32 %10, i32* %12
%13 = icmp ne i32 %10, 0
br i1 %13, label %14, label %19
14: ; preds = %9
%15 = call i32 (...) @sk_SRP_gN_cache_new_null()
%16 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%17 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %16, i32 0, i32 0
store i32 %15, i32* %17
%18 = icmp ne i32 %15, 0
br i1 %18, label %22, label %19
19: ; preds = %14, %9
%20 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%21 = call i32 @free(%struct.TYPE_5__* %20)
store %struct.TYPE_5__* null, %struct.TYPE_5__** %2
br label %50
22: ; preds = %14
%23 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%24 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %23, i32 0, i32 4
store i32* null, i32** %24
%25 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%26 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %25, i32 0, i32 3
store i32* null, i32** %26
%27 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%28 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %27, i32 0, i32 2
store i32* null, i32** %28
%29 = load i8*, i8** %3
%30 = icmp ne i8* %29, null
br i1 %30, label %31, label %48
31: ; preds = %22
%32 = load i8*, i8** %3
%33 = call i32* @BUF_strdup(i8* %32)
%34 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%35 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %34, i32 0, i32 2
store i32* %33, i32** %35
%36 = icmp eq i32* %33, null
br i1 %36, label %37, label %48
37: ; preds = %31
%38 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%39 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %38, i32 0, i32 1
%40 = load i32, i32* %39
%41 = call i32 @sk_SRP_user_pwd_free(i32 %40)
%42 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%43 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %42, i32 0, i32 0
%44 = load i32, i32* %43
%45 = call i32 @sk_SRP_gN_cache_free(i32 %44)
%46 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%47 = call i32 @free(%struct.TYPE_5__* %46)
store %struct.TYPE_5__* null, %struct.TYPE_5__** %2
br label %50
48: ; preds = %31, %22
%49 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
store %struct.TYPE_5__* %49, %struct.TYPE_5__** %2
br label %50
50: ; preds = %48, %37, %19, %8
%51 = load %struct.TYPE_5__*, %struct.TYPE_5__** %2
ret %struct.TYPE_5__* %51
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i32, i32, i32*, i32*, i32* }
define noalias %struct.TYPE_5__* @SRP_VBASE_new(i8* %0) {
%2 = tail call %struct.TYPE_5__* @malloc(i32 32)
%3 = icmp eq %struct.TYPE_5__* %2, null
br i1 %3, label %24, label %4
4: ; preds = %1
%5 = tail call i32 (...) @sk_SRP_user_pwd_new_null()
%6 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %2, i64 0, i32 1
store i32 %5, i32* %6
%7 = icmp eq i32 %5, 0
br i1 %7, label %22, label %8
8: ; preds = %4
%9 = tail call i32 (...) @sk_SRP_gN_cache_new_null()
%10 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %2, i64 0, i32 0
store i32 %9, i32* %10
%11 = icmp eq i32 %9, 0
br i1 %11, label %22, label %12
12: ; preds = %8
%13 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %2, i64 0, i32 2
%14 = icmp eq i8* %0, null
%15 = bitcast i32** %13 to i8*
br i1 %14, label %24, label %16
16: ; preds = %12
%17 = tail call i32* @BUF_strdup(i8* %0)
store i32* %17, i32** %13
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %24
19: ; preds = %16
%20 = tail call i32 @sk_SRP_user_pwd_free(i32 %5)
%21 = tail call i32 @sk_SRP_gN_cache_free(i32 %9)
br label %22
22: ; preds = %4, %8, %19
%23 = tail call i32 @free(%struct.TYPE_5__* %2)
br label %24
24: ; preds = %22, %12, %16, %1
%25 = phi %struct.TYPE_5__* [ null, %1 ], [ %2, %16 ], [ %2, %12 ], [ null, %22 ]
ret %struct.TYPE_5__* %25
}