#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 writedescriptor(unsigned long address,
                     const struct appnic_dma_descriptor *descriptor) {
  unsigned long *to = (unsigned long *)address;
  unsigned long *from = (unsigned long *)descriptor;
  *to++ = swab32(*from++);
  *to++ = swab32(*from++);
  *to++ = swab32(*from++);
  *to++ = swab32(*from++);
  return;
}


x86 assembly (clang, -O0):
<writedescriptor>:
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    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%rax
mov    %eax,%edi
call   1030 <swab32@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x8,%rdx
mov    %rdx,-0x18(%rbp)
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%rax
mov    %eax,%edi
call   1030 <swab32@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x8,%rdx
mov    %rdx,-0x18(%rbp)
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%rax
mov    %eax,%edi
call   1030 <swab32@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x8,%rdx
mov    %rdx,-0x18(%rbp)
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%rax
mov    %eax,%edi
call   1030 <swab32@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x8,%rdx
mov    %rdx,-0x18(%rbp)
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writedescriptor>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rsi),%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 @writedescriptor(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** %6
%12 = getelementptr inbounds i64, i64* %11, i32 1
store i64* %12, i64** %6
%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** %5
%18 = getelementptr inbounds i64, i64* %17, i32 1
store i64* %18, i64** %5
store i64 %16, i64* %17
%19 = load i64*, i64** %6
%20 = getelementptr inbounds i64, i64* %19, i32 1
store i64* %20, i64** %6
%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** %5
%26 = getelementptr inbounds i64, i64* %25, i32 1
store i64* %26, i64** %5
store i64 %24, i64* %25
%27 = load i64*, i64** %6
%28 = getelementptr inbounds i64, i64* %27, i32 1
store i64* %28, i64** %6
%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** %5
%34 = getelementptr inbounds i64, i64* %33, i32 1
store i64* %34, i64** %5
store i64 %32, i64* %33
%35 = load i64*, i64** %6
%36 = getelementptr inbounds i64, i64* %35, i32 1
store i64* %36, i64** %6
%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** %5
%42 = getelementptr inbounds i64, i64* %41, i32 1
store i64* %42, i64** %5
store i64 %40, i64* %41
ret void
}

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