#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 */
typedef int uint16_t;
typedef scalar_t__ pid_t;

/* Variables and functions */
scalar_t__ getpid();
int /*<<< orphan*/ memcpy(scalar_t__ *, unsigned char *, int);
void parse_hostuniq(uint16_t type, uint16_t len, unsigned char *data,
                    void *extra) {
  if (type == 0x0103 && len == sizeof(pid_t)) {
    pid_t tmp;
    memcpy(&tmp, data, len);
    if (tmp == getpid()) {
      int *val = (int *)extra;
      *val = 1;
    }
  }
}


x86 assembly (clang, -O0):
<parse_hostuniq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
cmpl   $0x103,-0x4(%rbp)
jne    1197 <parse_hostuniq+0x77>
movslq -0x8(%rbp),%rax
cmp    $0x8,%rax
jne    1197 <parse_hostuniq+0x77>
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%edx
lea    -0x20(%rbp),%rdi
call   1040 <memcpy@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
jne    1192 <parse_hostuniq+0x72>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
jmp    1197 <parse_hostuniq+0x77>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_hostuniq>:
cmp    $0x103,%edi
jne    1162 <parse_hostuniq+0x42>
cmp    $0x8,%esi
jne    1162 <parse_hostuniq+0x42>
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rsp,%rdi
mov    %rdx,%rsi
mov    $0x8,%edx
call   1040 <memcpy@plt>
mov    (%rsp),%rbx
xor    %eax,%eax
call   1030 <getpid@plt>
cmp    %rax,%rbx
jne    115b <parse_hostuniq+0x3b>
movl   $0x1,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @parse_hostuniq(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, 259
br i1 %12, label %13, label %29
13: ; preds = %4
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = icmp eq i64 %15, 8
br i1 %16, label %17, label %29
17: ; preds = %13
%18 = load i8*, i8** %7
%19 = load i32, i32* %6
%20 = call i32 @memcpy(i64* %9, i8* %18, i32 %19)
%21 = load i64, i64* %9
%22 = call i64 (...) @getpid()
%23 = icmp eq i64 %21, %22
br i1 %23, label %24, label %28
24: ; preds = %17
%25 = load i8*, i8** %8
%26 = bitcast i8* %25 to i32*
store i32* %26, i32** %10
%27 = load i32*, i32** %10
store i32 1, i32* %27
br label %28
28: ; preds = %24, %17
br label %29
29: ; preds = %28, %13, %4
ret void
}

LLVM IR (-O2):
define void @parse_hostuniq(i32 %0, i32 %1, i8* %2, i8* nocapture writeonly %3) {
%5 = alloca i64
%6 = icmp eq i32 %0, 259
%7 = icmp eq i32 %1, 8
%8 = and i1 %6, %7
br i1 %8, label %9, label %18
9: ; preds = %4
%10 = bitcast i64* %5 to i8*
%11 = call i32 @memcpy(i64* %5, i8* %2, i32 8)
%12 = load i64, i64* %5
%13 = call i64 (...) @getpid()
%14 = icmp eq i64 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %9
%16 = bitcast i8* %3 to i32*
store i32 1, i32* %16
br label %17
17: ; preds = %15, %9
br label %18
18: ; preds = %17, %4
ret void
}