#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 */
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*/ server_addr;
typedef int /*<<< orphan*/ client_addr;
typedef int /*<<< orphan*/ buff;
typedef int /*<<< orphan*/ addr_buff;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ atoi(char *);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int /*<<< orphan*/);
char *inet_ntop(int /*<<< orphan*/, TYPE_1__ *, char *, int);
scalar_t__ is_palindrome(char *, int /*<<< orphan*/);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
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*/ stderr;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strlen(char *);
int main(int argc, char **argv) {
  int sockfd;
  int retval;
  struct sockaddr_in client_addr, server_addr;
  socklen_t client_addr_len, server_addr_len;
  char buff[256];
  char addr_buff[256];
  if (argc != 2) {
    fprintf(stderr, "Invocation: %s <PORT>\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  sockfd = socket(PF_INET, SOCK_DGRAM, 0);
  if (sockfd == -1) {
    perror("socket()");
    exit(EXIT_FAILURE);
  }
  memset(&server_addr, 0, sizeof(server_addr));
  server_addr.sin_family = AF_INET;
  server_addr.sin_addr.s_addr = htonl(INADDR_ANY);
  server_addr.sin_port = htons(atoi(argv[1]));
  server_addr_len = sizeof(server_addr);
  if (bind(sockfd, (struct sockaddr *)&server_addr, server_addr_len) == -1) {
    perror("bind()");
    exit(EXIT_FAILURE);
  }
  fprintf(stdout, "Server is listening for incoming connection...\n");
  client_addr_len = sizeof(client_addr);
  char odp[256];
  while (1) {
    retval = recvfrom(sockfd, buff, sizeof(buff), 0,
                      (struct sockaddr *)&client_addr, &client_addr_len);
    if (retval == -1) {
      perror("recvfrom()");
      exit(EXIT_FAILURE);
    }
    fprintf(
        stdout, "UDP datagram received from %s:%d. Echoing message...\n",
        inet_ntop(AF_INET, &client_addr.sin_addr, addr_buff, sizeof(addr_buff)),
        ntohs(client_addr.sin_port));
    if (is_palindrome(buff, strlen(buff))) {
      strcpy(odp, "TAK");
    } else {
      strcpy(odp, "NIE");
    }
    retval = sendto(sockfd, odp, retval, 0, (struct sockaddr *)&client_addr,
                    client_addr_len);
    if (retval == -1) {
      perror("sendto()");
      exit(EXIT_FAILURE);
    }
    if (buff[0] == '\0' || buff[0] == '\n') {
      break;
    }
  }
  close(sockfd);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x360,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     125f <main+0x4f>
mov    0x2d8e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdb6(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    0x2d60(%rip),%rax
mov    (%rax),%edi
call   1120 <exit@plt>
mov    0x2d5a(%rip),%rax
mov    (%rax),%edi
mov    0x2d69(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    129f <main+0x8f>
lea    0xd8b(%rip),%rdi
call   1100 <perror@plt>
mov    0x2d20(%rip),%rax
mov    (%rax),%edi
call   1120 <exit@plt>
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1090 <memset@plt>
mov    0x2d32(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    0x2d1e(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1110 <atoi@plt>
mov    %eax,%edi
call   1070 <htons@plt>
mov    %eax,-0x38(%rbp)
movl   $0xc,-0x40(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%edx
call   10f0 <bind@plt>
cmp    $0xffffffff,%eax
jne    131c <main+0x10c>
lea    0xd17(%rip),%rdi
call   1100 <perror@plt>
mov    0x2ca3(%rip),%rax
mov    (%rax),%edi
call   1120 <exit@plt>
mov    0x2c8d(%rip),%rax
mov    (%rax),%edi
lea    0xcfb(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
movl   $0xc,-0x3c(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x140(%rbp),%rsi
lea    -0x28(%rbp),%r8
mov    $0x100,%edx
xor    %ecx,%ecx
lea    -0x3c(%rbp),%r9
call   10d0 <recvfrom@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    137f <main+0x16f>
lea    0xceb(%rip),%rdi
call   1100 <perror@plt>
mov    0x2c40(%rip),%rax
mov    (%rax),%edi
call   1120 <exit@plt>
mov    0x2c2a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x354(%rbp)
mov    0x2c53(%rip),%rax
mov    (%rax),%edi
lea    -0x28(%rbp),%rsi
add    $0x4,%rsi
lea    -0x240(%rbp),%rdx
mov    $0x100,%ecx
call   1030 <inet_ntop@plt>
mov    %rax,-0x350(%rbp)
mov    -0x28(%rbp),%edi
call   10e0 <ntohs@plt>
mov    -0x354(%rbp),%edi
mov    -0x350(%rbp),%rdx
mov    %eax,%ecx
lea    0xc8d(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
lea    -0x140(%rbp),%rax
mov    %rax,-0x348(%rbp)
lea    -0x140(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x348(%rbp),%rdi
mov    %eax,%esi
call   1050 <is_palindrome@plt>
cmp    $0x0,%rax
je     1426 <main+0x216>
lea    -0x340(%rbp),%rdi
lea    0xc7c(%rip),%rsi
call   1040 <strcpy@plt>
jmp    1439 <main+0x229>
lea    -0x340(%rbp),%rdi
lea    0xc68(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x14(%rbp),%edi
lea    -0x340(%rbp),%rsi
mov    -0x18(%rbp),%edx
lea    -0x28(%rbp),%r8
mov    -0x3c(%rbp),%r9d
xor    %ecx,%ecx
call   10a0 <sendto@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    147c <main+0x26c>
lea    0xc37(%rip),%rdi
call   1100 <perror@plt>
mov    0x2b43(%rip),%rax
mov    (%rax),%edi
call   1120 <exit@plt>
movsbl -0x140(%rbp),%eax
cmp    $0x0,%eax
je     149c <main+0x28c>
movsbl -0x140(%rbp),%eax
cmp    $0xa,%eax
jne    14a1 <main+0x291>
jmp    14a6 <main+0x296>
jmp    133a <main+0x12a>
mov    -0x14(%rbp),%edi
call   10b0 <close@plt>
mov    0x2af3(%rip),%rax
mov    (%rax),%edi
call   1120 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x338,%rsp
mov    %rsi,%r15
cmp    $0x2,%edi
jne    1257 <main+0x47>
mov    0x2d90(%rip),%rax
mov    (%rax),%edi
mov    0x2d9f(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
mov    %eax,0x8(%rsp)
cmp    $0xffffffff,%eax
jne    1276 <main+0x66>
lea    0xdc5(%rip),%rdi
jmp    1418 <main+0x208>
mov    0x2d6a(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rdx
lea    0xd96(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
jmp    141d <main+0x20d>
lea    0x10(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1090 <memset@plt>
mov    0x2d57(%rip),%r12
mov    (%r12),%eax
mov    %eax,0x18(%rsp)
mov    0x2d40(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,0x14(%rsp)
mov    0x8(%r15),%rdi
call   1110 <atoi@plt>
mov    %eax,%edi
call   1070 <htons@plt>
mov    %eax,0x10(%rsp)
mov    0x8(%rsp),%edi
mov    %r14,%rsi
mov    $0xc,%edx
call   10f0 <bind@plt>
cmp    $0xffffffff,%eax
jne    12e1 <main+0xd1>
lea    0xd44(%rip),%rdi
jmp    1418 <main+0x208>
mov    0x2cc8(%rip),%rax
mov    (%rax),%edi
lea    0xd36(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
movl   $0xc,0xc(%rsp)
lea    0x30(%rsp),%rbp
lea    0x20(%rsp),%r15
mov    0x8(%rsp),%ebx
xchg   %ax,%ax
mov    0x8(%rsp),%edi
mov    %rbp,%rsi
mov    $0x100,%edx
xor    %ecx,%ecx
mov    %r15,%r8
lea    0xc(%rsp),%r9
call   10d0 <recvfrom@plt>
cmp    $0xffffffff,%eax
je     1408 <main+0x1f8>
mov    %eax,%r13d
mov    0x2c72(%rip),%rax
mov    (%rax),%ebp
mov    %r12,%r14
mov    (%r12),%edi
lea    0x24(%rsp),%rsi
lea    0x230(%rsp),%rdx
mov    $0x100,%ecx
call   1030 <inet_ntop@plt>
mov    %r15,%r12
mov    %rax,%r15
mov    0x20(%rsp),%edi
call   10e0 <ntohs@plt>
mov    %ebp,%edi
lea    0x30(%rsp),%rbp
lea    0xce7(%rip),%rsi
mov    %r15,%rdx
mov    %r12,%r15
mov    %eax,%ecx
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    %rbp,%rdi
call   1060 <strlen@plt>
mov    %rbp,%rdi
mov    %eax,%esi
call   1050 <is_palindrome@plt>
test   %rax,%rax
lea    0xcf2(%rip),%rsi
lea    0xcef(%rip),%rax
cmove  %rax,%rsi
lea    0x130(%rsp),%r12
mov    %r12,%rdi
call   1040 <strcpy@plt>
mov    0xc(%rsp),%r9d
mov    %ebx,%edi
mov    %r12,%rsi
mov    %r13d,%edx
xor    %ecx,%ecx
mov    %r15,%r8
call   10a0 <sendto@plt>
cmp    $0xffffffff,%eax
je     1411 <main+0x201>
movzbl 0x30(%rsp),%eax
cmp    $0xa,%al
je     13f1 <main+0x1e1>
mov    %r14,%r12
test   %al,%al
jne    1310 <main+0x100>
mov    0x8(%rsp),%edi
call   10b0 <close@plt>
mov    0x2ba7(%rip),%rax
mov    (%rax),%edi
call   1120 <exit@plt>
lea    0xc48(%rip),%rdi
jmp    1418 <main+0x208>
lea    0xc88(%rip),%rdi
call   1100 <perror@plt>
mov    0x2b94(%rip),%rax
mov    (%rax),%edi
call   1120 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [23 x i8] c"Invocation: %s <PORT>\0A\00"
@EXIT_FAILURE = global i32 0
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.1 = [9 x i8] c"socket()\00"
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@.str.2 = [7 x i8] c"bind()\00"
@stdout = global i32 0
@.str.3 = [48 x i8] c"Server is listening for incoming connection...\0A\00"
@.str.4 = [11 x i8] c"recvfrom()\00"
@.str.5 = [54 x i8] c"UDP datagram received from %s:%d. Echoing message...\0A\00"
@.str.6 = [4 x i8] c"TAK\00"
@.str.7 = [4 x i8] c"NIE\00"
@.str.8 = [9 x i8] c"sendto()\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.sockaddr_in
%9 = alloca %struct.sockaddr_in
%10 = alloca i32
%11 = alloca i32
%12 = alloca [256 x i8]
%13 = alloca [256 x i8]
%14 = alloca [256 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 2
br i1 %16, label %17, label %25
17: ; preds = %2
%18 = load i32, i32* @stderr
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %21)
%23 = load i32, i32* @EXIT_FAILURE
%24 = call i32 @exit(i32 %23)
unreachable
25: ; preds = %2
%26 = load i32, i32* @PF_INET
%27 = load i32, i32* @SOCK_DGRAM
%28 = call i32 @socket(i32 %26, i32 %27, i32 0)
store i32 %28, i32* %6
%29 = load i32, i32* %6
%30 = icmp eq i32 %29, -1
br i1 %30, label %31, label %35
31: ; preds = %25
%32 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%33 = load i32, i32* @EXIT_FAILURE
%34 = call i32 @exit(i32 %33)
unreachable
35: ; preds = %25
%36 = call i32 @memset(%struct.sockaddr_in* %9, i32 0, i32 12)
%37 = load i32, i32* @AF_INET
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 2
store i32 %37, i32* %38
%39 = load i32, i32* @INADDR_ANY
%40 = call i32 @htonl(i32 %39)
%41 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 1
%42 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %41, i32 0, i32 0
store i32 %40, i32* %42
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i8*, i8** %44
%46 = call i32 @atoi(i8* %45)
%47 = call i32 @htons(i32 %46)
%48 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 0
store i32 %47, i32* %48
store i32 12, i32* %11
%49 = load i32, i32* %6
%50 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%51 = load i32, i32* %11
%52 = call i32 @bind(i32 %49, %struct.sockaddr* %50, i32 %51)
%53 = icmp eq i32 %52, -1
br i1 %53, label %54, label %58
54: ; preds = %35
%55 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%56 = load i32, i32* @EXIT_FAILURE
%57 = call i32 @exit(i32 %56)
unreachable
58: ; preds = %35
%59 = load i32, i32* @stdout
%60 = call i32 (i32, i8*, ...) @fprintf(i32 %59, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0))
store i32 12, i32* %10
br label %61
61: ; preds = %58, %117
%62 = load i32, i32* %6
%63 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%64 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%65 = call i32 @recvfrom(i32 %62, i8* %63, i32 256, i32 0, %struct.sockaddr* %64, i32* %10)
store i32 %65, i32* %7
%66 = load i32, i32* %7
%67 = icmp eq i32 %66, -1
br i1 %67, label %68, label %72
68: ; preds = %61
%69 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%70 = load i32, i32* @EXIT_FAILURE
%71 = call i32 @exit(i32 %70)
unreachable
72: ; preds = %61
%73 = load i32, i32* @stdout
%74 = load i32, i32* @AF_INET
%75 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 1
%76 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%77 = call i8* @inet_ntop(i32 %74, %struct.TYPE_2__* %75, i8* %76, i32 256)
%78 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 0
%79 = load i32, i32* %78
%80 = call i32 @ntohs(i32 %79)
%81 = call i32 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0), i8* %77, i32 %80)
%82 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%83 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%84 = call i32 @strlen(i8* %83)
%85 = call i64 @is_palindrome(i8* %82, i32 %84)
%86 = icmp ne i64 %85, 0
br i1 %86, label %87, label %90
87: ; preds = %72
%88 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%89 = call i32 @strcpy(i8* %88, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
br label %93
90: ; preds = %72
%91 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%92 = call i32 @strcpy(i8* %91, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %93
93: ; preds = %90, %87
%94 = load i32, i32* %6
%95 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%96 = load i32, i32* %7
%97 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%98 = load i32, i32* %10
%99 = call i32 @sendto(i32 %94, i8* %95, i32 %96, i32 0, %struct.sockaddr* %97, i32 %98)
store i32 %99, i32* %7
%100 = load i32, i32* %7
%101 = icmp eq i32 %100, -1
br i1 %101, label %102, label %106
102: ; preds = %93
%103 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%104 = load i32, i32* @EXIT_FAILURE
%105 = call i32 @exit(i32 %104)
unreachable
106: ; preds = %93
%107 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%108 = load i8, i8* %107
%109 = sext i8 %108 to i32
%110 = icmp eq i32 %109, 0
br i1 %110, label %116, label %111
111: ; preds = %106
%112 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%113 = load i8, i8* %112
%114 = sext i8 %113 to i32
%115 = icmp eq i32 %114, 10
br i1 %115, label %116, label %117
116: ; preds = %111, %106
br label %118
117: ; preds = %111
br label %61
118: ; preds = %116
%119 = load i32, i32* %6
%120 = call i32 @close(i32 %119)
%121 = load i32, i32* @EXIT_SUCCESS
%122 = call i32 @exit(i32 %121)
unreachable
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [23 x i8] c"Invocation: %s <PORT>\0A\00"
@EXIT_FAILURE = global i32 0
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.1 = [9 x i8] c"socket()\00"
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@.str.2 = [7 x i8] c"bind()\00"
@stdout = global i32 0
@.str.3 = [48 x i8] c"Server is listening for incoming connection...\0A\00"
@.str.4 = [11 x i8] c"recvfrom()\00"
@.str.5 = [54 x i8] c"UDP datagram received from %s:%d. Echoing message...\0A\00"
@.str.6 = [4 x i8] c"TAK\00"
@.str.7 = [4 x i8] c"NIE\00"
@.str.8 = [9 x i8] c"sendto()\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
%6 = alloca [256 x i8]
%7 = alloca [256 x i8]
%8 = alloca [256 x i8]
%9 = bitcast %struct.sockaddr_in* %3 to i8*
%10 = bitcast %struct.sockaddr_in* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%14 = icmp eq i32 %0, 2
br i1 %14, label %21, label %15
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = load i8*, i8** %1
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = load i32, i32* @EXIT_FAILURE
%20 = tail call i32 @exit(i32 %19)
unreachable
21: ; preds = %2
%22 = load i32, i32* @PF_INET
%23 = load i32, i32* @SOCK_DGRAM
%24 = tail call i32 @socket(i32 %22, i32 %23, i32 0)
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %30
26: ; preds = %21
%27 = tail call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%28 = load i32, i32* @EXIT_FAILURE
%29 = tail call i32 @exit(i32 %28)
unreachable
30: ; preds = %21
%31 = call i32 @memset(%struct.sockaddr_in* %4, i32 0, i32 12)
%32 = load i32, i32* @AF_INET
%33 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
store i32 %32, i32* %33
%34 = load i32, i32* @INADDR_ANY
%35 = call i32 @htonl(i32 %34)
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1, i32 0
store i32 %35, i32* %36
%37 = getelementptr inbounds i8*, i8** %1, i64 1
%38 = load i8*, i8** %37
%39 = call i32 @atoi(i8* %38)
%40 = call i32 @htons(i32 %39)
%41 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
store i32 %40, i32* %41
%42 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%43 = call i32 @bind(i32 %24, %struct.sockaddr* %42, i32 12)
%44 = icmp eq i32 %43, -1
br i1 %44, label %45, label %49
45: ; preds = %30
%46 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%47 = load i32, i32* @EXIT_FAILURE
%48 = call i32 @exit(i32 %47)
unreachable
49: ; preds = %30
%50 = load i32, i32* @stdout
%51 = call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0))
store i32 12, i32* %5
%52 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%53 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%54 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
%55 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
br label %56
56: ; preds = %82, %49
%57 = call i32 @recvfrom(i32 %24, i8* %12, i32 256, i32 0, %struct.sockaddr* %53, i32* %5)
%58 = icmp eq i32 %57, -1
br i1 %58, label %59, label %63
59: ; preds = %56
%60 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%61 = load i32, i32* @EXIT_FAILURE
%62 = call i32 @exit(i32 %61)
unreachable
63: ; preds = %56
%64 = load i32, i32* @stdout
%65 = load i32, i32* @AF_INET
%66 = call i8* @inet_ntop(i32 %65, %struct.TYPE_2__* %54, i8* %13, i32 256)
%67 = load i32, i32* %55
%68 = call i32 @ntohs(i32 %67)
%69 = call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0), i8* %66, i32 %68)
%70 = call i32 @strlen(i8* %12)
%71 = call i64 @is_palindrome(i8* %12, i32 %70)
%72 = icmp eq i64 %71, 0
%73 = select i1 %72, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0)
%74 = call i32 @strcpy(i8* %52, i8* %73)
%75 = load i32, i32* %5
%76 = call i32 @sendto(i32 %24, i8* %52, i32 %57, i32 0, %struct.sockaddr* %53, i32 %75)
%77 = icmp eq i32 %76, -1
br i1 %77, label %78, label %82
78: ; preds = %63
%79 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%80 = load i32, i32* @EXIT_FAILURE
%81 = call i32 @exit(i32 %80)
unreachable
82: ; preds = %63
%83 = load i8, i8* %12
switch i8 %83, label %56 [
i8 10, label %84
i8 0, label %84
]
84: ; preds = %82, %82
%85 = call i32 @close(i32 %24)
%86 = load i32, i32* @EXIT_SUCCESS
%87 = call i32 @exit(i32 %86)
unreachable
}