#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__ dns_domain_equal(char const *, char const *);
int dns_domain_suffix(const char *big, const char *little) {
  unsigned char c = 0;
  for (;;) {
    if (dns_domain_equal(big, little))
      return 1;
    if (!(c = *big++))
      return 0;
    big += c;
  }
}


x86 assembly (clang, -O0):
<dns_domain_suffix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movb   $0x0,-0x19(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <dns_domain_equal@plt>
cmp    $0x0,%rax
je     1147 <dns_domain_suffix+0x37>
movl   $0x1,-0x4(%rbp)
jmp    1186 <dns_domain_suffix+0x76>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    %al,-0x19(%rbp)
cmp    $0x0,%al
jne    116f <dns_domain_suffix+0x5f>
movl   $0x0,-0x4(%rbp)
jmp    1186 <dns_domain_suffix+0x76>
movzbl -0x19(%rbp),%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <dns_domain_suffix+0x14>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dns_domain_suffix>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%rbp
call   1030 <dns_domain_equal@plt>
mov    $0x1,%r14d
test   %rax,%rax
jne    1155 <dns_domain_suffix+0x45>
nopw   0x0(%rax,%rax,1)
movzbl 0x0(%rbp),%eax
test   %rax,%rax
je     1152 <dns_domain_suffix+0x42>
add    %rax,%rbp
add    $0x1,%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1030 <dns_domain_equal@plt>
test   %rax,%rax
je     1130 <dns_domain_suffix+0x20>
jmp    1155 <dns_domain_suffix+0x45>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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