#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 */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct udphdr {
  int dummy;
};
struct TYPE_4__ {
  void *s_addr;
};
struct TYPE_3__ {
  void *s_addr;
};
struct ip {
  int ip_v;
  int ip_hl;
  int ip_len;
  int ip_ttl;
  int ip_id;
  TYPE_2__ ip_dst;
  TYPE_1__ ip_src;
  scalar_t__ ip_sum;
  int /*<<< orphan*/ ip_p;
  scalar_t__ ip_off;
  scalar_t__ ip_tos;
};

/* Variables and functions */
int /*<<< orphan*/ IPPROTO_UDP;
void *inet_addr(char *);
void setupIpHeader(struct ip *ipH) {
  ipH->ip_v = 4;
  ipH->ip_hl = 5;
  ipH->ip_tos = 0;
  ipH->ip_len = sizeof(struct ip) + sizeof(struct udphdr) + 200;
  ipH->ip_ttl = 255;
  ipH->ip_off = 0;
  ipH->ip_id = sizeof(45);
  ipH->ip_p = IPPROTO_UDP;
  ipH->ip_sum = 0;
  ipH->ip_src.s_addr = inet_addr("1.1.1.1");
  ipH->ip_dst.s_addr = inet_addr("1.1.1.1");
}


x86 assembly (clang, -O0):
<setupIpHeader>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x4,(%rax)
mov    -0x8(%rbp),%rax
movl   $0x5,0x4(%rax)
mov    -0x8(%rbp),%rax
movq   $0x0,0x40(%rax)
mov    -0x8(%rbp),%rax
movl   $0x114,0x8(%rax)
mov    -0x8(%rbp),%rax
movl   $0xff,0xc(%rax)
mov    -0x8(%rbp),%rax
movq   $0x0,0x38(%rax)
mov    -0x8(%rbp),%rax
movl   $0x4,0x10(%rax)
mov    0x2e67(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x30(%rax)
mov    -0x8(%rbp),%rax
movq   $0x0,0x28(%rax)
lea    0xe73(%rip),%rdi
call   1030 <inet_addr@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x20(%rax)
lea    0xe5c(%rip),%rdi
call   1030 <inet_addr@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x18(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setupIpHeader>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movaps 0xee2(%rip),%xmm0
movups %xmm0,(%rdi)
xorps  %xmm0,%xmm0
movups %xmm0,0x38(%rdi)
movl   $0x4,0x10(%rdi)
mov    0x2ea2(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x30(%rdi)
movq   $0x0,0x28(%rdi)
lea    0xec6(%rip),%r14
mov    %r14,%rdi
call   1030 <inet_addr@plt>
mov    %rax,0x20(%rbx)
mov    %r14,%rdi
call   1030 <inet_addr@plt>
mov    %rax,0x18(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.ip = type { i32, i32, i32, i32, i32, %struct.TYPE_4__, %struct.TYPE_3__, i64, i32, i64, i64 }
%struct.TYPE_4__ = type { i8* }
%struct.TYPE_3__ = type { i8* }
@IPPROTO_UDP = global i32 0
@.str = [8 x i8] c"1.1.1.1\00"
define void @setupIpHeader(%struct.ip* %0) {
%2 = alloca %struct.ip*
store %struct.ip* %0, %struct.ip** %2
%3 = load %struct.ip*, %struct.ip** %2
%4 = getelementptr inbounds %struct.ip, %struct.ip* %3, i32 0, i32 0
store i32 4, i32* %4
%5 = load %struct.ip*, %struct.ip** %2
%6 = getelementptr inbounds %struct.ip, %struct.ip* %5, i32 0, i32 1
store i32 5, i32* %6
%7 = load %struct.ip*, %struct.ip** %2
%8 = getelementptr inbounds %struct.ip, %struct.ip* %7, i32 0, i32 10
store i64 0, i64* %8
%9 = load %struct.ip*, %struct.ip** %2
%10 = getelementptr inbounds %struct.ip, %struct.ip* %9, i32 0, i32 2
store i32 276, i32* %10
%11 = load %struct.ip*, %struct.ip** %2
%12 = getelementptr inbounds %struct.ip, %struct.ip* %11, i32 0, i32 3
store i32 255, i32* %12
%13 = load %struct.ip*, %struct.ip** %2
%14 = getelementptr inbounds %struct.ip, %struct.ip* %13, i32 0, i32 9
store i64 0, i64* %14
%15 = load %struct.ip*, %struct.ip** %2
%16 = getelementptr inbounds %struct.ip, %struct.ip* %15, i32 0, i32 4
store i32 4, i32* %16
%17 = load i32, i32* @IPPROTO_UDP
%18 = load %struct.ip*, %struct.ip** %2
%19 = getelementptr inbounds %struct.ip, %struct.ip* %18, i32 0, i32 8
store i32 %17, i32* %19
%20 = load %struct.ip*, %struct.ip** %2
%21 = getelementptr inbounds %struct.ip, %struct.ip* %20, i32 0, i32 7
store i64 0, i64* %21
%22 = call i8* @inet_addr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%23 = load %struct.ip*, %struct.ip** %2
%24 = getelementptr inbounds %struct.ip, %struct.ip* %23, i32 0, i32 6
%25 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %24, i32 0, i32 0
store i8* %22, i8** %25
%26 = call i8* @inet_addr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%27 = load %struct.ip*, %struct.ip** %2
%28 = getelementptr inbounds %struct.ip, %struct.ip* %27, i32 0, i32 5
%29 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %28, i32 0, i32 0
store i8* %26, i8** %29
ret void
}

LLVM IR (-O2):
%struct.ip = type { i32, i32, i32, i32, i32, %struct.TYPE_4__, %struct.TYPE_3__, i64, i32, i64, i64 }
%struct.TYPE_4__ = type { i8* }
%struct.TYPE_3__ = type { i8* }
@IPPROTO_UDP = global i32 0
@.str = [8 x i8] c"1.1.1.1\00"
define void @setupIpHeader(%struct.ip* nocapture writeonly %0) {
%2 = bitcast %struct.ip* %0 to <4 x i32>*
store <4 x i32> <i32 4, i32 5, i32 276, i32 255>, <4 x i32>* %2
%3 = getelementptr inbounds %struct.ip, %struct.ip* %0, i64 0, i32 9
%4 = bitcast i64* %3 to <2 x i64>*
store <2 x i64> zeroinitializer, <2 x i64>* %4
%5 = getelementptr inbounds %struct.ip, %struct.ip* %0, i64 0, i32 4
store i32 4, i32* %5
%6 = load i32, i32* @IPPROTO_UDP
%7 = getelementptr inbounds %struct.ip, %struct.ip* %0, i64 0, i32 8
store i32 %6, i32* %7
%8 = getelementptr inbounds %struct.ip, %struct.ip* %0, i64 0, i32 7
store i64 0, i64* %8
%9 = tail call i8* @inet_addr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds %struct.ip, %struct.ip* %0, i64 0, i32 6, i32 0
store i8* %9, i8** %10
%11 = tail call i8* @inet_addr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%12 = getelementptr inbounds %struct.ip, %struct.ip* %0, i64 0, i32 5, i32 0
store i8* %11, i8** %12
ret void
}