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

/* Type definitions */
struct TYPE_4__ {
  int /*<<< orphan*/ value;
  int /*<<< orphan*/ type_id;
};
typedef TYPE_1__ OTHERNAME;

/* Variables and functions */
int ASN1_TYPE_cmp(int /*<<< orphan*/, int /*<<< orphan*/);
int OBJ_cmp(int /*<<< orphan*/, int /*<<< orphan*/);
int OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b) {
  int result = -1;
  if (!a || !b)
    return -1;
  if ((result = OBJ_cmp(a->type_id, b->type_id)) != 0)
    return result;
  result = ASN1_TYPE_cmp(a->value, b->value);
  return result;
}


x86 assembly (clang, -O0):
<OTHERNAME_cmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114d <OTHERNAME_cmp+0x2d>
cmpq   $0x0,-0x18(%rbp)
jne    1159 <OTHERNAME_cmp+0x39>
movl   $0xffffffff,-0x4(%rbp)
jmp    119d <OTHERNAME_cmp+0x7d>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%esi
call   1040 <OBJ_cmp@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
je     1183 <OTHERNAME_cmp+0x63>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    119d <OTHERNAME_cmp+0x7d>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
call   1030 <ASN1_TYPE_cmp@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OTHERNAME_cmp>:
push   %r14
push   %rbx
push   %rax
mov    $0xffffffff,%eax
test   %rdi,%rdi
je     1149 <OTHERNAME_cmp+0x29>
mov    %rsi,%r14
test   %rsi,%rsi
je     1149 <OTHERNAME_cmp+0x29>
mov    %rdi,%rbx
mov    0x4(%rdi),%edi
mov    0x4(%r14),%esi
call   1040 <OBJ_cmp@plt>
test   %eax,%eax
je     1151 <OTHERNAME_cmp+0x31>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    (%rbx),%edi
mov    (%r14),%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <ASN1_TYPE_cmp@plt>

LLVM IR (-O0):
%struct.TYPE_4__ = type { i32, i32 }
define i32 @OTHERNAME_cmp(%struct.TYPE_4__* %0, %struct.TYPE_4__* %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_4__*
%5 = alloca %struct.TYPE_4__*
%6 = alloca i32
store %struct.TYPE_4__* %0, %struct.TYPE_4__** %4
store %struct.TYPE_4__* %1, %struct.TYPE_4__** %5
store i32 -1, i32* %6
%7 = load %struct.TYPE_4__*, %struct.TYPE_4__** %4
%8 = icmp ne %struct.TYPE_4__* %7, null
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%11 = icmp ne %struct.TYPE_4__* %10, null
br i1 %11, label %13, label %12
12: ; preds = %9, %2
store i32 -1, i32* %3
br label %33
13: ; preds = %9
%14 = load %struct.TYPE_4__*, %struct.TYPE_4__** %4
%15 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %14, i32 0, i32 1
%16 = load i32, i32* %15
%17 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%18 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %17, i32 0, i32 1
%19 = load i32, i32* %18
%20 = call i32 @OBJ_cmp(i32 %16, i32 %19)
store i32 %20, i32* %6
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %13
%23 = load i32, i32* %6
store i32 %23, i32* %3
br label %33
24: ; preds = %13
%25 = load %struct.TYPE_4__*, %struct.TYPE_4__** %4
%26 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %25, i32 0, i32 0
%27 = load i32, i32* %26
%28 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%29 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %28, i32 0, i32 0
%30 = load i32, i32* %29
%31 = call i32 @ASN1_TYPE_cmp(i32 %27, i32 %30)
store i32 %31, i32* %6
%32 = load i32, i32* %6
store i32 %32, i32* %3
br label %33
33: ; preds = %24, %22, %12
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { i32, i32 }
define i32 @OTHERNAME_cmp(%struct.TYPE_4__* %0, %struct.TYPE_4__* %1) {
%3 = icmp ne %struct.TYPE_4__* %0, null
%4 = icmp ne %struct.TYPE_4__* %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %19
6: ; preds = %2
%7 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %0, i64 0, i32 1
%8 = load i32, i32* %7
%9 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %1, i64 0, i32 1
%10 = load i32, i32* %9
%11 = tail call i32 @OBJ_cmp(i32 %8, i32 %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %19
13: ; preds = %6
%14 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %0, i64 0, i32 0
%15 = load i32, i32* %14
%16 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %1, i64 0, i32 0
%17 = load i32, i32* %16
%18 = tail call i32 @ASN1_TYPE_cmp(i32 %15, i32 %17)
br label %19
19: ; preds = %6, %2, %13
%20 = phi i32 [ %18, %13 ], [ -1, %2 ], [ %11, %6 ]
ret i32 %20
}