#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 */
typedef int /*<<< orphan*/ uint8_t;
typedef void *uint32_t;
typedef void *uint16_t;
typedef int /*<<< orphan*/ u_int16_t;
struct TYPE_4__ {
  void *s_addr;
};
struct TYPE_3__ {
  void *s_addr;
};
struct tcphdr {
  int ip_hl;
  int ip_v;
  int ip_ttl;
  int th_win;
  int th_off;
  void *th_sum;
  TYPE_2__ ip_dst;
  TYPE_1__ ip_src;
  void *ip_sum;
  scalar_t__ th_urp;
  int /*<<< orphan*/ th_flags;
  void *th_ack;
  void *th_seq;
  void *th_dport;
  void *th_sport;
  void *ip_len;
  int /*<<< orphan*/ ip_p;
  void *ip_off;
  scalar_t__ ip_id;
  scalar_t__ ip_tos;
};
struct ip {
  int ip_hl;
  int ip_v;
  int ip_ttl;
  int th_win;
  int th_off;
  void *th_sum;
  TYPE_2__ ip_dst;
  TYPE_1__ ip_src;
  void *ip_sum;
  scalar_t__ th_urp;
  int /*<<< orphan*/ th_flags;
  void *th_ack;
  void *th_seq;
  void *th_dport;
  void *th_sport;
  void *ip_len;
  int /*<<< orphan*/ ip_p;
  void *ip_off;
  scalar_t__ ip_id;
  scalar_t__ ip_tos;
};
typedef size_t ssize_t;

/* Variables and functions */
int /*<<< orphan*/ IPPROTO_TCP;
size_t IP_DF;
void *checksum(void **, int);
void *htons(size_t);
int /*<<< orphan*/ memcpy(char *, int /*<<< orphan*/ *, size_t);
int /*<<< orphan*/ memset(struct tcphdr *, int /*<<< orphan*/, int);
void *tcp_sum_calc(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                   int /*<<< orphan*/ *);
ssize_t build_tcp_packet(uint8_t *data, size_t len, uint8_t tcph_flags,
                         uint32_t iph_saddr, uint32_t iph_daddr,
                         uint16_t tcph_sport, uint16_t tcph_dport,
                         uint32_t tcph_seq, uint32_t tcph_ack, uint8_t *payload,
                         size_t payload_len) {
  size_t tot_data_len = sizeof(struct ip) + sizeof(struct tcphdr) + payload_len;
  if (len < tot_data_len)
    return 0;
  struct ip *o_iph;
  struct tcphdr *o_tcph;
  o_iph = (struct ip *)data;
  memset(o_iph, 0, sizeof(struct ip));
  o_iph->ip_hl = sizeof(struct ip) >> 2;
  o_iph->ip_v = 4;
  o_iph->ip_tos = 0;
  o_iph->ip_id = 0;
  o_iph->ip_off = htons(IP_DF);
  o_iph->ip_p = IPPROTO_TCP;
  o_iph->ip_len = htons(tot_data_len);
  o_iph->ip_sum = 0;
  o_iph->ip_ttl = 64;
  o_iph->ip_src.s_addr = iph_saddr;
  o_iph->ip_dst.s_addr = iph_daddr;
  o_tcph = (struct tcphdr *)((char *)o_iph + sizeof(struct ip));
  memset(o_tcph, 0, sizeof(struct tcphdr));
  o_tcph->th_sport = tcph_sport;
  o_tcph->th_dport = tcph_dport;
  o_tcph->th_seq = tcph_seq;
  o_tcph->th_ack = tcph_ack;
  o_tcph->th_flags = tcph_flags;
  o_tcph->th_win = 0xffffU;
  o_tcph->th_off = sizeof(struct tcphdr) / 4;
  o_tcph->th_sum = 0;
  o_tcph->th_urp = 0;
  if (payload_len > 0) {
    memcpy((char *)o_tcph + sizeof(struct tcphdr), payload, payload_len);
  }
  uint16_t csum = checksum((uint16_t *)o_iph, o_iph->ip_hl << 2);
  o_iph->ip_sum = csum;
  csum = tcp_sum_calc(sizeof(struct tcphdr) + payload_len,
                      (u_int16_t *)&o_iph->ip_src.s_addr,
                      (u_int16_t *)&o_iph->ip_dst.s_addr, (u_int16_t *)o_tcph);
  o_tcph->th_sum = csum;
  return tot_data_len;
}


