#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_2__ TYPE_1__;

/* Type definitions */
typedef char uint32_t;
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ sin;
typedef int /*<<< orphan*/ client_key;
typedef int /*<<< orphan*/ client_addr;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_DGRAM;
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ bzero(char *, int);
unsigned long checksum(char *);
int /*<<< orphan*/ close(int);
char *decrypt(char *);
char *encrypt(char *, char *);
int /*<<< orphan*/ exit(int);
char *getPubKey();
char htonl(unsigned long);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *, unsigned long);
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int *);
int sendto(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int strlen(char *);
int /*<<< orphan*/ usage(char *, int);
int main(int argc, char *argv[]) {
  struct sockaddr_in sin, client_addr;
  char buf[4096];
  int len;
  socklen_t addr_len;
  int s;
  int SERVER_PORT;
  char *pub_key = getPubKey();
  if (argc == 2) {
    sscanf(argv[1], "%i", &SERVER_PORT);
  } else {
    usage(argv[0], 1);
  }
  bzero((char *)&sin, sizeof(sin));
  sin.sin_family = AF_INET;
  sin.sin_addr.s_addr = INADDR_ANY;
  sin.sin_port = htons(SERVER_PORT);
  if ((s = socket(PF_INET, SOCK_DGRAM, 0)) < 0) {
    perror("server: socket");
    exit(1);
  }
  if ((bind(s, (struct sockaddr *)&sin, sizeof(sin))) < 0) {
    perror("server: bind");
    exit(1);
  }
  while (1) {
    addr_len = sizeof(client_addr);
    char client_key[4096];
    if (recvfrom(s, client_key, sizeof(client_key), 0,
                 (struct sockaddr *)&client_addr, &addr_len) == -1) {
      perror("Receive error!\n");
      exit(1);
    }
    char *encrypted_message = encrypt(pub_key, client_key);
    len = strlen(encrypted_message) + 1;
    if (sendto(s, encrypted_message, len, 0, (struct sockaddr *)&client_addr,
               sizeof(struct sockaddr)) == -1) {
      perror("server: sendto\n");
      exit(1);
    }
    if (recvfrom(s, buf, sizeof(buf), 0, (struct sockaddr *)&client_addr,
                 &addr_len) == -1) {
      perror("Receive error!\n");
      exit(1);
    }
    char *new_message = decrypt(buf);
    unsigned long sum = checksum(new_message);
    printf("Received %s, checksum %lu\n", new_message, sum);
    uint32_t converted = htonl(sum);
    if (sendto(s, &converted, sizeof(uint32_t), 0,
               (struct sockaddr *)&client_addr,
               sizeof(struct sockaddr)) == -1) {
      perror("server: sendto\n");
      exit(1);
    }
    bzero((char *)&buf, sizeof(buf));
  }
  close(s);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2070,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1120 <getPubKey@plt>
mov    %rax,-0x1048(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    1261 <main+0x51>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdb0(%rip),%rsi
lea    -0x1040(%rbp),%rdx
call   10c0 <sscanf@plt>
jmp    1272 <main+0x62>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x1,%esi
call   10d0 <usage@plt>
lea    -0x20(%rbp),%rdi
mov    $0xc,%esi
call   1100 <bzero@plt>
mov    0x2d61(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    0x2d4d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1040(%rbp),%edi
call   1050 <htons@plt>
mov    %eax,-0x20(%rbp)
mov    0x2d1b(%rip),%rax
mov    (%rax),%edi
mov    0x2d22(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
mov    %eax,-0x103c(%rbp)
cmp    $0x0,%eax
jge    12e4 <main+0xd4>
lea    0xd2e(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x103c(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0xc,%edx
call   10e0 <bind@plt>
cmp    $0x0,%rax
jge    1318 <main+0x108>
lea    0xd09(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
jmp    131d <main+0x10d>
movl   $0xc,-0x1038(%rbp)
mov    -0x103c(%rbp),%edi
lea    -0x2050(%rbp),%rsi
lea    -0x30(%rbp),%r8
mov    $0x1000,%edx
xor    %ecx,%ecx
lea    -0x1038(%rbp),%r9
call   10b0 <recvfrom@plt>
cmp    $0xffffffff,%eax
jne    136a <main+0x15a>
lea    0xcc4(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x1048(%rbp),%rdi
lea    -0x2050(%rbp),%rsi
call   1070 <encrypt@plt>
mov    %rax,-0x2058(%rbp)
mov    -0x2058(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x1034(%rbp)
mov    -0x103c(%rbp),%edi
mov    -0x2058(%rbp),%rsi
mov    -0x1034(%rbp),%edx
lea    -0x30(%rbp),%r8
xor    %ecx,%ecx
mov    $0x4,%r9d
call   10a0 <sendto@plt>
cmp    $0xffffffff,%eax
jne    13dc <main+0x1cc>
lea    0xc62(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x103c(%rbp),%edi
lea    -0x1030(%rbp),%rsi
lea    -0x30(%rbp),%r8
mov    $0x1000,%edx
xor    %ecx,%ecx
lea    -0x1038(%rbp),%r9
call   10b0 <recvfrom@plt>
cmp    $0xffffffff,%eax
jne    141f <main+0x20f>
lea    0xc0f(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x1030(%rbp),%rdi
call   1030 <decrypt@plt>
mov    %rax,-0x2060(%rbp)
mov    -0x2060(%rbp),%rdi
call   1080 <checksum@plt>
mov    %rax,-0x2068(%rbp)
mov    -0x2060(%rbp),%rsi
mov    -0x2068(%rbp),%rdx
lea    0xbe5(%rip),%rdi
call   1060 <printf@plt>
mov    -0x2068(%rbp),%rdi
call   1090 <htonl@plt>
mov    %al,-0x2069(%rbp)
mov    -0x103c(%rbp),%edi
lea    -0x30(%rbp),%r8
lea    -0x2069(%rbp),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
mov    $0x4,%r9d
call   10a0 <sendto@plt>
cmp    $0xffffffff,%eax
jne    14b3 <main+0x2a3>
lea    0xb8b(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x1030(%rbp),%rdi
mov    $0x1000,%esi
call   1100 <bzero@plt>
jmp    131d <main+0x10d>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2048,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1120 <getPubKey@plt>
mov    %rax,0x38(%rsp)
cmp    $0x2,%ebp
jne    1438 <main+0x228>
mov    0x8(%rbx),%rdi
lea    0xdba(%rip),%rsi
lea    0x14(%rsp),%rdx
call   10c0 <sscanf@plt>
mov    0x14(%rsp),%ebx
lea    0x28(%rsp),%rdi
mov    $0xc,%esi
call   1100 <bzero@plt>
mov    0x2d7e(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x30(%rsp)
mov    0x2d69(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x2c(%rsp)
mov    %ebx,%edi
call   1050 <htons@plt>
mov    %eax,0x28(%rsp)
mov    0x2d39(%rip),%rax
mov    (%rax),%edi
mov    0x2d40(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
test   %eax,%eax
jns    12b1 <main+0xa1>
lea    0xd57(%rip),%rdi
jmp    1429 <main+0x219>
mov    %eax,%r13d
lea    0x28(%rsp),%rsi
mov    %eax,%edi
mov    $0xc,%edx
call   10e0 <bind@plt>
test   %rax,%rax
jns    12d6 <main+0xc6>
lea    0xd41(%rip),%rdi
jmp    1429 <main+0x219>
movl   $0xc,0x10(%rsp)
lea    0x40(%rsp),%rsi
lea    0x18(%rsp),%r8
lea    0x10(%rsp),%r9
mov    %r13d,%edi
mov    $0x1000,%edx
xor    %ecx,%ecx
call   10b0 <recvfrom@plt>
cmp    $0xffffffff,%eax
jne    130d <main+0xfd>
lea    0xd17(%rip),%rdi
jmp    1429 <main+0x219>
lea    0x40(%rsp),%rbx
lea    0x10(%rsp),%r12
nopw   0x0(%rax,%rax,1)
mov    0x38(%rsp),%rdi
mov    %rbx,%rsi
call   1070 <encrypt@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%edx
mov    %r13d,%edi
mov    %r14,%rsi
xor    %ecx,%ecx
lea    0x18(%rsp),%r8
mov    $0x4,%r9d
call   10a0 <sendto@plt>
cmp    $0xffffffff,%eax
je     1422 <main+0x212>
mov    %r13d,%edi
lea    0x1040(%rsp),%r15
mov    %r15,%rsi
mov    $0x1000,%edx
xor    %ecx,%ecx
lea    0x18(%rsp),%r8
mov    %r12,%r9
call   10b0 <recvfrom@plt>
cmp    $0xffffffff,%eax
je     1301 <main+0xf1>
mov    %rbx,%r14
mov    %r15,%rdi
call   1030 <decrypt@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1080 <checksum@plt>
mov    %rax,%rbp
lea    0xc98(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1060 <printf@plt>
mov    %rbp,%rdi
call   1090 <htonl@plt>
mov    %al,0xf(%rsp)
mov    %r13d,%edi
lea    0xf(%rsp),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
lea    0x18(%rsp),%r8
mov    $0x4,%r9d
call   10a0 <sendto@plt>
cmp    $0xffffffff,%eax
je     1422 <main+0x212>
mov    %r15,%rdi
mov    $0x1000,%esi
call   1100 <bzero@plt>
movl   $0xc,0x10(%rsp)
mov    %r13d,%edi
mov    %r14,%rbx
mov    %r14,%rsi
mov    $0x1000,%edx
xor    %ecx,%ecx
lea    0x18(%rsp),%r8
mov    %r12,%r9
call   10b0 <recvfrom@plt>
cmp    $0xffffffff,%eax
jne    1320 <main+0x110>
jmp    1301 <main+0xf1>
lea    0xc06(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    (%rbx),%rdi
mov    $0x1,%esi
call   10d0 <usage@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [3 x i8] c"%i\00"
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.1 = [15 x i8] c"server: socket\00"
@.str.2 = [13 x i8] c"server: bind\00"
@.str.3 = [16 x i8] c"Receive error!\0A\00"
@.str.4 = [16 x i8] c"server: sendto\0A\00"
@.str.5 = [27 x i8] c"Received %s, checksum %lu\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.sockaddr_in
%7 = alloca %struct.sockaddr_in
%8 = alloca [4096 x i8]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
%14 = alloca [4096 x i8]
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i64
%18 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%19 = call i8* (...) @getPubKey()
store i8* %19, i8** %13
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 2
br i1 %21, label %22, label %27
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 @sscanf(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %12)
br label %32
27: ; preds = %2
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 0
%30 = load i8*, i8** %29
%31 = call i32 @usage(i8* %30, i32 1)
br label %32
32: ; preds = %27, %22
%33 = bitcast %struct.sockaddr_in* %6 to i8*
%34 = call i32 @bzero(i8* %33, i32 12)
%35 = load i32, i32* @AF_INET
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 2
store i32 %35, i32* %36
%37 = load i32, i32* @INADDR_ANY
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 1
%39 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %38, i32 0, i32 0
store i32 %37, i32* %39
%40 = load i32, i32* %12
%41 = call i32 @htons(i32 %40)
%42 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 0
store i32 %41, i32* %42
%43 = load i32, i32* @PF_INET
%44 = load i32, i32* @SOCK_DGRAM
%45 = call i32 @socket(i32 %43, i32 %44, i32 0)
store i32 %45, i32* %11
%46 = icmp slt i32 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %32
%48 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %32
%51 = load i32, i32* %11
%52 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%53 = call i64 @bind(i32 %51, %struct.sockaddr* %52, i32 12)
%54 = icmp slt i64 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %50
%56 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%57 = call i32 @exit(i32 1)
unreachable
58: ; preds = %50
br label %59
59: ; preds = %58, %110
store i32 12, i32* %10
%60 = load i32, i32* %11
%61 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 0
%62 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%63 = call i32 @recvfrom(i32 %60, i8* %61, i32 4096, i32 0, %struct.sockaddr* %62, i32* %10)
%64 = icmp eq i32 %63, -1
br i1 %64, label %65, label %68
65: ; preds = %59
%66 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%67 = call i32 @exit(i32 1)
unreachable
68: ; preds = %59
%69 = load i8*, i8** %13
%70 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 0
%71 = call i8* @encrypt(i8* %69, i8* %70)
store i8* %71, i8** %15
%72 = load i8*, i8** %15
%73 = call i32 @strlen(i8* %72)
%74 = add nsw i32 %73, 1
store i32 %74, i32* %9
%75 = load i32, i32* %11
%76 = load i8*, i8** %15
%77 = load i32, i32* %9
%78 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%79 = call i32 @sendto(i32 %75, i8* %76, i32 %77, i32 0, %struct.sockaddr* %78, i32 4)
%80 = icmp eq i32 %79, -1
br i1 %80, label %81, label %84
81: ; preds = %68
%82 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%83 = call i32 @exit(i32 1)
unreachable
84: ; preds = %68
%85 = load i32, i32* %11
%86 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
%87 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%88 = call i32 @recvfrom(i32 %85, i8* %86, i32 4096, i32 0, %struct.sockaddr* %87, i32* %10)
%89 = icmp eq i32 %88, -1
br i1 %89, label %90, label %93
90: ; preds = %84
%91 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%92 = call i32 @exit(i32 1)
unreachable
93: ; preds = %84
%94 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
%95 = call i8* @decrypt(i8* %94)
store i8* %95, i8** %16
%96 = load i8*, i8** %16
%97 = call i64 @checksum(i8* %96)
store i64 %97, i64* %17
%98 = load i8*, i8** %16
%99 = load i64, i64* %17
%100 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i8* %98, i64 %99)
%101 = load i64, i64* %17
%102 = call signext i8 @htonl(i64 %101)
store i8 %102, i8* %18
%103 = load i32, i32* %11
%104 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%105 = call i32 @sendto(i32 %103, i8* %18, i32 1, i32 0, %struct.sockaddr* %104, i32 4)
%106 = icmp eq i32 %105, -1
br i1 %106, label %107, label %110
107: ; preds = %93
%108 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%109 = call i32 @exit(i32 1)
unreachable
110: ; preds = %93
%111 = bitcast [4096 x i8]* %8 to i8*
%112 = call i32 @bzero(i8* %111, i32 4096)
br label %59
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [3 x i8] c"%i\00"
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.1 = [15 x i8] c"server: socket\00"
@.str.2 = [13 x i8] c"server: bind\00"
@.str.3 = [16 x i8] c"Receive error!\0A\00"
@.str.4 = [16 x i8] c"server: sendto\0A\00"
@.str.5 = [27 x i8] c"Received %s, checksum %lu\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.sockaddr_in
%5 = alloca [4096 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca [4096 x i8]
%9 = alloca i8
%10 = bitcast %struct.sockaddr_in* %3 to i8*
%11 = bitcast %struct.sockaddr_in* %4 to i8*
%12 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%13 = bitcast i32* %6 to i8*
%14 = bitcast i32* %7 to i8*
%15 = tail call i8* (...) @getPubKey()
%16 = icmp eq i32 %0, 2
br i1 %16, label %17, label %33
17: ; preds = %2
%18 = getelementptr inbounds i8*, i8** %1, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @sscanf(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%21 = load i32, i32* %7
%22 = call i32 @bzero(i8* %10, i32 12)
%23 = load i32, i32* @AF_INET
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %23, i32* %24
%25 = load i32, i32* @INADDR_ANY
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
store i32 %25, i32* %26
%27 = call i32 @htons(i32 %21)
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %27, i32* %28
%29 = load i32, i32* @PF_INET
%30 = load i32, i32* @SOCK_DGRAM
%31 = call i32 @socket(i32 %29, i32 %30, i32 0)
%32 = icmp slt i32 %31, 0
br i1 %32, label %36, label %39
33: ; preds = %2
%34 = load i8*, i8** %1
%35 = tail call i32 @usage(i8* %34, i32 1)
unreachable
36: ; preds = %17
%37 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%38 = call i32 @exit(i32 1)
unreachable
39: ; preds = %17
%40 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%41 = call i64 @bind(i32 %31, %struct.sockaddr* %40, i32 12)
%42 = icmp slt i64 %41, 0
br i1 %42, label %48, label %43
43: ; preds = %39
%44 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
%45 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
store i32 12, i32* %6
%46 = call i32 @recvfrom(i32 %31, i8* %44, i32 4096, i32 0, %struct.sockaddr* %45, i32* %6)
%47 = icmp eq i32 %46, -1
br i1 %47, label %51, label %54
48: ; preds = %39
%49 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%50 = call i32 @exit(i32 1)
unreachable
51: ; preds = %79, %43
%52 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%53 = call i32 @exit(i32 1)
unreachable
54: ; preds = %43, %79
%55 = call i8* @encrypt(i8* %15, i8* %44)
%56 = call i32 @strlen(i8* %55)
%57 = add nsw i32 %56, 1
%58 = call i32 @sendto(i32 %31, i8* %55, i32 %57, i32 0, %struct.sockaddr* %45, i32 4)
%59 = icmp eq i32 %58, -1
br i1 %59, label %60, label %63
60: ; preds = %54
%61 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%62 = call i32 @exit(i32 1)
unreachable
63: ; preds = %54
%64 = call i32 @recvfrom(i32 %31, i8* %12, i32 4096, i32 0, %struct.sockaddr* %45, i32* %6)
%65 = icmp eq i32 %64, -1
br i1 %65, label %66, label %69
66: ; preds = %63
%67 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%68 = call i32 @exit(i32 1)
unreachable
69: ; preds = %63
%70 = call i8* @decrypt(i8* %12)
%71 = call i64 @checksum(i8* %70)
%72 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i8* %70, i64 %71)
%73 = call signext i8 @htonl(i64 %71)
store i8 %73, i8* %9
%74 = call i32 @sendto(i32 %31, i8* %9, i32 1, i32 0, %struct.sockaddr* %45, i32 4)
%75 = icmp eq i32 %74, -1
br i1 %75, label %76, label %79
76: ; preds = %69
%77 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%78 = call i32 @exit(i32 1)
unreachable
79: ; preds = %69
%80 = call i32 @bzero(i8* %12, i32 4096)
store i32 12, i32* %6
%81 = call i32 @recvfrom(i32 %31, i8* %44, i32 4096, i32 0, %struct.sockaddr* %45, i32* %6)
%82 = icmp eq i32 %81, -1
br i1 %82, label %51, label %54
}