#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 */

/* Variables and functions */
float atof(char *);
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ close(int);
float convert(char, char, float);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int /*<<< orphan*/ sprintf(char *, char *, float);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strlen(char *);
char *strtok(char *, char const *);
int write(int, char *, int /*<<< orphan*/);
void process(int sock) {
  int n;
  char buf[1024] = {'\0'};
  char userInput[1024] = {'\0'};
  char *msg = "b<->lbs conversion in C\n";
  n = write(sock, msg, strlen(msg));
  if (n < 0) {
    perror("ERROR writing to socket");
    close(sock);
    return;
  }
  bzero(buf, 1024);
  n = read(sock, buf, 1024);
  if (n < 0) {
    perror("ERROR reading from socket");
    close(sock);
    return;
  }
  strcpy(userInput, buf);
  const char s[2] = " ";
  char *token;
  int tok_count = 0;
  token = strtok(userInput, s);
  char from_conv[3] = {'\0'}, to_conv[3] = {'\0'};
  float input_val = 0.0f;
  while (token != NULL) {
    if (tok_count == 0) {
      if (!(strcmp(token, "b") == 0 || strcmp(token, "lbs") == 0)) {
        printf("Invalid input[%s]\n", buf);
        close(sock);
        return;
      }
      strcpy(from_conv, token);
      tok_count++;
    } else if (tok_count == 1) {
      if (!(strcmp(token, "lbs") == 0 || strcmp(token, "b") == 0)) {
        printf("Invalid input[%s]\n", buf);
        close(sock);
        return;
      }
      strcpy(to_conv, token);
      tok_count++;
    } else if (tok_count == 2) {
      input_val = atof(token);
      tok_count++;
    } else {
      printf("Invalid input[%s]\n", buf);
      close(sock);
      return;
    }
    token = strtok(NULL, s);
  }
  if (tok_count != 3) {
    printf("Invalid input[%s]\n", buf);
    close(sock);
    return;
  }
  float conv_val = convert(from_conv[0], to_conv[0], input_val);
  if (conv_val < 0.0f) {
    printf("Conversion failed..\n");
    close(sock);
    return;
  }
  printf("%f %s = %f %s\n", input_val, from_conv, conv_val, to_conv);
  bzero(buf, 1024);
  sprintf(buf, "%f\n", conv_val);
  n = write(sock, buf, strlen(buf));
  if (n < 0) {
    perror("ERROR writing to socket");
    close(sock);
    return;
  }
  close(sock);
}