x86 assembly (clang, -O0):
<build_tcp_packet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    0x30(%rbp),%rax
add    $0x120,%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x40(%rbp),%rax
jae    11ac <build_tcp_packet+0x5c>
movq   $0x0,-0x8(%rbp)
jmp    136c <build_tcp_packet+0x21c>
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
xor    %esi,%esi
mov    $0x90,%edx
call   1050 <memset@plt>
mov    -0x48(%rbp),%rax
movl   $0x24,(%rax)
mov    -0x48(%rbp),%rax
movl   $0x4,0x4(%rax)
mov    -0x48(%rbp),%rax
movq   $0x0,0x88(%rax)
mov    -0x48(%rbp),%rax
movq   $0x0,0x80(%rax)
mov    0x2dea(%rip),%rax
mov    (%rax),%rdi
call   1030 <htons@plt>
mov    %rax,%rcx
mov    -0x48(%rbp),%rax
mov    %rcx,0x78(%rax)
mov    0x2dc8(%rip),%rax
mov    (%rax),%ecx
mov    -0x48(%rbp),%rax
mov    %ecx,0x70(%rax)
mov    -0x40(%rbp),%rdi
call   1030 <htons@plt>
mov    %rax,%rcx
mov    -0x48(%rbp),%rax
mov    %rcx,0x68(%rax)
mov    -0x48(%rbp),%rax
movq   $0x0,0x30(%rax)
mov    -0x48(%rbp),%rax
movl   $0x40,0x8(%rax)
mov    -0x28(%rbp),%rcx
mov    -0x48(%rbp),%rax
mov    %rcx,0x28(%rax)
mov    -0x30(%rbp),%rcx
mov    -0x48(%rbp),%rax
mov    %rcx,0x20(%rax)
mov    -0x48(%rbp),%rax
add    $0x90,%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x90,%edx
call   1050 <memset@plt>
mov    -0x38(%rbp),%rcx
mov    -0x50(%rbp),%rax
mov    %rcx,0x60(%rax)
mov    0x10(%rbp),%rcx
mov    -0x50(%rbp),%rax
mov    %rcx,0x58(%rax)
mov    0x18(%rbp),%rcx
mov    -0x50(%rbp),%rax
mov    %rcx,0x50(%rax)
mov    0x20(%rbp),%rcx
mov    -0x50(%rbp),%rax
mov    %rcx,0x48(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x50(%rbp),%rax
mov    %ecx,0x40(%rax)
mov    -0x50(%rbp),%rax
movl   $0xffff,0xc(%rax)
mov    -0x50(%rbp),%rax
movl   $0x24,0x10(%rax)
mov    -0x50(%rbp),%rax
movq   $0x0,0x18(%rax)
mov    -0x50(%rbp),%rax
movq   $0x0,0x38(%rax)
cmpq   $0x0,0x30(%rbp)
jbe    130d <build_tcp_packet+0x1bd>
mov    -0x50(%rbp),%rdi
add    $0x90,%rdi
mov    0x28(%rbp),%rsi
mov    0x30(%rbp),%rdx
call   1060 <memcpy@plt>
mov    -0x48(%rbp),%rdi
mov    -0x48(%rbp),%rax
mov    (%rax),%esi
shl    $0x2,%esi
call   1040 <checksum@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rcx
mov    -0x48(%rbp),%rax
mov    %rcx,0x30(%rax)
mov    0x30(%rbp),%rax
add    $0x90,%rax
mov    %eax,%edi
mov    -0x48(%rbp),%rsi
add    $0x28,%rsi
mov    -0x48(%rbp),%rdx
add    $0x20,%rdx
mov    -0x50(%rbp),%rcx
call   1070 <tcp_sum_calc@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rcx
mov    -0x50(%rbp),%rax
mov    %rcx,0x18(%rax)
mov    -0x40(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_tcp_packet>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    0x70(%rsp),%r15
lea    0x120(%r15),%r14
cmp    %rsi,%r14
jbe    1177 <build_tcp_packet+0x27>
xor    %r14d,%r14d
jmp    12bd <build_tcp_packet+0x16d>
mov    %r9,%r12
mov    %r8,%r13
mov    %rcx,%rbp
mov    %rdi,%rbx
xor    %esi,%esi
mov    %edx,0x4(%rsp)
mov    $0x90,%edx
call   1050 <memset@plt>
movabs $0x400000024,%rax
mov    %rax,(%rbx)
xorps  %xmm0,%xmm0
movups %xmm0,0x80(%rbx)
mov    0x2e37(%rip),%rax
mov    (%rax),%rdi
call   1030 <htons@plt>
mov    %rax,0x78(%rbx)
mov    0x2e1c(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x70(%rbx)
mov    %r14,%rdi
call   1030 <htons@plt>
mov    %rax,0x68(%rbx)
movq   $0x0,0x30(%rbx)
movl   $0x40,0x8(%rbx)
lea    0x28(%rbx),%rax
mov    %rax,0x10(%rsp)
mov    %rbp,0x28(%rbx)
lea    0x20(%rbx),%rax
mov    %rax,0x8(%rsp)
mov    %r13,0x20(%rbx)
lea    0x90(%rbx),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x90,%edx
call   1050 <memset@plt>
mov    %r12,0xf0(%rbx)
mov    0x50(%rsp),%rax
mov    %rax,0xe8(%rbx)
mov    0x58(%rsp),%rax
mov    %rax,0xe0(%rbx)
mov    0x60(%rsp),%rax
mov    %rax,0xd8(%rbx)
mov    0x4(%rsp),%eax
mov    %eax,0xd0(%rbx)
movabs $0x240000ffff,%rax
mov    %rax,0x9c(%rbx)
movq   $0x0,0xa8(%rbx)
movq   $0x0,0xc8(%rbx)
test   %r15,%r15
je     1289 <build_tcp_packet+0x139>
mov    0x68(%rsp),%rsi
lea    0x120(%rbx),%rdi
mov    %r15,%rdx
call   1060 <memcpy@plt>
mov    (%rbx),%esi
shl    $0x2,%esi
mov    %rbx,%rdi
call   1040 <checksum@plt>
mov    %rax,0x30(%rbx)
add    $0x90,%r15d
mov    %r15d,%edi
mov    0x10(%rsp),%rsi
mov    0x8(%rsp),%rdx
mov    %rbp,%rcx
call   1070 <tcp_sum_calc@plt>
mov    %rax,0xa8(%rbx)
mov    %r14,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.ip = type { i32, i32, i32, i32, i32, i8*, %struct.TYPE_4__, %struct.TYPE_3__, i8*, i64, i32, i8*, i8*, i8*, i8*, i8*, i32, i8*, i64, i64 }
%struct.TYPE_4__ = type { i8* }
%struct.TYPE_3__ = type { i8* }
%struct.tcphdr = type { i32, i32, i32, i32, i32, i8*, %struct.TYPE_4__, %struct.TYPE_3__, i8*, i64, i32, i8*, i8*, i8*, i8*, i8*, i32, i8*, i64, i64 }
@IP_DF = global i64 0
@IPPROTO_TCP = global i32 0
define i64 @build_tcp_packet(i32* %0, i64 %1, i32 %2, i8* %3, i8* %4, i8* %5, i8* %6, i8* %7, i8* %8, i32* %9, i64 %10) {
%12 = alloca i64
%13 = alloca i32*
%14 = alloca i64
%15 = alloca i32
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca i8*
%20 = alloca i8*
%21 = alloca i8*
%22 = alloca i32*
%23 = alloca i64
%24 = alloca i64
%25 = alloca %struct.ip*
%26 = alloca %struct.tcphdr*
%27 = alloca i8*
store i32* %0, i32** %13
store i64 %1, i64* %14
store i32 %2, i32* %15
store i8* %3, i8** %16
store i8* %4, i8** %17
store i8* %5, i8** %18
store i8* %6, i8** %19
store i8* %7, i8** %20
store i8* %8, i8** %21
store i32* %9, i32** %22
store i64 %10, i64* %23
%28 = load i64, i64* %23
%29 = add i64 288, %28
store i64 %29, i64* %24
%30 = load i64, i64* %14
%31 = load i64, i64* %24
%32 = icmp ult i64 %30, %31
br i1 %32, label %33, label %34
33: ; preds = %11
store i64 0, i64* %12
br label %138
34: ; preds = %11
%35 = load i32*, i32** %13
%36 = bitcast i32* %35 to %struct.ip*
store %struct.ip* %36, %struct.ip** %25
%37 = load %struct.ip*, %struct.ip** %25
%38 = bitcast %struct.ip* %37 to %struct.tcphdr*
%39 = call i32 @memset(%struct.tcphdr* %38, i32 0, i32 144)
%40 = load %struct.ip*, %struct.ip** %25
%41 = getelementptr inbounds %struct.ip, %struct.ip* %40, i32 0, i32 0
store i32 36, i32* %41
%42 = load %struct.ip*, %struct.ip** %25
%43 = getelementptr inbounds %struct.ip, %struct.ip* %42, i32 0, i32 1
store i32 4, i32* %43
%44 = load %struct.ip*, %struct.ip** %25
%45 = getelementptr inbounds %struct.ip, %struct.ip* %44, i32 0, i32 19
store i64 0, i64* %45
%46 = load %struct.ip*, %struct.ip** %25
%47 = getelementptr inbounds %struct.ip, %struct.ip* %46, i32 0, i32 18
store i64 0, i64* %47
%48 = load i64, i64* @IP_DF
%49 = call i8* @htons(i64 %48)
%50 = load %struct.ip*, %struct.ip** %25
%51 = getelementptr inbounds %struct.ip, %struct.ip* %50, i32 0, i32 17
store i8* %49, i8** %51
%52 = load i32, i32* @IPPROTO_TCP
%53 = load %struct.ip*, %struct.ip** %25
%54 = getelementptr inbounds %struct.ip, %struct.ip* %53, i32 0, i32 16
store i32 %52, i32* %54
%55 = load i64, i64* %24
%56 = call i8* @htons(i64 %55)
%57 = load %struct.ip*, %struct.ip** %25
%58 = getelementptr inbounds %struct.ip, %struct.ip* %57, i32 0, i32 15
store i8* %56, i8** %58
%59 = load %struct.ip*, %struct.ip** %25
%60 = getelementptr inbounds %struct.ip, %struct.ip* %59, i32 0, i32 8
store i8* null, i8** %60
%61 = load %struct.ip*, %struct.ip** %25
%62 = getelementptr inbounds %struct.ip, %struct.ip* %61, i32 0, i32 2
store i32 64, i32* %62
%63 = load i8*, i8** %16
%64 = load %struct.ip*, %struct.ip** %25
%65 = getelementptr inbounds %struct.ip, %struct.ip* %64, i32 0, i32 7
%66 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %65, i32 0, i32 0
store i8* %63, i8** %66
%67 = load i8*, i8** %17
%68 = load %struct.ip*, %struct.ip** %25
%69 = getelementptr inbounds %struct.ip, %struct.ip* %68, i32 0, i32 6
%70 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %69, i32 0, i32 0
store i8* %67, i8** %70
%71 = load %struct.ip*, %struct.ip** %25
%72 = bitcast %struct.ip* %71 to i8*
%73 = getelementptr inbounds i8, i8* %72, i64 144
%74 = bitcast i8* %73 to %struct.tcphdr*
store %struct.tcphdr* %74, %struct.tcphdr** %26
%75 = load %struct.tcphdr*, %struct.tcphdr** %26
%76 = call i32 @memset(%struct.tcphdr* %75, i32 0, i32 144)
%77 = load i8*, i8** %18
%78 = load %struct.tcphdr*, %struct.tcphdr** %26
%79 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %78, i32 0, i32 14
store i8* %77, i8** %79
%80 = load i8*, i8** %19
%81 = load %struct.tcphdr*, %struct.tcphdr** %26
%82 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %81, i32 0, i32 13
store i8* %80, i8** %82
%83 = load i8*, i8** %20
%84 = load %struct.tcphdr*, %struct.tcphdr** %26
%85 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %84, i32 0, i32 12
store i8* %83, i8** %85
%86 = load i8*, i8** %21
%87 = load %struct.tcphdr*, %struct.tcphdr** %26
%88 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %87, i32 0, i32 11
store i8* %86, i8** %88
%89 = load i32, i32* %15
%90 = load %struct.tcphdr*, %struct.tcphdr** %26
%91 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %90, i32 0, i32 10
store i32 %89, i32* %91
%92 = load %struct.tcphdr*, %struct.tcphdr** %26
%93 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %92, i32 0, i32 3
store i32 65535, i32* %93
%94 = load %struct.tcphdr*, %struct.tcphdr** %26
%95 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %94, i32 0, i32 4
store i32 36, i32* %95
%96 = load %struct.tcphdr*, %struct.tcphdr** %26
%97 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %96, i32 0, i32 5
store i8* null, i8** %97
%98 = load %struct.tcphdr*, %struct.tcphdr** %26
%99 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %98, i32 0, i32 9
store i64 0, i64* %99
%100 = load i64, i64* %23
%101 = icmp ugt i64 %100, 0
br i1 %101, label %102, label %109
102: ; preds = %34
%103 = load %struct.tcphdr*, %struct.tcphdr** %26
%104 = bitcast %struct.tcphdr* %103 to i8*
%105 = getelementptr inbounds i8, i8* %104, i64 144
%106 = load i32*, i32** %22
%107 = load i64, i64* %23
%108 = call i32 @memcpy(i8* %105, i32* %106, i64 %107)
br label %109
109: ; preds = %102, %34
%110 = load %struct.ip*, %struct.ip** %25
%111 = bitcast %struct.ip* %110 to i8**
%112 = load %struct.ip*, %struct.ip** %25
%113 = getelementptr inbounds %struct.ip, %struct.ip* %112, i32 0, i32 0
%114 = load i32, i32* %113
%115 = shl i32 %114, 2
%116 = call i8* @checksum(i8** %111, i32 %115)
store i8* %116, i8** %27
%117 = load i8*, i8** %27
%118 = load %struct.ip*, %struct.ip** %25
%119 = getelementptr inbounds %struct.ip, %struct.ip* %118, i32 0, i32 8
store i8* %117, i8** %119
%120 = load i64, i64* %23
%121 = add i64 144, %120
%122 = trunc i64 %121 to i32
%123 = load %struct.ip*, %struct.ip** %25
%124 = getelementptr inbounds %struct.ip, %struct.ip* %123, i32 0, i32 7
%125 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %124, i32 0, i32 0
%126 = bitcast i8** %125 to i32*
%127 = load %struct.ip*, %struct.ip** %25
%128 = getelementptr inbounds %struct.ip, %struct.ip* %127, i32 0, i32 6
%129 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %128, i32 0, i32 0
%130 = bitcast i8** %129 to i32*
%131 = load %struct.tcphdr*, %struct.tcphdr** %26
%132 = bitcast %struct.tcphdr* %131 to i32*
%133 = call i8* @tcp_sum_calc(i32 %122, i32* %126, i32* %130, i32* %132)
store i8* %133, i8** %27
%134 = load i8*, i8** %27
%135 = load %struct.tcphdr*, %struct.tcphdr** %26
%136 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %135, i32 0, i32 5
store i8* %134, i8** %136
%137 = load i64, i64* %24
store i64 %137, i64* %12
br label %138
138: ; preds = %109, %33
%139 = load i64, i64* %12
ret i64 %139
}

LLVM IR (-O2):
%struct.tcphdr = type { i32, i32, i32, i32, i32, i8*, %struct.TYPE_4__, %struct.TYPE_3__, i8*, i64, i32, i8*, i8*, i8*, i8*, i8*, i32, i8*, i64, i64 }
%struct.TYPE_4__ = type { i8* }
%struct.TYPE_3__ = type { i8* }
@IP_DF = global i64 0
@IPPROTO_TCP = global i32 0
define i64 @build_tcp_packet(i32* %0, i64 %1, i32 %2, i8* %3, i8* %4, i8* %5, i8* %6, i8* %7, i8* %8, i32* %9, i64 %10) {
%12 = add i64 %10, 288
%13 = icmp ugt i64 %12, %1
br i1 %13, label %67, label %14
14: ; preds = %11
%15 = bitcast i32* %0 to %struct.tcphdr*
%16 = tail call i32 @memset(%struct.tcphdr* %15, i32 0, i32 144)
store i32 36, i32* %0
%17 = getelementptr inbounds i32, i32* %0, i64 1
store i32 4, i32* %17
%18 = getelementptr inbounds i32, i32* %0, i64 32
%19 = bitcast i32* %18 to i8*
%20 = load i64, i64* @IP_DF
%21 = tail call i8* @htons(i64 %20)
%22 = getelementptr inbounds i32, i32* %0, i64 30
%23 = bitcast i32* %22 to i8**
store i8* %21, i8** %23
%24 = load i32, i32* @IPPROTO_TCP
%25 = getelementptr inbounds i32, i32* %0, i64 28
store i32 %24, i32* %25
%26 = tail call i8* @htons(i64 %12)
%27 = getelementptr inbounds i32, i32* %0, i64 26
%28 = bitcast i32* %27 to i8**
store i8* %26, i8** %28
%29 = getelementptr inbounds i32, i32* %0, i64 12
%30 = bitcast i32* %29 to i8**
store i8* null, i8** %30
%31 = getelementptr inbounds i32, i32* %0, i64 2
store i32 64, i32* %31
%32 = getelementptr inbounds i32, i32* %0, i64 10
%33 = bitcast i32* %32 to i8**
store i8* %3, i8** %33
%34 = getelementptr inbounds i32, i32* %0, i64 8
%35 = bitcast i32* %34 to i8**
store i8* %4, i8** %35
%36 = getelementptr inbounds i32, i32* %0, i64 36
%37 = bitcast i32* %36 to %struct.tcphdr*
%38 = tail call i32 @memset(%struct.tcphdr* %37, i32 0, i32 144)
%39 = getelementptr inbounds i32, i32* %0, i64 60
%40 = bitcast i32* %39 to i8**
store i8* %5, i8** %40
%41 = getelementptr inbounds i32, i32* %0, i64 58
%42 = bitcast i32* %41 to i8**
store i8* %6, i8** %42
%43 = getelementptr inbounds i32, i32* %0, i64 56
%44 = bitcast i32* %43 to i8**
store i8* %7, i8** %44
%45 = getelementptr inbounds i32, i32* %0, i64 54
%46 = bitcast i32* %45 to i8**
store i8* %8, i8** %46
%47 = getelementptr inbounds i32, i32* %0, i64 52
store i32 %2, i32* %47
%48 = getelementptr inbounds i32, i32* %0, i64 39
store i32 65535, i32* %48
%49 = getelementptr inbounds i32, i32* %0, i64 40
store i32 36, i32* %49
%50 = getelementptr inbounds i32, i32* %0, i64 42
%51 = bitcast i32* %50 to i8**
store i8* null, i8** %51
%52 = getelementptr inbounds i32, i32* %0, i64 50
%53 = bitcast i32* %52 to i64*
store i64 0, i64* %53
%54 = icmp eq i64 %10, 0
br i1 %54, label %59, label %55
55: ; preds = %14
%56 = getelementptr inbounds i32, i32* %0, i64 72
%57 = bitcast i32* %56 to i8*
%58 = tail call i32 @memcpy(i8* %57, i32* %9, i64 %10)
br label %59
59: ; preds = %55, %14
%60 = bitcast i32* %0 to i8**
%61 = load i32, i32* %0
%62 = shl i32 %61, 2
%63 = tail call i8* @checksum(i8** %60, i32 %62)
store i8* %63, i8** %30
%64 = trunc i64 %10 to i32
%65 = add i32 %64, 144
%66 = tail call i8* @tcp_sum_calc(i32 %65, i32* %32, i32* %34, i32* %36)
store i8* %66, i8** %51
br label %67
67: ; preds = %11, %59
%68 = phi i64 [ %12, %59 ], [ 0, %11 ]
ret i64 %68
}