#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*/ uint64_t;
typedef int uint32_t;
struct udphdr {
  unsigned short source;
  unsigned short dest;
  unsigned short len;
  scalar_t__ check;
};
struct iphdr {
  int version;
  int ihl;
  unsigned short tot_len;
  int ttl;
  int protocol;
  unsigned long saddr;
  unsigned long daddr;
  scalar_t__ check;
  scalar_t__ frag_off;
  scalar_t__ id;
  scalar_t__ tos;
};
struct ethhdr {
  int *h_dest;
  int *h_source;
  unsigned short h_proto;
};

/* Variables and functions */
scalar_t__ ip_fast_csum(struct iphdr *, int);
int myrand(int /*<<< orphan*/ *);
void build_packet(char *buf, int size, uint64_t *seed) {
  struct ethhdr *eth;
  struct iphdr *ip;
  struct udphdr *udp;
  uint32_t rand_val;
  eth = (struct ethhdr *)buf;
  eth->h_dest[0] = 0x00;
  eth->h_dest[1] = 0x00;
  eth->h_dest[2] = 0x00;
  eth->h_dest[3] = 0x00;
  eth->h_dest[4] = 0x00;
  eth->h_dest[5] = 0x02;
  eth->h_source[0] = 0x00;
  eth->h_source[1] = 0x00;
  eth->h_source[2] = 0x00;
  eth->h_source[3] = 0x00;
  eth->h_source[4] = 0x00;
  eth->h_source[5] = 0x01;
  eth->h_proto = (((((unsigned short)(0x0800) & 0xFF)) << 8) |
                  (((unsigned short)(0x0800) & 0xFF00) >> 8));
  ip = (struct iphdr *)(buf + sizeof(*eth));
  ip->version = 4;
  ip->ihl = 5;
  ip->tos = 0;
  ip->tot_len = (((((unsigned short)(size - sizeof(*eth)) & 0xFF)) << 8) |
                 (((unsigned short)(size - sizeof(*eth)) & 0xFF00) >> 8));
  ip->id = 0;
  ip->frag_off = 0;
  ip->ttl = 32;
  ip->protocol = 17;
  ip->saddr = (((((unsigned long)(0x0A000001) & 0xFF)) << 24) |
               ((((unsigned long)(0x0A000001) & 0xFF00)) << 8) |
               ((((unsigned long)(0x0A000001) & 0xFF0000)) >> 8) |
               ((((unsigned long)(0x0A000001) & 0xFF000000)) >> 24));
  ip->daddr = (((((unsigned long)(myrand(seed)) & 0xFF)) << 24) |
               ((((unsigned long)(myrand(seed)) & 0xFF00)) << 8) |
               ((((unsigned long)(myrand(seed)) & 0xFF0000)) >> 8) |
               ((((unsigned long)(myrand(seed)) & 0xFF000000)) >> 24));
  ip->check = 0;
  ip->check = ip_fast_csum(ip, ip->ihl);
  udp = (struct udphdr *)((char *)ip + sizeof(*ip));
  rand_val = myrand(seed);
  udp->source = (((((unsigned short)(rand_val & 0xFFFF) & 0xFF)) << 8) |
                 (((unsigned short)(rand_val & 0xFFFF) & 0xFF00) >> 8));
  udp->dest = (((((unsigned short)((rand_val >> 16) & 0xFFFF) & 0xFF)) << 8) |
               (((unsigned short)((rand_val >> 16) & 0xFFFF) & 0xFF00) >> 8));
  udp->len =
      (((((unsigned short)(size - sizeof(*eth) - sizeof(*ip)) & 0xFF)) << 8) |
       (((unsigned short)(size - sizeof(*eth) - sizeof(*ip)) & 0xFF00) >> 8));
  udp->check = 0;
}


