#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 /*<<< orphan*/ uint8_t;
typedef int uint32_t;
typedef int int8_t;

/* Variables and functions */
int8_t extended_addr_compare(const uint8_t *p_first_addr,
                             const uint8_t *p_second_addr) {
  uint32_t first_addr;
  uint32_t second_addr;
  for (uint32_t i = 0; i < 8 / sizeof(uint32_t); i++) {
    first_addr = *(uint32_t *)(p_first_addr + (i * sizeof(uint32_t)));
    second_addr = *(uint32_t *)(p_second_addr + (i * sizeof(uint32_t)));
    if (first_addr < second_addr) {
      return -1;
    } else if (first_addr > second_addr) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<extended_addr_compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmp    $0x2,%rax
jae    118d <extended_addr_compare+0x8d>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
shl    $0x2,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
shl    $0x2,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    115d <extended_addr_compare+0x5d>
movl   $0xffffffff,-0x4(%rbp)
jmp    1194 <extended_addr_compare+0x94>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    1175 <extended_addr_compare+0x75>
movl   $0x1,-0x4(%rbp)
jmp    1194 <extended_addr_compare+0x94>
jmp    117a <extended_addr_compare+0x7a>
jmp    117f <extended_addr_compare+0x7f>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1113 <extended_addr_compare+0x13>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<extended_addr_compare>:
mov    (%rsi),%ecx
mov    $0xffffffff,%eax
cmp    %ecx,(%rdi)
jl     1125 <extended_addr_compare+0x25>
mov    $0x1,%eax
jg     1125 <extended_addr_compare+0x25>
mov    0x10(%rsi),%ecx
mov    $0xffffffff,%eax
cmp    %ecx,0x10(%rdi)
jl     1125 <extended_addr_compare+0x25>
setg   %al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @extended_addr_compare(i32* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32 0, i32* %8
br label %9
9: ; preds = %37, %2
%10 = load i32, i32* %8
%11 = sext i32 %10 to i64
%12 = icmp ult i64 %11, 2
br i1 %12, label %13, label %40
13: ; preds = %9
%14 = load i32*, i32** %4
%15 = load i32, i32* %8
%16 = sext i32 %15 to i64
%17 = mul i64 %16, 4
%18 = getelementptr inbounds i32, i32* %14, i64 %17
%19 = load i32, i32* %18
store i32 %19, i32* %6
%20 = load i32*, i32** %5
%21 = load i32, i32* %8
%22 = sext i32 %21 to i64
%23 = mul i64 %22, 4
%24 = getelementptr inbounds i32, i32* %20, i64 %23
%25 = load i32, i32* %24
store i32 %25, i32* %7
%26 = load i32, i32* %6
%27 = load i32, i32* %7
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %30
29: ; preds = %13
store i32 -1, i32* %3
br label %41
30: ; preds = %13
%31 = load i32, i32* %6
%32 = load i32, i32* %7
%33 = icmp sgt i32 %31, %32
br i1 %33, label %34, label %35
34: ; preds = %30
store i32 1, i32* %3
br label %41
35: ; preds = %30
br label %36
36: ; preds = %35
br label %37
37: ; preds = %36
%38 = load i32, i32* %8
%39 = add nsw i32 %38, 1
store i32 %39, i32* %8
br label %9
40: ; preds = %9
store i32 0, i32* %3
br label %41
41: ; preds = %40, %34, %29
%42 = load i32, i32* %3
ret i32 %42
}

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