x86 assembly (clang, -O0):
<process>:
push   %rbp
mov    %rsp,%rbp
sub    $0x860,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1090 <memset@plt>
lea    -0x810(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1090 <memset@plt>
lea    0xde5(%rip),%rax
mov    %rax,-0x818(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x84c(%rbp)
mov    -0x818(%rbp),%rax
mov    %rax,-0x848(%rbp)
mov    -0x818(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x84c(%rbp),%edi
mov    -0x848(%rbp),%rsi
mov    %eax,%edx
call   1060 <write@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    127f <process+0x9f>
lea    0xdac(%rip),%rdi
call   10d0 <perror@plt>
mov    -0x4(%rbp),%edi
call   10a0 <close@plt>
jmp    1631 <process+0x451>
lea    -0x410(%rbp),%rdi
mov    $0x400,%esi
call   10f0 <bzero@plt>
mov    -0x4(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x400,%edx
call   10b0 <read@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    12ca <process+0xea>
lea    0xd79(%rip),%rdi
call   10d0 <perror@plt>
mov    -0x4(%rbp),%edi
call   10a0 <close@plt>
jmp    1631 <process+0x451>
lea    -0x810(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1040 <strcpy@plt>
mov    0xd67(%rip),%ax
mov    %ax,-0x81a(%rbp)
movl   $0x0,-0x82c(%rbp)
lea    -0x810(%rbp),%rdi
lea    -0x81a(%rbp),%rsi
call   10e0 <strtok@plt>
mov    %rax,-0x828(%rbp)
lea    -0x82f(%rbp),%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1090 <memset@plt>
lea    -0x832(%rbp),%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1090 <memset@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x838(%rbp)
ff
cmpq   $0x0,-0x828(%rbp)
je     14eb <process+0x30b>
cmpl   $0x0,-0x82c(%rbp)
jne    13de <process+0x1fe>
mov    -0x828(%rbp),%rdi
lea    0xce4(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
je     13b7 <process+0x1d7>
mov    -0x828(%rbp),%rdi
lea    0xcc9(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
je     13b7 <process+0x1d7>
lea    -0x410(%rbp),%rsi
lea    0xcb0(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x4(%rbp),%edi
call   10a0 <close@plt>
jmp    1631 <process+0x451>
lea    -0x82f(%rbp),%rdi
mov    -0x828(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x82c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x82c(%rbp)
jmp    14cf <process+0x2ef>
cmpl   $0x1,-0x82c(%rbp)
jne    146e <process+0x28e>
mov    -0x828(%rbp),%rdi
lea    0xc56(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
je     1447 <process+0x267>
mov    -0x828(%rbp),%rdi
lea    0xc37(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
je     1447 <process+0x267>
lea    -0x410(%rbp),%rsi
lea    0xc20(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x4(%rbp),%edi
call   10a0 <close@plt>
jmp    1631 <process+0x451>
lea    -0x832(%rbp),%rdi
mov    -0x828(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x82c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x82c(%rbp)
jmp    14ca <process+0x2ea>
cmpl   $0x2,-0x82c(%rbp)
jne    14a3 <process+0x2c3>
mov    -0x828(%rbp),%rdi
call   1050 <atof@plt>
movss  %xmm0,-0x838(%rbp)
ff
mov    -0x82c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x82c(%rbp)
jmp    14c5 <process+0x2e5>
lea    -0x410(%rbp),%rsi
lea    0xba2(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x4(%rbp),%edi
call   10a0 <close@plt>
jmp    1631 <process+0x451>
jmp    14ca <process+0x2ea>
jmp    14cf <process+0x2ef>
lea    -0x81a(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   10e0 <strtok@plt>
mov    %rax,-0x828(%rbp)
jmp    1340 <process+0x160>
cmpl   $0x3,-0x82c(%rbp)
je     151a <process+0x33a>
lea    -0x410(%rbp),%rsi
lea    0xb4d(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x4(%rbp),%edi
call   10a0 <close@plt>
jmp    1631 <process+0x451>
mov    -0x82f(%rbp),%cl
mov    -0x832(%rbp),%al
movss  -0x838(%rbp),%xmm0
ff
movsbl %cl,%edi
movsbl %al,%esi
call   1030 <convert@plt>
movss  %xmm0,-0x83c(%rbp)
ff
xorps  %xmm0,%xmm0
ucomiss -0x83c(%rbp),%xmm0
jbe    156c <process+0x38c>
lea    0xb0e(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x4(%rbp),%edi
call   10a0 <close@plt>
jmp    1631 <process+0x451>
movss  -0x838(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    -0x82f(%rbp),%rsi
movss  -0x83c(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
lea    -0x832(%rbp),%rdx
lea    0xae2(%rip),%rdi
mov    $0x2,%al
call   1080 <printf@plt>
lea    -0x410(%rbp),%rdi
mov    $0x400,%esi
call   10f0 <bzero@plt>
lea    -0x410(%rbp),%rdi
movss  -0x83c(%rbp),%xmm0
ff
lea    0xac3(%rip),%rsi
call   1100 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x85c(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x858(%rbp)
lea    -0x410(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x85c(%rbp),%edi
mov    -0x858(%rbp),%rsi
mov    %eax,%edx
call   1060 <write@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1629 <process+0x449>
lea    0xa02(%rip),%rdi
call   10d0 <perror@plt>
mov    -0x4(%rbp),%edi
call   10a0 <close@plt>
jmp    1631 <process+0x451>
mov    -0x4(%rbp),%edi
call   10a0 <close@plt>
add    $0x860,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x828,%rsp
mov    %edi,%ebp
lea    0x20(%rsp),%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   10a0 <memset@plt>
lea    0x420(%rsp),%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   10a0 <memset@plt>
lea    0xdd1(%rip),%rbx
mov    %rbx,%rdi
call   1080 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1070 <write@plt>
test   %eax,%eax
js     149a <process+0x2aa>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1100 <bzero@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   10c0 <read@plt>
test   %eax,%eax
js     14a3 <process+0x2b3>
lea    0x420(%rsp),%rbx
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <strcpy@plt>
movw   $0x20,0x12(%rsp)
lea    0x12(%rsp),%rsi
mov    %rbx,%rdi
call   10f0 <strtok@plt>
movb   $0x0,0x10(%rsp)
movw   $0x0,0xe(%rsp)
movb   $0x0,0xc(%rsp)
movw   $0x0,0xa(%rsp)
test   %rax,%rax
je     13e5 <process+0x1f5>
mov    %rax,%r14
mov    %ebp,0x14(%rsp)
xor    %r15d,%r15d
xorps  %xmm0,%xmm0
lea    0x12(%rsp),%rbx
lea    0xd76(%rip),%r12
lea    0xd6d(%rip),%rbp
jmp    1313 <process+0x123>
mov    %r14,%rdi
call   1060 <atof@plt>
movss  %xmm0,0x18(%rsp)
mov    $0x3,%r15d
mov    $0x1,%r13b
xor    %edi,%edi
mov    %rbx,%rsi
call   10f0 <strtok@plt>
mov    %rax,%r14
test   %rax,%rax
movss  0x18(%rsp),%xmm0
je     13ab <process+0x1bb>
cmp    $0x2,%r15d
je     12e0 <process+0xf0>
cmp    $0x1,%r15d
movss  %xmm0,0x18(%rsp)
je     1370 <process+0x180>
test   %r15d,%r15d
jne    13fd <process+0x20d>
mov    %r14,%rdi
mov    %rbp,%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
je     1352 <process+0x162>
mov    %r14,%rdi
mov    %r12,%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
jne    13fd <process+0x20d>
lea    0xe(%rsp),%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
mov    $0x1,%r15d
jmp    13a3 <process+0x1b3>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r12,%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
je     1390 <process+0x1a0>
mov    %r14,%rdi
mov    %rbp,%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
jne    13fd <process+0x20d>
lea    0xa(%rsp),%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
mov    $0x2,%r15d
xor    %r13d,%r13d
jmp    12f7 <process+0x107>
test   %r13b,%r13b
mov    0x14(%rsp),%ebp
je     13e5 <process+0x1f5>
movsbl 0xe(%rsp),%edi
movsbl 0xa(%rsp),%esi
movss  %xmm0,0x18(%rsp)
call   1030 <convert@plt>
movaps %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm1,%xmm0
jbe    1416 <process+0x226>
lea    0xc9c(%rip),%rdi
call   1050 <puts@plt>
jmp    1481 <process+0x291>
lea    0xc65(%rip),%rdi
lea    0x20(%rsp),%rsi
xor    %eax,%eax
call   1090 <printf@plt>
jmp    1481 <process+0x291>
lea    0xc4d(%rip),%rdi
lea    0x20(%rsp),%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x14(%rsp),%ebp
jmp    1481 <process+0x291>
movss  0x18(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  %xmm1,0x1c(%rsp)
cvtss2sd %xmm1,%xmm1
lea    0xc33(%rip),%rdi
lea    0xe(%rsp),%rsi
lea    0xa(%rsp),%rdx
mov    $0x2,%al
call   1090 <printf@plt>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1100 <bzero@plt>
lea    0xc18(%rip),%rsi
mov    %rbx,%rdi
movss  0x1c(%rsp),%xmm0
call   1110 <sprintf@plt>
mov    %rbx,%rdi
call   1080 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1070 <write@plt>
test   %eax,%eax
js     14c7 <process+0x2d7>
mov    %ebp,%edi
call   10b0 <close@plt>
add    $0x828,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb78(%rip),%rdi
jmp    14aa <process+0x2ba>
lea    0xb87(%rip),%rdi
call   10e0 <perror@plt>
mov    %ebp,%edi
add    $0x828,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    10b0 <close@plt>
lea    0xb4b(%rip),%rdi
call   10e0 <perror@plt>
jmp    1481 <process+0x291>

LLVM IR (-O0):
@.str = [25 x i8] c"b<->lbs conversion in C\0A\00"
@.str.1 = [24 x i8] c"ERROR writing to socket\00"
@.str.2 = [26 x i8] c"ERROR reading from socket\00"
@__const.process.s = [2 x i8] c" \00"
@.str.3 = [2 x i8] c"b\00"
@.str.4 = [4 x i8] c"lbs\00"
@.str.5 = [19 x i8] c"Invalid input[%s]\0A\00"
@.str.6 = [21 x i8] c"Conversion failed..\0A\00"
@.str.7 = [15 x i8] c"%f %s = %f %s\0A\00"
@.str.8 = [4 x i8] c"%f\0A\00"
define void @process(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [1024 x i8]
%5 = alloca [1024 x i8]
%6 = alloca i8*
%7 = alloca [2 x i8]
%8 = alloca i8*
%9 = alloca i32
%10 = alloca [3 x i8]
%11 = alloca [3 x i8]
%12 = alloca float
%13 = alloca float
store i32 %0, i32* %2
%14 = bitcast [1024 x i8]* %4 to i8*
%15 = bitcast [1024 x i8]* %5 to i8*
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8** %6
%16 = load i32, i32* %2
%17 = load i8*, i8** %6
%18 = load i8*, i8** %6
%19 = call i32 @strlen(i8* %18)
%20 = call i32 @write(i32 %16, i8* %17, i32 %19)
store i32 %20, i32* %3
%21 = load i32, i32* %3
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %1
%24 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%25 = load i32, i32* %2
%26 = call i32 @close(i32 %25)
br label %162
27: ; preds = %1
%28 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%29 = call i32 @bzero(i8* %28, i32 1024)
%30 = load i32, i32* %2
%31 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%32 = call i32 @read(i32 %30, i8* %31, i32 1024)
store i32 %32, i32* %3
%33 = load i32, i32* %3
%34 = icmp slt i32 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %27
%36 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%37 = load i32, i32* %2
%38 = call i32 @close(i32 %37)
br label %162
39: ; preds = %27
%40 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%42 = call i32 @strcpy(i8* %40, i8* %41)
%43 = bitcast [2 x i8]* %7 to i8*
store i32 0, i32* %9
%44 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%45 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%46 = call i8* @strtok(i8* %44, i8* %45)
store i8* %46, i8** %8
%47 = bitcast [3 x i8]* %10 to i8*
%48 = bitcast [3 x i8]* %11 to i8*
store float 0.000000e+00, float* %12
br label %49
49: ; preds = %111, %39
%50 = load i8*, i8** %8
%51 = icmp ne i8* %50, null
br i1 %51, label %52, label %114
52: ; preds = %49
%53 = load i32, i32* %9
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %74
55: ; preds = %52
%56 = load i8*, i8** %8
%57 = call i64 @strcmp(i8* %56, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%58 = icmp eq i64 %57, 0
br i1 %58, label %68, label %59
59: ; preds = %55
%60 = load i8*, i8** %8
%61 = call i64 @strcmp(i8* %60, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%62 = icmp eq i64 %61, 0
br i1 %62, label %68, label %63
63: ; preds = %59
%64 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %64)
%66 = load i32, i32* %2
%67 = call i32 @close(i32 %66)
br label %162
68: ; preds = %59, %55
%69 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 0
%70 = load i8*, i8** %8
%71 = call i32 @strcpy(i8* %69, i8* %70)
%72 = load i32, i32* %9
%73 = add nsw i32 %72, 1
store i32 %73, i32* %9
br label %111
74: ; preds = %52
%75 = load i32, i32* %9
%76 = icmp eq i32 %75, 1
br i1 %76, label %77, label %96
77: ; preds = %74
%78 = load i8*, i8** %8
%79 = call i64 @strcmp(i8* %78, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%80 = icmp eq i64 %79, 0
br i1 %80, label %90, label %81
81: ; preds = %77
%82 = load i8*, i8** %8
%83 = call i64 @strcmp(i8* %82, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%84 = icmp eq i64 %83, 0
br i1 %84, label %90, label %85
85: ; preds = %81
%86 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %86)
%88 = load i32, i32* %2
%89 = call i32 @close(i32 %88)
br label %162
90: ; preds = %81, %77
%91 = getelementptr inbounds [3 x i8], [3 x i8]* %11, i64 0, i64 0
%92 = load i8*, i8** %8
%93 = call i32 @strcpy(i8* %91, i8* %92)
%94 = load i32, i32* %9
%95 = add nsw i32 %94, 1
store i32 %95, i32* %9
br label %110
96: ; preds = %74
%97 = load i32, i32* %9
%98 = icmp eq i32 %97, 2
br i1 %98, label %99, label %104
99: ; preds = %96
%100 = load i8*, i8** %8
%101 = call float @atof(i8* %100)
store float %101, float* %12
%102 = load i32, i32* %9
%103 = add nsw i32 %102, 1
store i32 %103, i32* %9
br label %109
104: ; preds = %96
%105 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %105)
%107 = load i32, i32* %2
%108 = call i32 @close(i32 %107)
br label %162
109: ; preds = %99
br label %110
110: ; preds = %109, %90
br label %111
111: ; preds = %110, %68
%112 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%113 = call i8* @strtok(i8* null, i8* %112)
store i8* %113, i8** %8
br label %49
114: ; preds = %49
%115 = load i32, i32* %9
%116 = icmp ne i32 %115, 3
br i1 %116, label %117, label %122
117: ; preds = %114
%118 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %118)
%120 = load i32, i32* %2
%121 = call i32 @close(i32 %120)
br label %162
122: ; preds = %114
%123 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 0
%124 = load i8, i8* %123
%125 = getelementptr inbounds [3 x i8], [3 x i8]* %11, i64 0, i64 0
%126 = load i8, i8* %125
%127 = load float, float* %12
%128 = call float @convert(i8 signext %124, i8 signext %126, float %127)
store float %128, float* %13
%129 = load float, float* %13
%130 = fcmp olt float %129, 0.000000e+00
br i1 %130, label %131, label %135
131: ; preds = %122
%132 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
%133 = load i32, i32* %2
%134 = call i32 @close(i32 %133)
br label %162
135: ; preds = %122
%136 = load float, float* %12
%137 = fpext float %136 to double
%138 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 0
%139 = load float, float* %13
%140 = fpext float %139 to double
%141 = getelementptr inbounds [3 x i8], [3 x i8]* %11, i64 0, i64 0
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), double %137, i8* %138, double %140, i8* %141)
%143 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%144 = call i32 @bzero(i8* %143, i32 1024)
%145 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%146 = load float, float* %13
%147 = call i32 @sprintf(i8* %145, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), float %146)
%148 = load i32, i32* %2
%149 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%150 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%151 = call i32 @strlen(i8* %150)
%152 = call i32 @write(i32 %148, i8* %149, i32 %151)
store i32 %152, i32* %3
%153 = load i32, i32* %3
%154 = icmp slt i32 %153, 0
br i1 %154, label %155, label %159
155: ; preds = %135
%156 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%157 = load i32, i32* %2
%158 = call i32 @close(i32 %157)
br label %162
159: ; preds = %135
%160 = load i32, i32* %2
%161 = call i32 @close(i32 %160)
br label %162
162: ; preds = %159, %155, %131, %117, %104, %85, %63, %35, %23
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"b<->lbs conversion in C\0A\00"
@.str.1 = [24 x i8] c"ERROR writing to socket\00"
@.str.2 = [26 x i8] c"ERROR reading from socket\00"
@.str.3 = [2 x i8] c"b\00"
@.str.4 = [4 x i8] c"lbs\00"
@.str.5 = [19 x i8] c"Invalid input[%s]\0A\00"
@.str.7 = [15 x i8] c"%f %s = %f %s\0A\00"
@.str.8 = [4 x i8] c"%f\0A\00"
@str = [20 x i8] c"Conversion failed..\00"
define void @process(i32 %0) {
%2 = alloca [1024 x i8]
%3 = alloca [1024 x i8]
%4 = alloca i16
%5 = alloca [3 x i8]
%6 = alloca [3 x i8]
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%9 = tail call i32 @strlen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @write(i32 %0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = tail call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%14 = tail call i32 @close(i32 %0)
br label %86
15: ; preds = %1
%16 = call i32 @bzero(i8* %7, i32 1024)
%17 = call i32 @read(i32 %0, i8* %7, i32 1024)
%18 = icmp slt i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = tail call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%21 = tail call i32 @close(i32 %0)
br label %86
22: ; preds = %15
%23 = call i32 @strcpy(i8* %8, i8* %7)
%24 = bitcast i16* %4 to i8*
store i16 32, i16* %4
%25 = call i8* @strtok(i8* %8, i8* %24)
%26 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%27 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%28 = icmp eq i8* %25, null
br i1 %28, label %64, label %29
29: ; preds = %22, %57
%30 = phi float [ %60, %57 ], [ 0.000000e+00, %22 ]
%31 = phi i32 [ %59, %57 ], [ 0, %22 ]
%32 = phi i8* [ %61, %57 ], [ %25, %22 ]
switch i32 %31, label %55 [
i32 0, label %33
i32 1, label %43
i32 2, label %53
]
33: ; preds = %29
%34 = call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %41, label %36
36: ; preds = %33
%37 = call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %41, label %39
39: ; preds = %36
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %7)
br label %84
41: ; preds = %36, %33
%42 = call i32 @strcpy(i8* %26, i8* %32)
br label %57
43: ; preds = %29
%44 = call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %51, label %46
46: ; preds = %43
%47 = call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%48 = icmp eq i64 %47, 0
br i1 %48, label %51, label %49
49: ; preds = %46
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %7)
br label %84
51: ; preds = %46, %43
%52 = call i32 @strcpy(i8* %27, i8* %32)
br label %57
53: ; preds = %29
%54 = call float @atof(i8* %32)
br label %57
55: ; preds = %29
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %7)
br label %84
57: ; preds = %51, %53, %41
%58 = phi i1 [ false, %51 ], [ true, %53 ], [ false, %41 ]
%59 = phi i32 [ 2, %51 ], [ 3, %53 ], [ 1, %41 ]
%60 = phi float [ %30, %51 ], [ %54, %53 ], [ %30, %41 ]
%61 = call i8* @strtok(i8* null, i8* %24)
%62 = icmp eq i8* %61, null
br i1 %62, label %63, label %29
63: ; preds = %57
br i1 %58, label %66, label %64
64: ; preds = %22, %63
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %7)
br label %84
66: ; preds = %63
%67 = load i8, i8* %26
%68 = load i8, i8* %27
%69 = call float @convert(i8 signext %67, i8 signext %68, float %60)
%70 = fcmp olt float %69, 0.000000e+00
br i1 %70, label %71, label %73
71: ; preds = %66
%72 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %84
73: ; preds = %66
%74 = fpext float %60 to double
%75 = fpext float %69 to double
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), double %74, i8* %26, double %75, i8* %27)
%77 = call i32 @bzero(i8* %7, i32 1024)
%78 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), float %69)
%79 = call i32 @strlen(i8* %7)
%80 = call i32 @write(i32 %0, i8* %7, i32 %79)
%81 = icmp slt i32 %80, 0
br i1 %81, label %82, label %84
82: ; preds = %73
%83 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %84
84: ; preds = %73, %71, %82, %64, %55, %49, %39
%85 = call i32 @close(i32 %0)
br label %86
86: ; preds = %84, %19, %12
ret void
}