x86 assembly (clang, -O0):
<build_packet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
movl   $0x0,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
movl   $0x0,0x4(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
movl   $0x0,0x8(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
movl   $0x0,0xc(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
movl   $0x0,0x10(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
movl   $0x2,0x14(%rax)
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rax
movl   $0x0,(%rax)
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rax
movl   $0x0,0x4(%rax)
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rax
movl   $0x0,0x8(%rax)
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rax
movl   $0x0,0xc(%rax)
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rax
movl   $0x0,0x10(%rax)
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rax
movl   $0x1,0x14(%rax)
mov    -0x20(%rbp),%rax
movw   $0x8,0x10(%rax)
mov    -0x8(%rbp),%rax
add    $0x18,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movl   $0x4,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x5,0x4(%rax)
mov    -0x28(%rbp),%rax
movq   $0x0,0x40(%rax)
movslq -0xc(%rbp),%rax
sub    $0x18,%rax
movzwl %ax,%eax
and    $0xff,%eax
shl    $0x8,%eax
movslq -0xc(%rbp),%rcx
sub    $0x18,%rcx
movzwl %cx,%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
mov    %ax,%cx
mov    -0x28(%rbp),%rax
mov    %cx,0x8(%rax)
mov    -0x28(%rbp),%rax
movq   $0x0,0x38(%rax)
mov    -0x28(%rbp),%rax
movq   $0x0,0x30(%rax)
mov    -0x28(%rbp),%rax
movl   $0x20,0xc(%rax)
mov    -0x28(%rbp),%rax
movl   $0x11,0x10(%rax)
mov    -0x28(%rbp),%rax
movq   $0x100000a,0x18(%rax)
01
mov    -0x18(%rbp),%rdi
call   1030 <myrand@plt>
cltq
and    $0xff,%rax
shl    $0x18,%rax
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <myrand@plt>
mov    %eax,%ecx
mov    -0x50(%rbp),%rax
movslq %ecx,%rcx
and    $0xff00,%rcx
shl    $0x8,%rcx
or     %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <myrand@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%rax
movslq %ecx,%rcx
and    $0xff0000,%rcx
shr    $0x8,%rcx
or     %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <myrand@plt>
mov    -0x40(%rbp),%rcx
cltq
movabs $0xff000000,%rdx
and    %rdx,%rax
shr    $0x18,%rax
or     %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,0x20(%rax)
mov    -0x28(%rbp),%rax
movq   $0x0,0x28(%rax)
mov    -0x28(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    0x4(%rax),%esi
call   1040 <ip_fast_csum@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,0x28(%rax)
mov    -0x28(%rbp),%rax
add    $0x48,%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <myrand@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
and    $0xffff,%eax
movzwl %ax,%eax
and    $0xff,%eax
shl    $0x8,%eax
mov    -0x34(%rbp),%ecx
and    $0xffff,%ecx
movzwl %cx,%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
mov    %ax,%cx
mov    -0x30(%rbp),%rax
mov    %cx,(%rax)
mov    -0x34(%rbp),%eax
sar    $0x10,%eax
and    $0xffff,%eax
movzwl %ax,%eax
and    $0xff,%eax
shl    $0x8,%eax
mov    -0x34(%rbp),%ecx
sar    $0x10,%ecx
and    $0xffff,%ecx
movzwl %cx,%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
mov    %ax,%cx
mov    -0x30(%rbp),%rax
mov    %cx,0x2(%rax)
movslq -0xc(%rbp),%rax
sub    $0x18,%rax
sub    $0x48,%rax
movzwl %ax,%eax
and    $0xff,%eax
shl    $0x8,%eax
movslq -0xc(%rbp),%rcx
sub    $0x18,%rcx
sub    $0x48,%rcx
movzwl %cx,%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
mov    %ax,%cx
mov    -0x30(%rbp),%rax
mov    %cx,0x4(%rax)
mov    -0x30(%rbp),%rax
movq   $0x0,0x8(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_packet>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %esi,%r14d
mov    %rdi,%r12
mov    (%rdi),%rax
xorps  %xmm0,%xmm0
movups %xmm0,(%rax)
movabs $0x200000000,%rcx
mov    %rcx,0x10(%rax)
mov    0x8(%rdi),%rax
movups %xmm0,(%rax)
movabs $0x100000000,%rcx
mov    %rcx,0x10(%rax)
movw   $0x8,0x10(%rdi)
lea    0x18(%rdi),%rax
mov    %rax,(%rsp)
movabs $0x500000004,%rax
mov    %rax,0x18(%rdi)
movq   $0x0,0x58(%rdi)
lea    -0x18(%r14),%eax
rol    $0x8,%ax
mov    %ax,0x20(%rdi)
movups %xmm0,0x48(%rdi)
movabs $0x1100000020,%rax
mov    %rax,0x24(%rdi)
movq   $0x100000a,0x30(%rdi)
01
mov    %rdx,%rdi
call   1030 <myrand@plt>
mov    %eax,%r13d
shl    $0x18,%r13d
mov    %r15,%rdi
call   1030 <myrand@plt>
mov    %eax,%ebp
shl    $0x8,%ebp
and    $0xff0000,%ebp
or     %r13d,%ebp
mov    %r15,%rdi
call   1030 <myrand@plt>
mov    %eax,%ebx
shr    $0x8,%ebx
and    $0xff00,%ebx
or     %ebp,%ebx
mov    %r15,%rdi
call   1030 <myrand@plt>
shr    $0x18,%eax
or     %ebx,%eax
mov    %rax,0x38(%r12)
movq   $0x0,0x40(%r12)
mov    0x1c(%r12),%esi
mov    (%rsp),%rdi
call   1040 <ip_fast_csum@plt>
mov    %rax,0x40(%r12)
mov    %r15,%rdi
call   1030 <myrand@plt>
mov    %eax,%ecx
rol    $0x8,%cx
mov    %cx,0x60(%r12)
mov    %eax,%ecx
shr    $0x8,%ecx
and    $0xff00,%ecx
shr    $0x18,%eax
or     %ecx,%eax
mov    %ax,0x62(%r12)
add    $0xffffffa0,%r14d
rol    $0x8,%r14w
mov    %r14w,0x64(%r12)
movq   $0x0,0x68(%r12)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.ethhdr = type { i32*, i32*, i16 }
%struct.iphdr = type { i32, i32, i16, i32, i32, i64, i64, i64, i64, i64, i64 }
%struct.udphdr = type { i16, i16, i16, i64 }
define void @build_packet(i8* %0, i32 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca %struct.ethhdr*
%8 = alloca %struct.iphdr*
%9 = alloca %struct.udphdr*
%10 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%11 = load i8*, i8** %4
%12 = bitcast i8* %11 to %struct.ethhdr*
store %struct.ethhdr* %12, %struct.ethhdr** %7
%13 = load %struct.ethhdr*, %struct.ethhdr** %7
%14 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %13, i32 0, i32 0
%15 = load i32*, i32** %14
%16 = getelementptr inbounds i32, i32* %15, i64 0
store i32 0, i32* %16
%17 = load %struct.ethhdr*, %struct.ethhdr** %7
%18 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %17, i32 0, i32 0
%19 = load i32*, i32** %18
%20 = getelementptr inbounds i32, i32* %19, i64 1
store i32 0, i32* %20
%21 = load %struct.ethhdr*, %struct.ethhdr** %7
%22 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %21, i32 0, i32 0
%23 = load i32*, i32** %22
%24 = getelementptr inbounds i32, i32* %23, i64 2
store i32 0, i32* %24
%25 = load %struct.ethhdr*, %struct.ethhdr** %7
%26 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %25, i32 0, i32 0
%27 = load i32*, i32** %26
%28 = getelementptr inbounds i32, i32* %27, i64 3
store i32 0, i32* %28
%29 = load %struct.ethhdr*, %struct.ethhdr** %7
%30 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %29, i32 0, i32 0
%31 = load i32*, i32** %30
%32 = getelementptr inbounds i32, i32* %31, i64 4
store i32 0, i32* %32
%33 = load %struct.ethhdr*, %struct.ethhdr** %7
%34 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %33, i32 0, i32 0
%35 = load i32*, i32** %34
%36 = getelementptr inbounds i32, i32* %35, i64 5
store i32 2, i32* %36
%37 = load %struct.ethhdr*, %struct.ethhdr** %7
%38 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %37, i32 0, i32 1
%39 = load i32*, i32** %38
%40 = getelementptr inbounds i32, i32* %39, i64 0
store i32 0, i32* %40
%41 = load %struct.ethhdr*, %struct.ethhdr** %7
%42 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %41, i32 0, i32 1
%43 = load i32*, i32** %42
%44 = getelementptr inbounds i32, i32* %43, i64 1
store i32 0, i32* %44
%45 = load %struct.ethhdr*, %struct.ethhdr** %7
%46 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %45, i32 0, i32 1
%47 = load i32*, i32** %46
%48 = getelementptr inbounds i32, i32* %47, i64 2
store i32 0, i32* %48
%49 = load %struct.ethhdr*, %struct.ethhdr** %7
%50 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %49, i32 0, i32 1
%51 = load i32*, i32** %50
%52 = getelementptr inbounds i32, i32* %51, i64 3
store i32 0, i32* %52
%53 = load %struct.ethhdr*, %struct.ethhdr** %7
%54 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %53, i32 0, i32 1
%55 = load i32*, i32** %54
%56 = getelementptr inbounds i32, i32* %55, i64 4
store i32 0, i32* %56
%57 = load %struct.ethhdr*, %struct.ethhdr** %7
%58 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %57, i32 0, i32 1
%59 = load i32*, i32** %58
%60 = getelementptr inbounds i32, i32* %59, i64 5
store i32 1, i32* %60
%61 = load %struct.ethhdr*, %struct.ethhdr** %7
%62 = getelementptr inbounds %struct.ethhdr, %struct.ethhdr* %61, i32 0, i32 2
store i16 8, i16* %62
%63 = load i8*, i8** %4
%64 = getelementptr inbounds i8, i8* %63, i64 24
%65 = bitcast i8* %64 to %struct.iphdr*
store %struct.iphdr* %65, %struct.iphdr** %8
%66 = load %struct.iphdr*, %struct.iphdr** %8
%67 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %66, i32 0, i32 0
store i32 4, i32* %67
%68 = load %struct.iphdr*, %struct.iphdr** %8
%69 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %68, i32 0, i32 1
store i32 5, i32* %69
%70 = load %struct.iphdr*, %struct.iphdr** %8
%71 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %70, i32 0, i32 10
store i64 0, i64* %71
%72 = load i32, i32* %5
%73 = sext i32 %72 to i64
%74 = sub i64 %73, 24
%75 = trunc i64 %74 to i16
%76 = zext i16 %75 to i32
%77 = and i32 %76, 255
%78 = shl i32 %77, 8
%79 = load i32, i32* %5
%80 = sext i32 %79 to i64
%81 = sub i64 %80, 24
%82 = trunc i64 %81 to i16
%83 = zext i16 %82 to i32
%84 = and i32 %83, 65280
%85 = ashr i32 %84, 8
%86 = or i32 %78, %85
%87 = trunc i32 %86 to i16
%88 = load %struct.iphdr*, %struct.iphdr** %8
%89 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %88, i32 0, i32 2
store i16 %87, i16* %89
%90 = load %struct.iphdr*, %struct.iphdr** %8
%91 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %90, i32 0, i32 9
store i64 0, i64* %91
%92 = load %struct.iphdr*, %struct.iphdr** %8
%93 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %92, i32 0, i32 8
store i64 0, i64* %93
%94 = load %struct.iphdr*, %struct.iphdr** %8
%95 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %94, i32 0, i32 3
store i32 32, i32* %95
%96 = load %struct.iphdr*, %struct.iphdr** %8
%97 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %96, i32 0, i32 4
store i32 17, i32* %97
%98 = load %struct.iphdr*, %struct.iphdr** %8
%99 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %98, i32 0, i32 5
store i64 16777226, i64* %99
%100 = load i32*, i32** %6
%101 = call i32 @myrand(i32* %100)
%102 = sext i32 %101 to i64
%103 = and i64 %102, 255
%104 = shl i64 %103, 24
%105 = load i32*, i32** %6
%106 = call i32 @myrand(i32* %105)
%107 = sext i32 %106 to i64
%108 = and i64 %107, 65280
%109 = shl i64 %108, 8
%110 = or i64 %104, %109
%111 = load i32*, i32** %6
%112 = call i32 @myrand(i32* %111)
%113 = sext i32 %112 to i64
%114 = and i64 %113, 16711680
%115 = lshr i64 %114, 8
%116 = or i64 %110, %115
%117 = load i32*, i32** %6
%118 = call i32 @myrand(i32* %117)
%119 = sext i32 %118 to i64
%120 = and i64 %119, 4278190080
%121 = lshr i64 %120, 24
%122 = or i64 %116, %121
%123 = load %struct.iphdr*, %struct.iphdr** %8
%124 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %123, i32 0, i32 6
store i64 %122, i64* %124
%125 = load %struct.iphdr*, %struct.iphdr** %8
%126 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %125, i32 0, i32 7
store i64 0, i64* %126
%127 = load %struct.iphdr*, %struct.iphdr** %8
%128 = load %struct.iphdr*, %struct.iphdr** %8
%129 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %128, i32 0, i32 1
%130 = load i32, i32* %129
%131 = call i64 @ip_fast_csum(%struct.iphdr* %127, i32 %130)
%132 = load %struct.iphdr*, %struct.iphdr** %8
%133 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %132, i32 0, i32 7
store i64 %131, i64* %133
%134 = load %struct.iphdr*, %struct.iphdr** %8
%135 = bitcast %struct.iphdr* %134 to i8*
%136 = getelementptr inbounds i8, i8* %135, i64 72
%137 = bitcast i8* %136 to %struct.udphdr*
store %struct.udphdr* %137, %struct.udphdr** %9
%138 = load i32*, i32** %6
%139 = call i32 @myrand(i32* %138)
store i32 %139, i32* %10
%140 = load i32, i32* %10
%141 = and i32 %140, 65535
%142 = trunc i32 %141 to i16
%143 = zext i16 %142 to i32
%144 = and i32 %143, 255
%145 = shl i32 %144, 8
%146 = load i32, i32* %10
%147 = and i32 %146, 65535
%148 = trunc i32 %147 to i16
%149 = zext i16 %148 to i32
%150 = and i32 %149, 65280
%151 = ashr i32 %150, 8
%152 = or i32 %145, %151
%153 = trunc i32 %152 to i16
%154 = load %struct.udphdr*, %struct.udphdr** %9
%155 = getelementptr inbounds %struct.udphdr, %struct.udphdr* %154, i32 0, i32 0
store i16 %153, i16* %155
%156 = load i32, i32* %10
%157 = ashr i32 %156, 16
%158 = and i32 %157, 65535
%159 = trunc i32 %158 to i16
%160 = zext i16 %159 to i32
%161 = and i32 %160, 255
%162 = shl i32 %161, 8
%163 = load i32, i32* %10
%164 = ashr i32 %163, 16
%165 = and i32 %164, 65535
%166 = trunc i32 %165 to i16
%167 = zext i16 %166 to i32
%168 = and i32 %167, 65280
%169 = ashr i32 %168, 8
%170 = or i32 %162, %169
%171 = trunc i32 %170 to i16
%172 = load %struct.udphdr*, %struct.udphdr** %9
%173 = getelementptr inbounds %struct.udphdr, %struct.udphdr* %172, i32 0, i32 1
store i16 %171, i16* %173
%174 = load i32, i32* %5
%175 = sext i32 %174 to i64
%176 = sub i64 %175, 24
%177 = sub i64 %176, 72
%178 = trunc i64 %177 to i16
%179 = zext i16 %178 to i32
%180 = and i32 %179, 255
%181 = shl i32 %180, 8
%182 = load i32, i32* %5
%183 = sext i32 %182 to i64
%184 = sub i64 %183, 24
%185 = sub i64 %184, 72
%186 = trunc i64 %185 to i16
%187 = zext i16 %186 to i32
%188 = and i32 %187, 65280
%189 = ashr i32 %188, 8
%190 = or i32 %181, %189
%191 = trunc i32 %190 to i16
%192 = load %struct.udphdr*, %struct.udphdr** %9
%193 = getelementptr inbounds %struct.udphdr, %struct.udphdr* %192, i32 0, i32 2
store i16 %191, i16* %193
%194 = load %struct.udphdr*, %struct.udphdr** %9
%195 = getelementptr inbounds %struct.udphdr, %struct.udphdr* %194, i32 0, i32 3
store i64 0, i64* %195
ret void
}

LLVM IR (-O2):
%struct.iphdr = type { i32, i32, i16, i32, i32, i64, i64, i64, i64, i64, i64 }
define void @build_packet(i8* %0, i32 %1, i32* %2) {
%4 = bitcast i8* %0 to i32**
%5 = load i32*, i32** %4
%6 = getelementptr inbounds i32, i32* %5, i64 5
%7 = bitcast i32* %5 to i8*
store i32 2, i32* %6
%8 = getelementptr inbounds i8, i8* %0, i64 8
%9 = bitcast i8* %8 to i32**
%10 = load i32*, i32** %9
%11 = getelementptr inbounds i32, i32* %10, i64 5
%12 = bitcast i32* %10 to i8*
store i32 1, i32* %11
%13 = getelementptr inbounds i8, i8* %0, i64 16
%14 = bitcast i8* %13 to i16*
store i16 8, i16* %14
%15 = getelementptr inbounds i8, i8* %0, i64 24
%16 = bitcast i8* %15 to %struct.iphdr*
%17 = bitcast i8* %15 to i32*
store i32 4, i32* %17
%18 = getelementptr inbounds i8, i8* %0, i64 28
%19 = bitcast i8* %18 to i32*
store i32 5, i32* %19
%20 = getelementptr inbounds i8, i8* %0, i64 88
%21 = bitcast i8* %20 to i64*
store i64 0, i64* %21
%22 = trunc i32 %1 to i16
%23 = add i16 %22, -24
%24 = tail call i16 @llvm.bswap.i16(i16 %23)
%25 = getelementptr inbounds i8, i8* %0, i64 32
%26 = bitcast i8* %25 to i16*
store i16 %24, i16* %26
%27 = getelementptr inbounds i8, i8* %0, i64 72
%28 = getelementptr inbounds i8, i8* %0, i64 36
%29 = bitcast i8* %28 to i32*
store i32 32, i32* %29
%30 = getelementptr inbounds i8, i8* %0, i64 40
%31 = bitcast i8* %30 to i32*
store i32 17, i32* %31
%32 = getelementptr inbounds i8, i8* %0, i64 48
%33 = bitcast i8* %32 to i64*
store i64 16777226, i64* %33
%34 = tail call i32 @myrand(i32* %2)
%35 = shl i32 %34, 24
%36 = tail call i32 @myrand(i32* %2)
%37 = shl i32 %36, 8
%38 = and i32 %37, 16711680
%39 = or i32 %38, %35
%40 = tail call i32 @myrand(i32* %2)
%41 = lshr i32 %40, 8
%42 = and i32 %41, 65280
%43 = or i32 %39, %42
%44 = tail call i32 @myrand(i32* %2)
%45 = lshr i32 %44, 24
%46 = or i32 %43, %45
%47 = zext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %0, i64 56
%49 = bitcast i8* %48 to i64*
store i64 %47, i64* %49
%50 = getelementptr inbounds i8, i8* %0, i64 64
%51 = bitcast i8* %50 to i64*
store i64 0, i64* %51
%52 = load i32, i32* %19
%53 = tail call i64 @ip_fast_csum(%struct.iphdr* %16, i32 %52)
store i64 %53, i64* %51
%54 = getelementptr inbounds i8, i8* %0, i64 96
%55 = tail call i32 @myrand(i32* %2)
%56 = trunc i32 %55 to i16
%57 = tail call i16 @llvm.bswap.i16(i16 %56)
%58 = bitcast i8* %54 to i16*
store i16 %57, i16* %58
%59 = lshr i32 %55, 8
%60 = and i32 %59, 65280
%61 = lshr i32 %55, 24
%62 = or i32 %60, %61
%63 = trunc i32 %62 to i16
%64 = getelementptr inbounds i8, i8* %0, i64 98
%65 = bitcast i8* %64 to i16*
store i16 %63, i16* %65
%66 = add i16 %22, -96
%67 = tail call i16 @llvm.bswap.i16(i16 %66)
%68 = getelementptr inbounds i8, i8* %0, i64 100
%69 = bitcast i8* %68 to i16*
store i16 %67, i16* %69
%70 = getelementptr inbounds i8, i8* %0, i64 104
%71 = bitcast i8* %70 to i64*
store i64 0, i64* %71
ret void
}