#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 */

/* Variables and functions */
int /*<<< orphan*/ ntoh_nbytes(unsigned char *, int, int);
void ntoh(unsigned char *dbuf, size_t len) {
  ntoh_nbytes(dbuf, 6, 0);
  dbuf += 6;
  ntoh_nbytes(dbuf, 6, 0);
  dbuf += 6;
  ntoh_nbytes(dbuf, 2, 0);
  dbuf += 2;
  dbuf += 1;
  ntoh_nbytes(dbuf, 3, 2);
  dbuf += 3;
  ntoh_nbytes(dbuf, 4, 0);
  dbuf += 4;
}


x86 assembly (clang, -O0):
<ntoh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x6,%esi
xor    %edx,%edx
call   1030 <ntoh_nbytes@plt>
mov    -0x8(%rbp),%rax
add    $0x6,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x6,%esi
xor    %edx,%edx
call   1030 <ntoh_nbytes@plt>
mov    -0x8(%rbp),%rax
add    $0x6,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2,%esi
xor    %edx,%edx
call   1030 <ntoh_nbytes@plt>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3,%esi
mov    $0x2,%edx
call   1030 <ntoh_nbytes@plt>
mov    -0x8(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x4,%esi
xor    %edx,%edx
call   1030 <ntoh_nbytes@plt>
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ntoh>:
push   %rbx
mov    %rdi,%rbx
mov    $0x6,%esi
xor    %edx,%edx
call   1030 <ntoh_nbytes@plt>
lea    0x6(%rbx),%rdi
mov    $0x6,%esi
xor    %edx,%edx
call   1030 <ntoh_nbytes@plt>
lea    0xc(%rbx),%rdi
mov    $0x2,%esi
xor    %edx,%edx
call   1030 <ntoh_nbytes@plt>
lea    0xf(%rbx),%rdi
mov    $0x3,%esi
mov    $0x2,%edx
call   1030 <ntoh_nbytes@plt>
add    $0x12,%rbx
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %edx,%edx
pop    %rbx
jmp    1030 <ntoh_nbytes@plt>

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

LLVM IR (-O2):
define void @ntoh(i8* %0, i64 %1) {
%3 = tail call i32 @ntoh_nbytes(i8* %0, i32 6, i32 0)
%4 = getelementptr inbounds i8, i8* %0, i64 6
%5 = tail call i32 @ntoh_nbytes(i8* %4, i32 6, i32 0)
%6 = getelementptr inbounds i8, i8* %0, i64 12
%7 = tail call i32 @ntoh_nbytes(i8* %6, i32 2, i32 0)
%8 = getelementptr inbounds i8, i8* %0, i64 15
%9 = tail call i32 @ntoh_nbytes(i8* %8, i32 3, i32 2)
%10 = getelementptr inbounds i8, i8* %0, i64 18
%11 = tail call i32 @ntoh_nbytes(i8* %10, i32 4, i32 0)
ret void
}