#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 /*<<< orphan*/ servaddr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int /*<<< orphan*/ *);
double atof(char *);
int /*<<< orphan*/ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ bzero(struct sockaddr_in *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ listen(int, int);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char **argv) {
  int listenfd;
  int connfd;
  struct sockaddr_in servaddr;
  listenfd = socket(PF_INET, SOCK_STREAM, 0);
  bzero(&servaddr, sizeof(servaddr));
  servaddr.sin_family = AF_INET;
  servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
  servaddr.sin_port = htons(50001);
  bind(listenfd, (struct sockaddr *)&servaddr, sizeof(servaddr));
  while (1) {
    listen(listenfd, 10);
    connfd = accept(listenfd, (struct sockaddr *)NULL, NULL);
    int n;
    char recvline[1024];
    while ((n = read(connfd, recvline, 1024)) > 0) {
      char bufx[20];
      char bufy[20];
      recvline[n] = 0;
      printf("%s\n", recvline);
      int j = 0;
      while (recvline[j] != 'x') {
        bufx[j] = recvline[j];
        j++;
      }
      double x = atof(bufx);
      while (recvline[j] == 'x')
        j++;
      int l = 0;
      while (recvline[j] != 'x') {
        bufy[l++] = recvline[j++];
      }
      double y = atof(bufy);
      printf("%f\n", x);
      printf("%f\n", y);
    }
  }
  close(connfd);
  close(listenfd);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x490,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e08(%rip),%rax
mov    (%rax),%edi
mov    0x2e07(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10c0 <socket@plt>
mov    %eax,-0x14(%rbp)
lea    -0x28(%rbp),%rdi
mov    $0xc,%esi
call   10a0 <bzero@plt>
mov    0x2dfe(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2dea(%rip),%rax
mov    (%rax),%edi
call   1060 <htonl@plt>
mov    %eax,-0x24(%rbp)
mov    $0xc351,%edi
call   1040 <htons@plt>
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0xc,%edx
call   1090 <bind@plt>
mov    -0x14(%rbp),%edi
mov    $0xa,%esi
call   1080 <listen@plt>
mov    -0x14(%rbp),%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   10b0 <accept@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
lea    -0x430(%rbp),%rsi
mov    $0x400,%edx
call   1070 <read@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0x0,%eax
jle    13b0 <main+0x210>
movslq -0x2c(%rbp),%rax
movb   $0x0,-0x430(%rbp,%rax,1)
lea    -0x430(%rbp),%rsi
lea    0xd89(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x474(%rbp)
movslq -0x474(%rbp),%rax
movsbl -0x430(%rbp,%rax,1),%eax
ff
cmp    $0x78,%eax
je     12d0 <main+0x130>
movslq -0x474(%rbp),%rax
mov    -0x430(%rbp,%rax,1),%cl
movslq -0x474(%rbp),%rax
mov    %cl,-0x450(%rbp,%rax,1)
mov    -0x474(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x474(%rbp)
jmp    1288 <main+0xe8>
lea    -0x450(%rbp),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x480(%rbp)
ff
movslq -0x474(%rbp),%rax
movsbl -0x430(%rbp,%rax,1),%eax
ff
cmp    $0x78,%eax
jne    1310 <main+0x170>
mov    -0x474(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x474(%rbp)
jmp    12e4 <main+0x144>
movl   $0x0,-0x484(%rbp)
movslq -0x474(%rbp),%rax
movsbl -0x430(%rbp,%rax,1),%eax
ff
cmp    $0x78,%eax
je     136b <main+0x1cb>
mov    -0x474(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x474(%rbp)
cltq
mov    -0x430(%rbp,%rax,1),%cl
mov    -0x484(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x484(%rbp)
cltq
mov    %cl,-0x470(%rbp,%rax,1)
jmp    131a <main+0x17a>
lea    -0x470(%rbp),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x490(%rbp)
ff
movsd  -0x480(%rbp),%xmm0
ff
lea    0xc76(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  -0x490(%rbp),%xmm0
ff
lea    0xc60(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    123d <main+0x9d>
jmp    121e <main+0x7e>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x478,%rsp
mov    0x2e00(%rip),%rax
mov    (%rax),%edi
mov    0x2dff(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10d0 <socket@plt>
mov    %eax,%ebp
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xc,%esi
call   10b0 <bzero@plt>
mov    0x2df3(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x18(%rsp)
mov    0x2dde(%rip),%rax
mov    (%rax),%edi
call   1070 <htonl@plt>
mov    %eax,0x14(%rsp)
mov    $0xc351,%edi
call   1050 <htons@plt>
mov    %eax,0x10(%rsp)
mov    %ebp,0xc(%rsp)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0xc,%edx
call   10a0 <bind@plt>
lea    0x70(%rsp),%rbx
lea    0x50(%rsp),%r15
lea    0x30(%rsp),%r12
lea    0xdbc(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0xc(%rsp),%ebp
mov    %ebp,%edi
mov    $0xa,%esi
call   1090 <listen@plt>
mov    %ebp,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10c0 <accept@plt>
mov    %eax,%ebp
mov    %eax,%edi
jmp    12b0 <main+0x100>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1040 <atof@plt>
movsd  %xmm0,0x20(%rsp)
mov    %r13,%rdi
movsd  0x28(%rsp),%xmm0
mov    $0x1,%al
call   1060 <printf@plt>
mov    %r13,%rdi
movsd  0x20(%rsp),%xmm0
mov    $0x1,%al
call   1060 <printf@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1080 <read@plt>
test   %eax,%eax
jle    1250 <main+0xa0>
mov    %eax,%eax
movb   $0x0,0x70(%rsp,%rax,1)
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0x70(%rsp),%al
xor    %r14d,%r14d
cmp    $0x78,%al
je     12f3 <main+0x143>
nopl   0x0(%rax,%rax,1)
mov    %al,0x50(%rsp,%r14,1)
movzbl 0x71(%rsp,%r14,1),%eax
add    $0x1,%r14
cmp    $0x78,%al
jne    12e0 <main+0x130>
mov    %r15,%rdi
call   1040 <atof@plt>
movsd  %xmm0,0x28(%rsp)
mov    %r14d,%ecx
add    $0xffffffffffffffff,%rcx
nopl   0x0(%rax,%rax,1)
cmpb   $0x78,0x71(%rsp,%rcx,1)
lea    0x1(%rcx),%rcx
je     1310 <main+0x160>
mov    %ecx,%eax
mov    0x70(%rsp,%rax,1),%al
cmp    $0x78,%al
je     1280 <main+0xd0>
mov    %ecx,%ecx
lea    0x71(%rsp),%rdx
add    %rdx,%rcx
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %al,0x30(%rsp,%rdx,1)
movzbl (%rcx,%rdx,1),%eax
add    $0x1,%rdx
cmp    $0x78,%al
jne    1340 <main+0x190>
jmp    1280 <main+0xd0>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [4 x i8] c"%f\0A\00"
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 i32
%10 = alloca [1024 x i8]
%11 = alloca [20 x i8]
%12 = alloca [20 x i8]
%13 = alloca i32
%14 = alloca double
%15 = alloca i32
%16 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* @PF_INET
%18 = load i32, i32* @SOCK_STREAM
%19 = call i32 @socket(i32 %17, i32 %18, i32 0)
store i32 %19, i32* %6
%20 = call i32 @bzero(%struct.sockaddr_in* %8, i32 12)
%21 = load i32, i32* @AF_INET
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 2
store i32 %21, i32* %22
%23 = load i32, i32* @INADDR_ANY
%24 = call i32 @htonl(i32 %23)
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 1
%26 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %25, i32 0, i32 0
store i32 %24, i32* %26
%27 = call i32 @htons(i32 50001)
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 0
store i32 %27, i32* %28
%29 = load i32, i32* %6
%30 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%31 = call i32 @bind(i32 %29, %struct.sockaddr* %30, i32 12)
br label %32
32: ; preds = %2, %103
%33 = load i32, i32* %6
%34 = call i32 @listen(i32 %33, i32 10)
%35 = load i32, i32* %6
%36 = call i32 @accept(i32 %35, %struct.sockaddr* null, i32* null)
store i32 %36, i32* %7
br label %37
37: ; preds = %96, %32
%38 = load i32, i32* %7
%39 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%40 = call i32 @read(i32 %38, i8* %39, i32 1024)
store i32 %40, i32* %9
%41 = icmp sgt i32 %40, 0
br i1 %41, label %42, label %103
42: ; preds = %37
%43 = load i32, i32* %9
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 %44
store i8 0, i8* %45
%46 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %46)
store i32 0, i32* %13
br label %48
48: ; preds = %55, %42
%49 = load i32, i32* %13
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 %50
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = icmp ne i32 %53, 120
br i1 %54, label %55, label %65
55: ; preds = %48
%56 = load i32, i32* %13
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 %57
%59 = load i8, i8* %58
%60 = load i32, i32* %13
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [20 x i8], [20 x i8]* %11, i64 0, i64 %61
store i8 %59, i8* %62
%63 = load i32, i32* %13
%64 = add nsw i32 %63, 1
store i32 %64, i32* %13
br label %48
65: ; preds = %48
%66 = getelementptr inbounds [20 x i8], [20 x i8]* %11, i64 0, i64 0
%67 = call double @atof(i8* %66)
store double %67, double* %14
br label %68
68: ; preds = %75, %65
%69 = load i32, i32* %13
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 %70
%72 = load i8, i8* %71
%73 = sext i8 %72 to i32
%74 = icmp eq i32 %73, 120
br i1 %74, label %75, label %78
75: ; preds = %68
%76 = load i32, i32* %13
%77 = add nsw i32 %76, 1
store i32 %77, i32* %13
br label %68
78: ; preds = %68
store i32 0, i32* %15
br label %79
79: ; preds = %86, %78
%80 = load i32, i32* %13
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 %81
%83 = load i8, i8* %82
%84 = sext i8 %83 to i32
%85 = icmp ne i32 %84, 120
br i1 %85, label %86, label %96
86: ; preds = %79
%87 = load i32, i32* %13
%88 = add nsw i32 %87, 1
store i32 %88, i32* %13
%89 = sext i32 %87 to i64
%90 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 %89
%91 = load i8, i8* %90
%92 = load i32, i32* %15
%93 = add nsw i32 %92, 1
store i32 %93, i32* %15
%94 = sext i32 %92 to i64
%95 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 %94
store i8 %91, i8* %95
br label %79
96: ; preds = %79
%97 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%98 = call double @atof(i8* %97)
store double %98, double* %16
%99 = load double, double* %14
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %99)
%101 = load double, double* %16
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %101)
br label %37
103: ; preds = %37
br label %32
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@.str.1 = [4 x i8] c"%f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [1024 x i8]
%5 = alloca [20 x i8]
%6 = alloca [20 x i8]
%7 = bitcast %struct.sockaddr_in* %3 to i8*
%8 = load i32, i32* @PF_INET
%9 = load i32, i32* @SOCK_STREAM
%10 = tail call i32 @socket(i32 %8, i32 %9, i32 0)
%11 = call i32 @bzero(%struct.sockaddr_in* %3, i32 12)
%12 = load i32, i32* @AF_INET
%13 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %12, i32* %13
%14 = load i32, i32* @INADDR_ANY
%15 = tail call i32 @htonl(i32 %14)
%16 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
store i32 %15, i32* %16
%17 = tail call i32 @htons(i32 50001)
%18 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %17, i32* %18
%19 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%20 = call i32 @bind(i32 %10, %struct.sockaddr* %19, i32 12)
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%22 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%23 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
br label %24
24: ; preds = %75, %2
%25 = call i32 @listen(i32 %10, i32 10)
%26 = call i32 @accept(i32 %10, %struct.sockaddr* null, i32* null)
%27 = call i32 @read(i32 %26, i8* %21, i32 1024)
%28 = icmp sgt i32 %27, 0
br i1 %28, label %29, label %75
29: ; preds = %24, %69
%30 = phi i32 [ %73, %69 ], [ %27, %24 ]
%31 = zext i32 %30 to i64
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %31
store i8 0, i8* %32
%33 = call i32 @puts(i8* %21)
%34 = load i8, i8* %21
%35 = icmp eq i8 %34, 120
br i1 %35, label %44, label %36
36: ; preds = %29, %36
%37 = phi i64 [ %40, %36 ], [ 0, %29 ]
%38 = phi i8 [ %42, %36 ], [ %34, %29 ]
%39 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 %37
store i8 %38, i8* %39
%40 = add nuw nsw i64 %37, 1
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %40
%42 = load i8, i8* %41
%43 = icmp eq i8 %42, 120
br i1 %43, label %44, label %36
44: ; preds = %36, %29
%45 = phi i64 [ 0, %29 ], [ %40, %36 ]
%46 = call double @atof(i8* %22)
%47 = and i64 %45, 4294967295
br label %48
48: ; preds = %48, %44
%49 = phi i64 [ %53, %48 ], [ %47, %44 ]
%50 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %49
%51 = load i8, i8* %50
%52 = icmp eq i8 %51, 120
%53 = add nuw i64 %49, 1
br i1 %52, label %48, label %54
54: ; preds = %48
%55 = and i64 %49, 4294967295
%56 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %55
%57 = load i8, i8* %56
%58 = icmp eq i8 %57, 120
br i1 %58, label %69, label %59
59: ; preds = %54, %59
%60 = phi i64 [ %64, %59 ], [ 0, %54 ]
%61 = phi i64 [ %63, %59 ], [ %55, %54 ]
%62 = phi i8 [ %67, %59 ], [ %57, %54 ]
%63 = add nuw i64 %61, 1
%64 = add nuw i64 %60, 1
%65 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 %60
store i8 %62, i8* %65
%66 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %63
%67 = load i8, i8* %66
%68 = icmp eq i8 %67, 120
br i1 %68, label %69, label %59
69: ; preds = %59, %54
%70 = call double @atof(i8* %23)
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %46)
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %70)
%73 = call i32 @read(i32 %26, i8* %21, i32 1024)
%74 = icmp sgt i32 %73, 0
br i1 %74, label %29, label %75
75: ; preds = %69, %24
br label %24
}