#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*/ parameter;
  int /*<<< orphan*/ algorithm;
};
typedef TYPE_1__ X509_ALGOR;

/* Variables and functions */
int ASN1_TYPE_cmp(int /*<<< orphan*/, int /*<<< orphan*/);
int OBJ_cmp(int /*<<< orphan*/, int /*<<< orphan*/);
int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b) {
  int rv = OBJ_cmp(a->algorithm, b->algorithm);
  if (!rv) {
    if (!a->parameter && !b->parameter)
      rv = 0;
    else
      rv = ASN1_TYPE_cmp(a->parameter, b->parameter);
  }
  return (rv);
}


x86 assembly (clang, -O0):
<X509_ALGOR_cmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%esi
call   1040 <OBJ_cmp@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    118f <X509_ALGOR_cmp+0x6f>
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1176 <X509_ALGOR_cmp+0x56>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1176 <X509_ALGOR_cmp+0x56>
movl   $0x0,-0x14(%rbp)
jmp    118a <X509_ALGOR_cmp+0x6a>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
call   1030 <ASN1_TYPE_cmp@plt>
mov    %eax,-0x14(%rbp)
jmp    118f <X509_ALGOR_cmp+0x6f>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<X509_ALGOR_cmp>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x4(%rdi),%edi
mov    0x4(%rsi),%esi
call   1040 <OBJ_cmp@plt>
test   %eax,%eax
jne    1146 <X509_ALGOR_cmp+0x26>
mov    (%rbx),%edi
mov    (%r14),%esi
xor    %eax,%eax
mov    %edi,%ecx
or     %esi,%ecx
jne    114e <X509_ALGOR_cmp+0x2e>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <ASN1_TYPE_cmp@plt>

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

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