long str$compare_eql(const struct dsc$descriptor_s *first_source_string,
                     const struct dsc$descriptor_s *second_source_string) {
  char *s1_ptr;
  unsigned short s1_length;
  char *s2_ptr;
  unsigned short s2_length;
  str$analyze_sdesc(first_source_string, &s1_length, &s1_ptr);
  str$analyze_sdesc(second_source_string, &s2_length, &s2_ptr);
  if (s1_length != s2_length) {
    return 1;
  }
  if (memcmp(s1_ptr, s2_ptr, s2_length) != 0) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<str$compare_eql>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x22(%rbp),%rsi
lea    -0x20(%rbp),%rdx
mov    $0x0,%al
call   1030 <str$analyze_sdesc@plt>
mov    -0x18(%rbp),%rdi
lea    -0x32(%rbp),%rsi
lea    -0x30(%rbp),%rdx
mov    $0x0,%al
call   1030 <str$analyze_sdesc@plt>
movzwl -0x22(%rbp),%eax
movzwl -0x32(%rbp),%ecx
cmp    %ecx,%eax
je     1173 <str$compare_eql+0x53>
movq   $0x1,-0x8(%rbp)
jmp    11a4 <str$compare_eql+0x84>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rsi
movzwl -0x32(%rbp),%eax
mov    %eax,%edx
call   1040 <memcmp@plt>
cmp    $0x0,%eax
je     119c <str$compare_eql+0x7c>
movq   $0x1,-0x8(%rbp)
jmp    11a4 <str$compare_eql+0x84>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str$compare_eql>:
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
lea    0xe(%rsp),%rsi
lea    0x18(%rsp),%rdx
xor    %eax,%eax
call   1030 <str$analyze_sdesc@plt>
lea    0xc(%rsp),%rsi
lea    0x10(%rsp),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <str$analyze_sdesc@plt>
movzwl 0xe(%rsp),%edx
mov    $0x1,%eax
cmp    0xc(%rsp),%dx
jne    1176 <str$compare_eql+0x56>
mov    0x18(%rsp),%rdi
mov    0x10(%rsp),%rsi
call   1040 <bcmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
setne  %al
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%"struct.dsc$descriptor_s" = type opaque
define i64 @"str$compare_eql"(%"struct.dsc$descriptor_s"* %0, %"struct.dsc$descriptor_s"* %1) {
%3 = alloca i64
%4 = alloca %"struct.dsc$descriptor_s"*
%5 = alloca %"struct.dsc$descriptor_s"*
%6 = alloca i8*
%7 = alloca i16
%8 = alloca i8*
%9 = alloca i16
store %"struct.dsc$descriptor_s"* %0, %"struct.dsc$descriptor_s"** %4
store %"struct.dsc$descriptor_s"* %1, %"struct.dsc$descriptor_s"** %5
%10 = load %"struct.dsc$descriptor_s"*, %"struct.dsc$descriptor_s"** %4
%11 = call i32 (%"struct.dsc$descriptor_s"*, i16*, i8**, ...) bitcast (i32 (...)* @"str$analyze_sdesc" to i32 (%"struct.dsc$descriptor_s"*, i16*, i8**, ...)*)(%"struct.dsc$descriptor_s"* %10, i16* %7, i8** %6)
%12 = load %"struct.dsc$descriptor_s"*, %"struct.dsc$descriptor_s"** %5
%13 = call i32 (%"struct.dsc$descriptor_s"*, i16*, i8**, ...) bitcast (i32 (...)* @"str$analyze_sdesc" to i32 (%"struct.dsc$descriptor_s"*, i16*, i8**, ...)*)(%"struct.dsc$descriptor_s"* %12, i16* %9, i8** %8)
%14 = load i16, i16* %7
%15 = zext i16 %14 to i32
%16 = load i16, i16* %9
%17 = zext i16 %16 to i32
%18 = icmp ne i32 %15, %17
br i1 %18, label %19, label %20
19: ; preds = %2
store i64 1, i64* %3
br label %29
20: ; preds = %2
%21 = load i8*, i8** %6
%22 = load i8*, i8** %8
%23 = load i16, i16* %9
%24 = zext i16 %23 to i64
%25 = call i32 @memcmp(i8* %21, i8* %22, i64 %24)
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %20
store i64 1, i64* %3
br label %29
28: ; preds = %20
store i64 0, i64* %3
br label %29
29: ; preds = %28, %27, %19
%30 = load i64, i64* %3
ret i64 %30
}

LLVM IR (-O2):
%"struct.dsc$descriptor_s" = type opaque
define i64 @"str$compare_eql"(%"struct.dsc$descriptor_s"* %0, %"struct.dsc$descriptor_s"* %1) {
%3 = alloca i8*
%4 = alloca i16
%5 = alloca i8*
%6 = alloca i16
%7 = bitcast i8** %3 to i8*
%8 = bitcast i16* %4 to i8*
%9 = bitcast i8** %5 to i8*
%10 = bitcast i16* %6 to i8*
%11 = call i32 (%"struct.dsc$descriptor_s"*, i16*, i8**, ...) bitcast (i32 (...)* @"str$analyze_sdesc" to i32 (%"struct.dsc$descriptor_s"*, i16*, i8**, ...)*)(%"struct.dsc$descriptor_s"* %0, i16* %4, i8** %3)
%12 = call i32 (%"struct.dsc$descriptor_s"*, i16*, i8**, ...) bitcast (i32 (...)* @"str$analyze_sdesc" to i32 (%"struct.dsc$descriptor_s"*, i16*, i8**, ...)*)(%"struct.dsc$descriptor_s"* %1, i16* %6, i8** %5)
%13 = load i16, i16* %4
%14 = load i16, i16* %6
%15 = icmp eq i16 %13, %14
br i1 %15, label %16, label %23
16: ; preds = %2
%17 = load i8*, i8** %3
%18 = load i8*, i8** %5
%19 = zext i16 %13 to i64
%20 = call i32 @bcmp(i8* %17, i8* %18, i64 %19)
%21 = icmp ne i32 %20, 0
%22 = zext i1 %21 to i64
br label %23
23: ; preds = %16, %2
%24 = phi i64 [ 1, %2 ], [ %22, %16 ]
ret i64 %24
}