#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*/ t4;
typedef int /*<<< orphan*/ t3;
typedef int /*<<< orphan*/ t2;
typedef int /*<<< orphan*/ t1;
struct rudp {
  int dummy;
};
typedef int /*<<< orphan*/ r4;
typedef int /*<<< orphan*/ r3;
typedef int /*<<< orphan*/ r2;
typedef int /*<<< orphan*/ r1;

/* Variables and functions */
int /*<<< orphan*/ dump(int /*<<< orphan*/);
int /*<<< orphan*/ dump_recv(struct rudp *);
int /*<<< orphan*/ rudp_delete(struct rudp *);
struct rudp *rudp_new(int, int);
int /*<<< orphan*/ rudp_send(struct rudp *, char *, int);
int /*<<< orphan*/ rudp_update(struct rudp *, char *, int, int);
int main() {
  struct rudp *U = rudp_new(1, 5);
  char t1[] = {1, 2, 3, 4};
  char t2[] = {5, 6, 7, 8};
  char t3[] = {
      2, 1, 1, 1, 1, 1, 1, 3, 2, 1, 1,  1,  1,  1,  1, 3, 2, 1, 1, 1, 1, 1,
      1, 3, 2, 1, 1, 1, 1, 1, 1, 3, 2,  1,  1,  1,  1, 1, 1, 3, 2, 1, 1, 1,
      1, 1, 1, 3, 2, 1, 1, 1, 1, 1, 1,  3,  2,  1,  1, 1, 1, 1, 1, 3, 2, 1,
      1, 1, 1, 1, 1, 3, 2, 1, 1, 1, 1,  1,  1,  3,  2, 1, 1, 1, 1, 1, 1, 3,
      2, 1, 1, 1, 1, 1, 1, 3, 2, 1, 1,  1,  1,  1,  1, 3, 2, 1, 1, 1, 1, 1,
      1, 3, 2, 1, 1, 1, 1, 1, 1, 3, 2,  1,  1,  1,  1, 1, 1, 3, 2, 1, 1, 1,
      1, 1, 1, 3, 2, 1, 1, 1, 1, 1, 1,  3,  2,  1,  1, 1, 1, 1, 1, 3, 2, 1,
      1, 1, 1, 1, 1, 3, 2, 1, 1, 1, 1,  1,  1,  3,  2, 1, 1, 1, 1, 1, 1, 3,
      2, 1, 1, 1, 1, 1, 1, 3, 2, 1, 1,  1,  1,  1,  1, 3, 2, 1, 1, 1, 1, 1,
      1, 3, 2, 1, 1, 1, 1, 1, 1, 3, 2,  1,  1,  1,  1, 1, 1, 3, 2, 1, 1, 1,
      1, 1, 1, 3, 2, 1, 1, 1, 1, 1, 1,  3,  2,  1,  1, 1, 1, 1, 1, 3, 2, 1,
      1, 1, 1, 1, 1, 3, 2, 1, 1, 1, 10, 11, 12, 13,
  };
  char t4[] = {4, 3, 2, 1};
  rudp_send(U, t1, sizeof(t1));
  rudp_send(U, t2, sizeof(t2));
  dump(rudp_update(U, NULL, 0, 1));
  dump(rudp_update(U, NULL, 0, 1));
  rudp_send(U, t3, sizeof(t3));
  rudp_send(U, t4, sizeof(t4));
  dump(rudp_update(U, NULL, 0, 1));
  char r1[] = {02, 00, 00, 02, 00, 03};
  dump(rudp_update(U, r1, sizeof(r1), 1));
  dump_recv(U);
  char r2[] = {
      5, 0, 1, 1, 5, 0, 3, 3,
  };
  dump(rudp_update(U, r2, sizeof(r2), 1));
  dump_recv(U);
  char r3[] = {
      5, 0, 0, 0, 5, 0, 5, 5,
  };
  dump(rudp_update(U, r3, sizeof(r3), 0));
  char r4[] = {5, 0, 2, 2};
  dump(rudp_update(U, r4, sizeof(r4), 1));
  dump_recv(U);
  rudp_delete(U);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
mov    $0x5,%esi
call   1090 <rudp_new@plt>
mov    %rax,-0x10(%rbp)
mov    0xe65(%rip),%eax
mov    %eax,-0x14(%rbp)
mov    0xe60(%rip),%eax
mov    %eax,-0x18(%rbp)
lea    -0x120(%rbp),%rdi
lea    0xe5b(%rip),%rsi
mov    $0x100,%edx
call   1060 <memcpy@plt>
mov    0xe43(%rip),%eax
mov    %eax,-0x124(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x4,%edx
call   1030 <rudp_send@plt>
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x4,%edx
call   1030 <rudp_send@plt>
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
mov    $0x1,%ecx
call   1040 <rudp_update@plt>
mov    %eax,%edi
call   1050 <dump@plt>
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
mov    $0x1,%ecx
call   1040 <rudp_update@plt>
mov    %eax,%edi
call   1050 <dump@plt>
mov    -0x10(%rbp),%rdi
lea    -0x120(%rbp),%rsi
mov    $0x100,%edx
call   1030 <rudp_send@plt>
mov    -0x10(%rbp),%rdi
lea    -0x124(%rbp),%rsi
mov    $0x4,%edx
call   1030 <rudp_send@plt>
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
mov    $0x1,%ecx
call   1040 <rudp_update@plt>
mov    %eax,%edi
call   1050 <dump@plt>
mov    0xea0(%rip),%eax
mov    %eax,-0x12a(%rbp)
mov    0xe97(%rip),%ax
mov    %ax,-0x126(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x12a(%rbp),%rsi
mov    $0x6,%edx
mov    $0x1,%ecx
call   1040 <rudp_update@plt>
mov    %eax,%edi
call   1050 <dump@plt>
mov    -0x10(%rbp),%rdi
call   1070 <dump_recv@plt>
mov    0xe61(%rip),%rax
mov    %rax,-0x132(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x132(%rbp),%rsi
mov    $0x8,%edx
mov    $0x1,%ecx
call   1040 <rudp_update@plt>
mov    %eax,%edi
call   1050 <dump@plt>
mov    -0x10(%rbp),%rdi
call   1070 <dump_recv@plt>
mov    0xe31(%rip),%rax
mov    %rax,-0x13a(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x13a(%rbp),%rsi
mov    $0x8,%edx
xor    %ecx,%ecx
call   1040 <rudp_update@plt>
mov    %eax,%edi
call   1050 <dump@plt>
mov    0xcf4(%rip),%eax
mov    %eax,-0x13e(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x13e(%rbp),%rsi
mov    $0x4,%edx
mov    $0x1,%ecx
call   1040 <rudp_update@plt>
mov    %eax,%edi
call   1050 <dump@plt>
mov    -0x10(%rbp),%rdi
call   1070 <dump_recv@plt>
mov    -0x10(%rbp),%rdi
call   1080 <rudp_delete@plt>
xor    %eax,%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x138,%rsp
mov    $0x1,%edi
mov    $0x5,%esi
call   1090 <rudp_new@plt>
mov    %rax,%rbx
movl   $0x4030201,0x1c(%rsp)
04
movl   $0x8070605,0x18(%rsp)
08
lea    0xe5d(%rip),%rsi
lea    0x30(%rsp),%r14
mov    $0x100,%edx
mov    %r14,%rdi
call   1060 <memcpy@plt>
movl   $0x1020304,0x14(%rsp)
01
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <rudp_send@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <rudp_send@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    $0x1,%ecx
call   1040 <rudp_update@plt>
mov    %eax,%edi
call   1050 <dump@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    $0x1,%ecx
call   1040 <rudp_update@plt>
mov    %eax,%edi
call   1050 <dump@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x100,%edx
call   1030 <rudp_send@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <rudp_send@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    $0x1,%ecx
call   1040 <rudp_update@plt>
mov    %eax,%edi
call   1050 <dump@plt>
movw   $0x300,0x10(%rsp)
movl   $0x2000002,0xc(%rsp)
02
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x6,%edx
mov    $0x1,%ecx
call   1040 <rudp_update@plt>
mov    %eax,%edi
call   1050 <dump@plt>
mov    %rbx,%rdi
call   1070 <dump_recv@plt>
movabs $0x303000501010005,%rax
mov    %rax,0x28(%rsp)
lea    0x28(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
mov    $0x1,%ecx
call   1040 <rudp_update@plt>
mov    %eax,%edi
call   1050 <dump@plt>
mov    %rbx,%rdi
call   1070 <dump_recv@plt>
movabs $0x505000500000005,%rax
mov    %rax,0x20(%rsp)
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
xor    %ecx,%ecx
call   1040 <rudp_update@plt>
mov    %eax,%edi
call   1050 <dump@plt>
movl   $0x2020005,0x8(%rsp)
02
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
mov    $0x1,%ecx
call   1040 <rudp_update@plt>
mov    %eax,%edi
call   1050 <dump@plt>
mov    %rbx,%rdi
call   1070 <dump_recv@plt>
mov    %rbx,%rdi
call   1080 <rudp_delete@plt>
xor    %eax,%eax
add    $0x138,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.rudp = type { i32 }
@__const.main.t1 = [4 x i8] c"\01\02\03\04"
@__const.main.t2 = [4 x i8] c"\05\06\07\08"
@__const.main.t3 = [256 x i8] c"\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\0A\0B\0C\0D"
@__const.main.t4 = [4 x i8] c"\04\03\02\01"
@__const.main.r1 = [6 x i8] c"\02\00\00\02\00\03"
@__const.main.r2 = [8 x i8] c"\05\00\01\01\05\00\03\03"
@__const.main.r3 = [8 x i8] c"\05\00\00\00\05\00\05\05"
@__const.main.r4 = [4 x i8] c"\05\00\02\02"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.rudp*
%3 = alloca [4 x i8]
%4 = alloca [4 x i8]
%5 = alloca [256 x i8]
%6 = alloca [4 x i8]
%7 = alloca [6 x i8]
%8 = alloca [8 x i8]
%9 = alloca [8 x i8]
%10 = alloca [4 x i8]
store i32 0, i32* %1
%11 = call %struct.rudp* @rudp_new(i32 1, i32 5)
store %struct.rudp* %11, %struct.rudp** %2
%12 = bitcast [4 x i8]* %3 to i8*
%13 = bitcast [4 x i8]* %4 to i8*
%14 = bitcast [256 x i8]* %5 to i8*
%15 = bitcast [4 x i8]* %6 to i8*
%16 = load %struct.rudp*, %struct.rudp** %2
%17 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%18 = call i32 @rudp_send(%struct.rudp* %16, i8* %17, i32 4)
%19 = load %struct.rudp*, %struct.rudp** %2
%20 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%21 = call i32 @rudp_send(%struct.rudp* %19, i8* %20, i32 4)
%22 = load %struct.rudp*, %struct.rudp** %2
%23 = call i32 @rudp_update(%struct.rudp* %22, i8* null, i32 0, i32 1)
%24 = call i32 @dump(i32 %23)
%25 = load %struct.rudp*, %struct.rudp** %2
%26 = call i32 @rudp_update(%struct.rudp* %25, i8* null, i32 0, i32 1)
%27 = call i32 @dump(i32 %26)
%28 = load %struct.rudp*, %struct.rudp** %2
%29 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%30 = call i32 @rudp_send(%struct.rudp* %28, i8* %29, i32 256)
%31 = load %struct.rudp*, %struct.rudp** %2
%32 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 0
%33 = call i32 @rudp_send(%struct.rudp* %31, i8* %32, i32 4)
%34 = load %struct.rudp*, %struct.rudp** %2
%35 = call i32 @rudp_update(%struct.rudp* %34, i8* null, i32 0, i32 1)
%36 = call i32 @dump(i32 %35)
%37 = bitcast [6 x i8]* %7 to i8*
%38 = load %struct.rudp*, %struct.rudp** %2
%39 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 0
%40 = call i32 @rudp_update(%struct.rudp* %38, i8* %39, i32 6, i32 1)
%41 = call i32 @dump(i32 %40)
%42 = load %struct.rudp*, %struct.rudp** %2
%43 = call i32 @dump_recv(%struct.rudp* %42)
%44 = bitcast [8 x i8]* %8 to i8*
%45 = load %struct.rudp*, %struct.rudp** %2
%46 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%47 = call i32 @rudp_update(%struct.rudp* %45, i8* %46, i32 8, i32 1)
%48 = call i32 @dump(i32 %47)
%49 = load %struct.rudp*, %struct.rudp** %2
%50 = call i32 @dump_recv(%struct.rudp* %49)
%51 = bitcast [8 x i8]* %9 to i8*
%52 = load %struct.rudp*, %struct.rudp** %2
%53 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%54 = call i32 @rudp_update(%struct.rudp* %52, i8* %53, i32 8, i32 0)
%55 = call i32 @dump(i32 %54)
%56 = bitcast [4 x i8]* %10 to i8*
%57 = load %struct.rudp*, %struct.rudp** %2
%58 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 0
%59 = call i32 @rudp_update(%struct.rudp* %57, i8* %58, i32 4, i32 1)
%60 = call i32 @dump(i32 %59)
%61 = load %struct.rudp*, %struct.rudp** %2
%62 = call i32 @dump_recv(%struct.rudp* %61)
%63 = load %struct.rudp*, %struct.rudp** %2
%64 = call i32 @rudp_delete(%struct.rudp* %63)
ret i32 0
}

LLVM IR (-O2):
%struct.rudp = type { i32 }
@__const.main.t3 = [256 x i8] c"\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\01\01\01\03\02\01\01\01\0A\0B\0C\0D"
@__const.main.r1 = [6 x i8] c"\02\00\00\02\00\03"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [256 x i8]
%4 = alloca i32
%5 = alloca [6 x i8]
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
%9 = tail call %struct.rudp* @rudp_new(i32 1, i32 5)
%10 = bitcast i32* %1 to i8*
store i32 67305985, i32* %1
%11 = bitcast i32* %2 to i8*
store i32 134678021, i32* %2
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%13 = bitcast i32* %4 to i8*
store i32 16909060, i32* %4
%14 = call i32 @rudp_send(%struct.rudp* %9, i8* %10, i32 4)
%15 = call i32 @rudp_send(%struct.rudp* %9, i8* %11, i32 4)
%16 = call i32 @rudp_update(%struct.rudp* %9, i8* null, i32 0, i32 1)
%17 = call i32 @dump(i32 %16)
%18 = call i32 @rudp_update(%struct.rudp* %9, i8* null, i32 0, i32 1)
%19 = call i32 @dump(i32 %18)
%20 = call i32 @rudp_send(%struct.rudp* %9, i8* %12, i32 256)
%21 = call i32 @rudp_send(%struct.rudp* %9, i8* %13, i32 4)
%22 = call i32 @rudp_update(%struct.rudp* %9, i8* null, i32 0, i32 1)
%23 = call i32 @dump(i32 %22)
%24 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%25 = call i32 @rudp_update(%struct.rudp* %9, i8* %24, i32 6, i32 1)
%26 = call i32 @dump(i32 %25)
%27 = call i32 @dump_recv(%struct.rudp* %9)
%28 = bitcast i64* %6 to i8*
store i64 217017228535595013, i64* %6
%29 = call i32 @rudp_update(%struct.rudp* %9, i8* %28, i32 8, i32 1)
%30 = call i32 @dump(i32 %29)
%31 = call i32 @dump_recv(%struct.rudp* %9)
%32 = bitcast i64* %7 to i8*
store i64 361695366548029445, i64* %7
%33 = call i32 @rudp_update(%struct.rudp* %9, i8* %32, i32 8, i32 0)
%34 = call i32 @dump(i32 %33)
%35 = bitcast i32* %8 to i8*
store i32 33685509, i32* %8
%36 = call i32 @rudp_update(%struct.rudp* %9, i8* %35, i32 4, i32 1)
%37 = call i32 @dump(i32 %36)
%38 = call i32 @dump_recv(%struct.rudp* %9)
%39 = call i32 @rudp_delete(%struct.rudp* %9)
ret i32 0
}