#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 */
struct appnic_dma_descriptor {
  int dummy;
};

/* Variables and functions */
void *swab32(int /*<<< orphan*/);
void readdescriptor(unsigned long address,
                    struct appnic_dma_descriptor *descriptor) {
  unsigned long *from = (unsigned long *)address;
  unsigned long *to = (unsigned long *)descriptor;
  *to++ = swab32(*from++);
  *to++ = swab32(*from++);
  *to++ = swab32(*from++);
  *to++ = swab32(*from++);
  return;
}


x86 assembly (clang, -O0):
<readdescriptor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%rax
mov    %eax,%edi
call   1030 <swab32@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x8,%rdx
mov    %rdx,-0x20(%rbp)
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%rax
mov    %eax,%edi
call   1030 <swab32@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x8,%rdx
mov    %rdx,-0x20(%rbp)
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%rax
mov    %eax,%edi
call   1030 <swab32@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x8,%rdx
mov    %rdx,-0x20(%rbp)
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%rax
mov    %eax,%edi
call   1030 <swab32@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x8,%rdx
mov    %rdx,-0x20(%rbp)
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readdescriptor>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%edi
call   1030 <swab32@plt>
mov    %rax,(%r14)
mov    0x8(%rbx),%edi
call   1030 <swab32@plt>
mov    %rax,0x8(%r14)
mov    0x10(%rbx),%edi
call   1030 <swab32@plt>
mov    %rax,0x10(%r14)
mov    0x18(%rbx),%edi
call   1030 <swab32@plt>
mov    %rax,0x18(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.appnic_dma_descriptor = type { i32 }
define void @readdescriptor(i64 %0, %struct.appnic_dma_descriptor* %1) {
%3 = alloca i64
%4 = alloca %struct.appnic_dma_descriptor*
%5 = alloca i64*
%6 = alloca i64*
store i64 %0, i64* %3
store %struct.appnic_dma_descriptor* %1, %struct.appnic_dma_descriptor** %4
%7 = load i64, i64* %3
%8 = inttoptr i64 %7 to i64*
store i64* %8, i64** %5
%9 = load %struct.appnic_dma_descriptor*, %struct.appnic_dma_descriptor** %4
%10 = bitcast %struct.appnic_dma_descriptor* %9 to i64*
store i64* %10, i64** %6
%11 = load i64*, i64** %5
%12 = getelementptr inbounds i64, i64* %11, i32 1
store i64* %12, i64** %5
%13 = load i64, i64* %11
%14 = trunc i64 %13 to i32
%15 = call i8* @swab32(i32 %14)
%16 = ptrtoint i8* %15 to i64
%17 = load i64*, i64** %6
%18 = getelementptr inbounds i64, i64* %17, i32 1
store i64* %18, i64** %6
store i64 %16, i64* %17
%19 = load i64*, i64** %5
%20 = getelementptr inbounds i64, i64* %19, i32 1
store i64* %20, i64** %5
%21 = load i64, i64* %19
%22 = trunc i64 %21 to i32
%23 = call i8* @swab32(i32 %22)
%24 = ptrtoint i8* %23 to i64
%25 = load i64*, i64** %6
%26 = getelementptr inbounds i64, i64* %25, i32 1
store i64* %26, i64** %6
store i64 %24, i64* %25
%27 = load i64*, i64** %5
%28 = getelementptr inbounds i64, i64* %27, i32 1
store i64* %28, i64** %5
%29 = load i64, i64* %27
%30 = trunc i64 %29 to i32
%31 = call i8* @swab32(i32 %30)
%32 = ptrtoint i8* %31 to i64
%33 = load i64*, i64** %6
%34 = getelementptr inbounds i64, i64* %33, i32 1
store i64* %34, i64** %6
store i64 %32, i64* %33
%35 = load i64*, i64** %5
%36 = getelementptr inbounds i64, i64* %35, i32 1
store i64* %36, i64** %5
%37 = load i64, i64* %35
%38 = trunc i64 %37 to i32
%39 = call i8* @swab32(i32 %38)
%40 = ptrtoint i8* %39 to i64
%41 = load i64*, i64** %6
%42 = getelementptr inbounds i64, i64* %41, i32 1
store i64* %42, i64** %6
store i64 %40, i64* %41
ret void
}

LLVM IR (-O2):
%struct.appnic_dma_descriptor = type { i32 }
define void @readdescriptor(i64 %0, %struct.appnic_dma_descriptor* nocapture writeonly %1) {
%3 = inttoptr i64 %0 to i64*
%4 = bitcast %struct.appnic_dma_descriptor* %1 to i64*
%5 = getelementptr inbounds i64, i64* %3, i64 1
%6 = load i64, i64* %3
%7 = trunc i64 %6 to i32
%8 = tail call i8* @swab32(i32 %7)
%9 = ptrtoint i8* %8 to i64
%10 = getelementptr inbounds %struct.appnic_dma_descriptor, %struct.appnic_dma_descriptor* %1, i64 2
%11 = bitcast %struct.appnic_dma_descriptor* %10 to i64*
store i64 %9, i64* %4
%12 = getelementptr inbounds i64, i64* %3, i64 2
%13 = load i64, i64* %5
%14 = trunc i64 %13 to i32
%15 = tail call i8* @swab32(i32 %14)
%16 = ptrtoint i8* %15 to i64
%17 = getelementptr inbounds %struct.appnic_dma_descriptor, %struct.appnic_dma_descriptor* %1, i64 4
%18 = bitcast %struct.appnic_dma_descriptor* %17 to i64*
store i64 %16, i64* %11
%19 = getelementptr inbounds i64, i64* %3, i64 3
%20 = load i64, i64* %12
%21 = trunc i64 %20 to i32
%22 = tail call i8* @swab32(i32 %21)
%23 = ptrtoint i8* %22 to i64
%24 = getelementptr inbounds %struct.appnic_dma_descriptor, %struct.appnic_dma_descriptor* %1, i64 6
%25 = bitcast %struct.appnic_dma_descriptor* %24 to i64*
store i64 %23, i64* %18
%26 = load i64, i64* %19
%27 = trunc i64 %26 to i32
%28 = tail call i8* @swab32(i32 %27)
%29 = ptrtoint i8* %28 to i64
store i64 %29, i64* %25
ret void
}