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

/* Variables and functions */
int /*<<< orphan*/ ntohs(int /*<<< orphan*/);
void readValueSetPacket(uint8_t *data, uint8_t **key, uint16_t *length,
                        uint8_t **value) {
  (*key) = data + 1;
  (*length) = ntohs(*((uint16_t *)(data + (*key)[0] + 2)));
  (*value) = data + (*key)[0] + 4;
}


x86 assembly (clang, -O0):
<readValueSetPacket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rcx
add    $0x4,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rcx
movslq (%rcx),%rcx
mov    0x8(%rax,%rcx,4),%edi
call   1030 <ntohs@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq (%rax),%rax
shl    $0x2,%rax
add    %rax,%rcx
add    $0x10,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readValueSetPacket>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
lea    0x4(%rdi),%rax
mov    %rax,(%rsi)
movslq 0x4(%rdi),%rax
mov    0x8(%rdi,%rax,4),%edi
call   1030 <ntohs@plt>
mov    %eax,(%r15)
mov    (%r12),%rax
movslq (%rax),%rax
lea    (%rbx,%rax,4),%rax
add    $0x10,%rax
mov    %rax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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