#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 length;
  int /*<<< orphan*/ data;
};
typedef TYPE_1__ ASN1_STRING;

/* Variables and functions */
int memcmp(int /*<<< orphan*/, int /*<<< orphan*/, int);
int asn1_string_memcmp(ASN1_STRING *a, ASN1_STRING *b) {
  int j;
  j = a->length - b->length;
  if (j)
    return j;
  return memcmp(a->data, b->data, a->length);
}


x86 assembly (clang, -O0):
<asn1_string_memcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
sub    (%rcx),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1144 <asn1_string_memcmp+0x34>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1160 <asn1_string_memcmp+0x50>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
call   1030 <memcmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asn1_string_memcmp>:
mov    (%rdi),%edx
mov    %edx,%eax
sub    (%rsi),%eax
je     1119 <asn1_string_memcmp+0x9>
ret
mov    0x4(%rdi),%edi
mov    0x4(%rsi),%esi
jmp    1030 <memcmp@plt>

LLVM IR (-O0):
%struct.TYPE_4__ = type { i32, i32 }
define i32 @asn1_string_memcmp(%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
%7 = load %struct.TYPE_4__*, %struct.TYPE_4__** %4
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = load i32, i32* %8
%10 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%11 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %10, i32 0, i32 0
%12 = load i32, i32* %11
%13 = sub nsw i32 %9, %12
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = load i32, i32* %6
store i32 %17, i32* %3
br label %29
18: ; preds = %2
%19 = load %struct.TYPE_4__*, %struct.TYPE_4__** %4
%20 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %19, i32 0, i32 1
%21 = load i32, i32* %20
%22 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%23 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %22, i32 0, i32 1
%24 = load i32, i32* %23
%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 = call i32 @memcmp(i32 %21, i32 %24, i32 %27)
store i32 %28, i32* %3
br label %29
29: ; preds = %18, %16
%30 = load i32, i32* %3
ret i32 %30
}

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