#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 */

/* Type definitions */

/* Variables and functions */
scalar_t__ strcmp(char const *, char const *);
scalar_t__ strncmp(char const *, char const *, size_t);
int greatest_string_equal_cb(const void *expd, const void *got, void *udata) {
  size_t *size = (size_t *)udata;
  return (size != NULL
              ? (0 == strncmp((const char *)expd, (const char *)got, *size))
              : (0 == strcmp((const char *)expd, (const char *)got)));
}


x86 assembly (clang, -O0):
<greatest_string_equal_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1173 <greatest_string_equal_cb+0x53>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rax
mov    (%rax),%rdx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
jmp    1193 <greatest_string_equal_cb+0x73>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<greatest_string_equal_cb>:
push   %rax
test   %rdx,%rdx
je     1130 <greatest_string_equal_cb+0x10>
mov    (%rdx),%rdx
call   1030 <strncmp@plt>
jmp    1135 <greatest_string_equal_cb+0x15>
call   1040 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @greatest_string_equal_cb(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %6
%9 = bitcast i8* %8 to i64*
store i64* %9, i64** %7
%10 = load i64*, i64** %7
%11 = icmp ne i64* %10, null
br i1 %11, label %12, label %20
12: ; preds = %3
%13 = load i8*, i8** %4
%14 = load i8*, i8** %5
%15 = load i64*, i64** %7
%16 = load i64, i64* %15
%17 = call i64 @strncmp(i8* %13, i8* %14, i64 %16)
%18 = icmp eq i64 0, %17
%19 = zext i1 %18 to i32
br label %26
20: ; preds = %3
%21 = load i8*, i8** %4
%22 = load i8*, i8** %5
%23 = call i64 @strcmp(i8* %21, i8* %22)
%24 = icmp eq i64 0, %23
%25 = zext i1 %24 to i32
br label %26
26: ; preds = %20, %12
%27 = phi i32 [ %19, %12 ], [ %25, %20 ]
ret i32 %27
}

LLVM IR (-O2):
define i32 @greatest_string_equal_cb(i8* %0, i8* %1, i8* %2) {
%4 = icmp eq i8* %2, null
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = bitcast i8* %2 to i64*
%7 = load i64, i64* %6
%8 = tail call i64 @strncmp(i8* %0, i8* %1, i64 %7)
br label %11
9: ; preds = %3
%10 = tail call i64 @strcmp(i8* %0, i8* %1)
br label %11
11: ; preds = %9, %5
%12 = phi i64 [ %8, %5 ], [ %10, %9 ]
%13 = icmp eq i64 %12, 0
%14 = zext i1 %13 to i32
ret i32 %14
}