#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__ case_diffb(char *, unsigned int, char *);
unsigned int dns_domain_length(char *);
int dns_domain_equal(char *dn1, char *dn2) {
  unsigned int len;
  len = dns_domain_length(dn1);
  if (len != dns_domain_length(dn2))
    return 0;
  if (case_diffb(dn1, len, dn2))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<dns_domain_equal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <dns_domain_length@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <dns_domain_length@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
je     1164 <dns_domain_equal+0x44>
movl   $0x0,-0x4(%rbp)
jmp    1191 <dns_domain_equal+0x71>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1040 <case_diffb@plt>
cmp    $0x0,%rax
je     118a <dns_domain_equal+0x6a>
movl   $0x0,-0x4(%rbp)
jmp    1191 <dns_domain_equal+0x71>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dns_domain_equal>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <dns_domain_length@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <dns_domain_length@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%ebp
jne    1159 <dns_domain_equal+0x39>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
call   1040 <case_diffb@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @dns_domain_equal(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = call i32 @dns_domain_length(i8* %7)
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = load i8*, i8** %5
%11 = call i32 @dns_domain_length(i8* %10)
%12 = icmp ne i32 %9, %11
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 0, i32* %3
br label %22
14: ; preds = %2
%15 = load i8*, i8** %4
%16 = load i32, i32* %6
%17 = load i8*, i8** %5
%18 = call i64 @case_diffb(i8* %15, i32 %16, i8* %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %14
store i32 0, i32* %3
br label %22
21: ; preds = %14
store i32 1, i32* %3
br label %22
22: ; preds = %21, %20, %13
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
define i32 @dns_domain_equal(i8* %0, i8* %1) {
%3 = tail call i32 @dns_domain_length(i8* %0)
%4 = tail call i32 @dns_domain_length(i8* %1)
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = tail call i64 @case_diffb(i8* %0, i32 %3, i8* %1)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %2
%11 = phi i32 [ 0, %2 ], [ %9, %6 ]
ret i32 %11
}