#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 */
struct ns_str {
  int dummy;
};
struct ns_dns_message {
  int dummy;
};
typedef int /*<<< orphan*/ name;

/* Variables and functions */
scalar_t__ ns_dns_uncompress_name(struct ns_dns_message *, struct ns_str *,
                                  char *, int);
scalar_t__ strncmp(char *, char const *, int);
int check_record_name(struct ns_dns_message *msg, struct ns_str *n,
                      const char *want) {
  char name[512];
  if (ns_dns_uncompress_name(msg, n, name, sizeof(name)) == 0) {
    return 0;
  }
  return strncmp(name, want, sizeof(name)) == 0;
}


x86 assembly (clang, -O0):
<check_record_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x220(%rbp),%rdx
mov    $0x200,%ecx
call   1040 <ns_dns_uncompress_name@plt>
cmp    $0x0,%rax
jne    1166 <check_record_name+0x46>
movl   $0x0,-0x4(%rbp)
jmp    118a <check_record_name+0x6a>
lea    -0x220(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x200,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_record_name>:
push   %rbx
sub    $0x200,%rsp
mov    %rdx,%rbx
mov    %rsp,%rdx
mov    $0x200,%ecx
call   1040 <ns_dns_uncompress_name@plt>
test   %rax,%rax
je     115a <check_record_name+0x3a>
mov    %rsp,%rdi
mov    %rbx,%rsi
mov    $0x200,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
jmp    115c <check_record_name+0x3c>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.ns_dns_message = type { i32 }
%struct.ns_str = type { i32 }
define i32 @check_record_name(%struct.ns_dns_message* %0, %struct.ns_str* %1, i8* %2) {
%4 = alloca i32
%5 = alloca %struct.ns_dns_message*
%6 = alloca %struct.ns_str*
%7 = alloca i8*
%8 = alloca [512 x i8]
store %struct.ns_dns_message* %0, %struct.ns_dns_message** %5
store %struct.ns_str* %1, %struct.ns_str** %6
store i8* %2, i8** %7
%9 = load %struct.ns_dns_message*, %struct.ns_dns_message** %5
%10 = load %struct.ns_str*, %struct.ns_str** %6
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%12 = call i64 @ns_dns_uncompress_name(%struct.ns_dns_message* %9, %struct.ns_str* %10, i8* %11, i32 512)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %3
store i32 0, i32* %4
br label %21
15: ; preds = %3
%16 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%17 = load i8*, i8** %7
%18 = call i64 @strncmp(i8* %16, i8* %17, i32 512)
%19 = icmp eq i64 %18, 0
%20 = zext i1 %19 to i32
store i32 %20, i32* %4
br label %21
21: ; preds = %15, %14
%22 = load i32, i32* %4
ret i32 %22
}

LLVM IR (-O2):
%struct.ns_dns_message = type { i32 }
%struct.ns_str = type { i32 }
define i32 @check_record_name(%struct.ns_dns_message* %0, %struct.ns_str* %1, i8* %2) {
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%6 = call i64 @ns_dns_uncompress_name(%struct.ns_dns_message* %0, %struct.ns_str* %1, i8* %5, i32 512)
%7 = icmp eq i64 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %3
%9 = call i64 @strncmp(i8* %5, i8* %2, i32 512)
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %3, %8
%13 = phi i32 [ %11, %8 ], [ 0, %3 ]
ret i32 %13
}