#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 /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ htonl(scalar_t__);
scalar_t__ ntohl(int /*<<< orphan*/ const);
void _SUBTRACT_UINT32(uint8_t *dst_ptr, const uint8_t *src_ptr1,
                      const int src_len1, const uint8_t *src_ptr2,
                      const int src_len2) {
  *(uint32_t *)dst_ptr = htonl(
      ntohl(*(const uint32_t *)(src_ptr1 + src_len1 - sizeof(const uint32_t))) -
      ntohl(*(const uint32_t *)(src_ptr2 + src_len2 - sizeof(const uint32_t))));
}


x86 assembly (clang, -O0):
<_SUBTRACT_UINT32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    -0x10(%rax,%rcx,4),%edi
call   1040 <ntohl@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    -0x10(%rax,%rcx,4),%edi
call   1040 <ntohl@plt>
mov    -0x30(%rbp),%rdi
sub    %rax,%rdi
call   1030 <htonl@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_SUBTRACT_UINT32>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8d,%ebp
mov    %rcx,%r14
mov    %rdi,%r15
movslq %edx,%rax
mov    -0x10(%rsi,%rax,4),%edi
call   1040 <ntohl@plt>
mov    %rax,%rbx
movslq %ebp,%rax
mov    -0x10(%r14,%rax,4),%edi
call   1040 <ntohl@plt>
sub    %rax,%rbx
mov    %rbx,%rdi
call   1030 <htonl@plt>
mov    %eax,(%r15)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @_SUBTRACT_UINT32(i32* %0, i32* %1, i32 %2, i32* %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32 %2, i32* %8
store i32* %3, i32** %9
store i32 %4, i32* %10
%11 = load i32*, i32** %7
%12 = load i32, i32* %8
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = getelementptr inbounds i32, i32* %14, i64 -4
%16 = load i32, i32* %15
%17 = call i64 @ntohl(i32 %16)
%18 = load i32*, i32** %9
%19 = load i32, i32* %10
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
%22 = getelementptr inbounds i32, i32* %21, i64 -4
%23 = load i32, i32* %22
%24 = call i64 @ntohl(i32 %23)
%25 = sub nsw i64 %17, %24
%26 = call i32 @htonl(i64 %25)
%27 = load i32*, i32** %6
store i32 %26, i32* %27
ret void
}

LLVM IR (-O2):
define void @_SUBTRACT_UINT32(i32* nocapture writeonly %0, i32* nocapture %1, i32 %2, i32* nocapture %3, i32 %4) {
%6 = sext i32 %2 to i64
%7 = getelementptr inbounds i32, i32* %1, i64 %6
%8 = getelementptr inbounds i32, i32* %7, i64 -4
%9 = load i32, i32* %8
%10 = tail call i64 @ntohl(i32 %9)
%11 = sext i32 %4 to i64
%12 = getelementptr inbounds i32, i32* %3, i64 %11
%13 = getelementptr inbounds i32, i32* %12, i64 -4
%14 = load i32, i32* %13
%15 = tail call i64 @ntohl(i32 %14)
%16 = sub nsw i64 %10, %15
%17 = tail call i32 @htonl(i64 %16)
store i32 %17, i32* %0
ret void
}