#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 */
scalar_t__ add_variable_to_server(int, char *);
int atoi(char *);
scalar_t__ connect_to_variable_server(int, char *, int);
int create_default_socket();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int receive_message_from_variable_server(int, char *, int, int /*<<< orphan*/);
scalar_t__ set_copy_mode(int, double);
scalar_t__ set_cycle(int, double);
int main(int narg, char **args) {
  int socket_desc;
  char *host = "127.0.0.1";
  int port = 0;
  if (!args[1]) {
    puts("Port Number not specified as input parameter. Try again!");
    return 1;
  } else
    port = atoi(args[1]);
  if (args[2]) {
    host = args[2];
  }
  printf("Host = %s\n", host);
  printf("SeverPort = %i\n", port);
  char server_reply[2000];
  socket_desc = create_default_socket();
  if (socket_desc == -1) {
    printf("socket not created");
  }
  if (connect_to_variable_server(socket_desc, host, port) < 0) {
    puts("failed to connect to the Trick Variable Server");
    return 1;
  }
  puts("Connected\n");
  double period = 0.5;
  if (set_cycle(socket_desc, period) < 0) {
    puts("failed to set the update period");
    return 1;
  }
  printf("Update Period Set to %f\n", period);
  double mode = 1;
  if (set_copy_mode(socket_desc, mode) < 0) {
    puts("failed to set the copy mode");
    return 1;
  }
  printf("Copy Mode Set to %f\n", mode);
  char *var_name = "time";
  if (add_variable_to_server(socket_desc, var_name) < 0) {
    puts("add variable to server failed");
    return 1;
  }
  puts(var_name);
  puts(" variable added\n");
  var_name = "dyn.baseball.pos[0]";
  if (add_variable_to_server(socket_desc, var_name) < 0) {
    puts("add variable to server failed");
    return 1;
  }
  puts(var_name);
  puts(" variable added\n");
  var_name = "dyn.baseball.pos[1]";
  if (add_variable_to_server(socket_desc, var_name) < 0) {
    puts("add variable to server failed");
    return 1;
  }
  puts(var_name);
  puts(" variable added\n");
  var_name = "dyn.baseball.pos[2]";
  if (add_variable_to_server(socket_desc, var_name) < 0) {
    puts("add variable to server failed");
    return 1;
  }
  puts(var_name);
  puts(" variable added\n");
  var_name = "dyn.baseball.g";
  if (add_variable_to_server(socket_desc, var_name) < 0) {
    puts("add variable to server failed");
    return 1;
  }
  puts(var_name);
  puts(" variable added\n");
  int data_recv_ack = 1;
  while (data_recv_ack > 0) {
    data_recv_ack = receive_message_from_variable_server(socket_desc,
                                                         server_reply, 2000, 0);
    if (data_recv_ack <= 0) {
      puts("no data to receive\n");
    } else {
      puts("data received:\n");
      puts(server_reply);
      puts("------------------\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x820,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe60(%rip),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
jne    11e2 <main+0x52>
lea    0xe49(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    1573 <main+0x3e3>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x10(%rax)
je     120d <main+0x7d>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   10b0 <create_default_socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1252 <main+0xc2>
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1090 <connect_to_variable_server@plt>
cmp    $0x0,%rax
jge    1283 <main+0xf3>
lea    0xe0f(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    1573 <main+0x3e3>
lea    0xe26(%rip),%rdi
call   1040 <puts@plt>
movsd  0xd69(%rip),%xmm0
movsd  %xmm0,-0x808(%rbp)
ff
mov    -0x14(%rbp),%edi
movsd  -0x808(%rbp),%xmm0
ff
call   1070 <set_cycle@plt>
cmp    $0x0,%rax
jge    12d1 <main+0x141>
lea    0xdfb(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    1573 <main+0x3e3>
movsd  -0x808(%rbp),%xmm0
ff
lea    0xdfb(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  0xd19(%rip),%xmm0
movsd  %xmm0,-0x810(%rbp)
ff
mov    -0x14(%rbp),%edi
movsd  -0x810(%rbp),%xmm0
ff
call   1030 <set_copy_mode@plt>
cmp    $0x0,%rax
jge    1329 <main+0x199>
lea    0xddc(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    1573 <main+0x3e3>
movsd  -0x810(%rbp),%xmm0
ff
lea    0xdd8(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
lea    0xddf(%rip),%rax
mov    %rax,-0x818(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x818(%rbp),%rsi
call   1050 <add_variable_to_server@plt>
cmp    $0x0,%rax
jge    137e <main+0x1ee>
lea    0xdbd(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    1573 <main+0x3e3>
mov    -0x818(%rbp),%rdi
call   1040 <puts@plt>
lea    0xdb7(%rip),%rdi
call   1040 <puts@plt>
lea    0xdbc(%rip),%rax
mov    %rax,-0x818(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x818(%rbp),%rsi
call   1050 <add_variable_to_server@plt>
cmp    $0x0,%rax
jge    13d5 <main+0x245>
lea    0xd66(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    1573 <main+0x3e3>
mov    -0x818(%rbp),%rdi
call   1040 <puts@plt>
lea    0xd60(%rip),%rdi
call   1040 <puts@plt>
lea    0xd79(%rip),%rax
mov    %rax,-0x818(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x818(%rbp),%rsi
call   1050 <add_variable_to_server@plt>
cmp    $0x0,%rax
jge    142c <main+0x29c>
lea    0xd0f(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    1573 <main+0x3e3>
mov    -0x818(%rbp),%rdi
call   1040 <puts@plt>
lea    0xd09(%rip),%rdi
call   1040 <puts@plt>
lea    0xd36(%rip),%rax
mov    %rax,-0x818(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x818(%rbp),%rsi
call   1050 <add_variable_to_server@plt>
cmp    $0x0,%rax
jge    1483 <main+0x2f3>
lea    0xcb8(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    1573 <main+0x3e3>
mov    -0x818(%rbp),%rdi
call   1040 <puts@plt>
lea    0xcb2(%rip),%rdi
call   1040 <puts@plt>
lea    0xcf3(%rip),%rax
mov    %rax,-0x818(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x818(%rbp),%rsi
call   1050 <add_variable_to_server@plt>
cmp    $0x0,%rax
jge    14da <main+0x34a>
lea    0xc61(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    1573 <main+0x3e3>
mov    -0x818(%rbp),%rdi
call   1040 <puts@plt>
lea    0xc5b(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x81c(%rbp)
cmpl   $0x0,-0x81c(%rbp)
jle    156c <main+0x3dc>
mov    -0x14(%rbp),%edi
lea    -0x800(%rbp),%rsi
mov    $0x7d0,%edx
xor    %ecx,%ecx
call   1080 <receive_message_from_variable_server@plt>
mov    %eax,-0x81c(%rbp)
cmpl   $0x0,-0x81c(%rbp)
jg     1543 <main+0x3b3>
lea    0xc6b(%rip),%rdi
call   1040 <puts@plt>
jmp    1567 <main+0x3d7>
lea    0xc6e(%rip),%rdi
call   1040 <puts@plt>
lea    -0x800(%rbp),%rdi
call   1040 <puts@plt>
lea    0xc66(%rip),%rdi
call   1040 <puts@plt>
jmp    14fc <main+0x36c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x7d0,%rsp
mov    0x8(%rsi),%rdi
test   %rdi,%rdi
je     13dc <main+0x24c>
mov    %rsi,%rbx
call   10a0 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rax
test   %rax,%rax
lea    0xe4c(%rip),%rbx
cmovne %rax,%rbx
lea    0xe84(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe7e(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   10b0 <create_default_socket@plt>
mov    %eax,%r14d
cmp    $0xffffffff,%eax
jne    1206 <main+0x76>
lea    0xe6f(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1090 <connect_to_variable_server@plt>
test   %rax,%rax
js     13e5 <main+0x255>
lea    0xe8d(%rip),%rdi
call   1040 <puts@plt>
movsd  0xdd0(%rip),%xmm0
mov    %r14d,%edi
call   1070 <set_cycle@plt>
test   %rax,%rax
js     13ee <main+0x25e>
lea    0xe93(%rip),%rdi
movsd  0xdb0(%rip),%xmm0
mov    $0x1,%al
call   1060 <printf@plt>
movsd  0xda9(%rip),%xmm0
mov    %r14d,%edi
call   1030 <set_copy_mode@plt>
test   %rax,%rax
js     1400 <main+0x270>
lea    0xe99(%rip),%rdi
movsd  0xd89(%rip),%xmm0
mov    $0x1,%al
call   1060 <printf@plt>
lea    0xe98(%rip),%rsi
mov    %r14d,%edi
call   1050 <add_variable_to_server@plt>
test   %rax,%rax
js     13f7 <main+0x267>
lea    0xe80(%rip),%rdi
call   1040 <puts@plt>
lea    0xe97(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9c(%rip),%rsi
mov    %r14d,%edi
call   1050 <add_variable_to_server@plt>
test   %rax,%rax
js     13f7 <main+0x267>
lea    0xe84(%rip),%rdi
call   1040 <puts@plt>
lea    0xe67(%rip),%rdi
call   1040 <puts@plt>
lea    0xe80(%rip),%rsi
mov    %r14d,%edi
call   1050 <add_variable_to_server@plt>
test   %rax,%rax
js     13f7 <main+0x267>
lea    0xe68(%rip),%rdi
call   1040 <puts@plt>
lea    0xe37(%rip),%rdi
call   1040 <puts@plt>
lea    0xe64(%rip),%rsi
mov    %r14d,%edi
call   1050 <add_variable_to_server@plt>
test   %rax,%rax
js     13f7 <main+0x267>
lea    0xe4c(%rip),%rdi
call   1040 <puts@plt>
lea    0xe07(%rip),%rdi
call   1040 <puts@plt>
lea    0xe48(%rip),%rsi
mov    %r14d,%edi
call   1050 <add_variable_to_server@plt>
test   %rax,%rax
js     13f7 <main+0x267>
lea    0xe30(%rip),%rdi
call   1040 <puts@plt>
lea    0xdd7(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rsi
xor    %ebp,%ebp
mov    %r14d,%edi
mov    $0x7d0,%edx
xor    %ecx,%ecx
call   1080 <receive_message_from_variable_server@plt>
test   %eax,%eax
jle    13ce <main+0x23e>
lea    0xe23(%rip),%r15
mov    %rsp,%rbx
lea    0xe29(%rip),%r12
nop
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %r12,%rdi
call   1040 <puts@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x7d0,%edx
xor    %ecx,%ecx
call   1080 <receive_message_from_variable_server@plt>
test   %eax,%eax
jg     13a0 <main+0x210>
lea    0xdcf(%rip),%rdi
call   1040 <puts@plt>
jmp    1411 <main+0x281>
lea    0xc37(%rip),%rdi
jmp    1407 <main+0x277>
lea    0xc95(%rip),%rdi
jmp    1407 <main+0x277>
lea    0xcc6(%rip),%rdi
jmp    1407 <main+0x277>
lea    0xd2c(%rip),%rdi
jmp    1407 <main+0x277>
lea    0xced(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x7d0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"127.0.0.1\00"
@.str.1 = [57 x i8] c"Port Number not specified as input parameter. Try again!\00"
@.str.2 = [11 x i8] c"Host = %s\0A\00"
@.str.3 = [16 x i8] c"SeverPort = %i\0A\00"
@.str.4 = [19 x i8] c"socket not created\00"
@.str.5 = [47 x i8] c"failed to connect to the Trick Variable Server\00"
@.str.6 = [11 x i8] c"Connected\0A\00"
@.str.7 = [32 x i8] c"failed to set the update period\00"
@.str.8 = [25 x i8] c"Update Period Set to %f\0A\00"
@.str.9 = [28 x i8] c"failed to set the copy mode\00"
@.str.10 = [21 x i8] c"Copy Mode Set to %f\0A\00"
@.str.11 = [5 x i8] c"time\00"
@.str.12 = [30 x i8] c"add variable to server failed\00"
@.str.13 = [17 x i8] c" variable added\0A\00"
@.str.14 = [20 x i8] c"dyn.baseball.pos[0]\00"
@.str.15 = [20 x i8] c"dyn.baseball.pos[1]\00"
@.str.16 = [20 x i8] c"dyn.baseball.pos[2]\00"
@.str.17 = [15 x i8] c"dyn.baseball.g\00"
@.str.18 = [20 x i8] c"no data to receive\0A\00"
@.str.19 = [16 x i8] c"data received:\0A\00"
@.str.20 = [20 x i8] c"------------------\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [2000 x i8]
%10 = alloca double
%11 = alloca double
%12 = alloca i8*
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %7
store i32 0, i32* %8
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = icmp ne i8* %16, null
br i1 %17, label %20, label %18
18: ; preds = %2
%19 = call i32 @puts(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %140
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @atoi(i8* %23)
store i32 %24, i32* %8
br label %25
25: ; preds = %20
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 2
%28 = load i8*, i8** %27
%29 = icmp ne i8* %28, null
br i1 %29, label %30, label %34
30: ; preds = %25
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 2
%33 = load i8*, i8** %32
store i8* %33, i8** %7
br label %34
34: ; preds = %30, %25
%35 = load i8*, i8** %7
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %35)
%37 = load i32, i32* %8
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %37)
%39 = call i32 (...) @create_default_socket()
store i32 %39, i32* %6
%40 = load i32, i32* %6
%41 = icmp eq i32 %40, -1
br i1 %41, label %42, label %44
42: ; preds = %34
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
br label %44
44: ; preds = %42, %34
%45 = load i32, i32* %6
%46 = load i8*, i8** %7
%47 = load i32, i32* %8
%48 = call i64 @connect_to_variable_server(i32 %45, i8* %46, i32 %47)
%49 = icmp slt i64 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %44
%51 = call i32 @puts(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %3
br label %140
52: ; preds = %44
%53 = call i32 @puts(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
store double 5.000000e-01, double* %10
%54 = load i32, i32* %6
%55 = load double, double* %10
%56 = call i64 @set_cycle(i32 %54, double %55)
%57 = icmp slt i64 %56, 0
br i1 %57, label %58, label %60
58: ; preds = %52
%59 = call i32 @puts(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %3
br label %140
60: ; preds = %52
%61 = load double, double* %10
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), double %61)
store double 1.000000e+00, double* %11
%63 = load i32, i32* %6
%64 = load double, double* %11
%65 = call i64 @set_copy_mode(i32 %63, double %64)
%66 = icmp slt i64 %65, 0
br i1 %66, label %67, label %69
67: ; preds = %60
%68 = call i32 @puts(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
store i32 1, i32* %3
br label %140
69: ; preds = %60
%70 = load double, double* %11
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), double %70)
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i8** %12
%72 = load i32, i32* %6
%73 = load i8*, i8** %12
%74 = call i64 @add_variable_to_server(i32 %72, i8* %73)
%75 = icmp slt i64 %74, 0
br i1 %75, label %76, label %78
76: ; preds = %69
%77 = call i32 @puts(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.12, i64 0, i64 0))
store i32 1, i32* %3
br label %140
78: ; preds = %69
%79 = load i8*, i8** %12
%80 = call i32 @puts(i8* %79)
%81 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0))
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0), i8** %12
%82 = load i32, i32* %6
%83 = load i8*, i8** %12
%84 = call i64 @add_variable_to_server(i32 %82, i8* %83)
%85 = icmp slt i64 %84, 0
br i1 %85, label %86, label %88
86: ; preds = %78
%87 = call i32 @puts(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.12, i64 0, i64 0))
store i32 1, i32* %3
br label %140
88: ; preds = %78
%89 = load i8*, i8** %12
%90 = call i32 @puts(i8* %89)
%91 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0))
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0), i8** %12
%92 = load i32, i32* %6
%93 = load i8*, i8** %12
%94 = call i64 @add_variable_to_server(i32 %92, i8* %93)
%95 = icmp slt i64 %94, 0
br i1 %95, label %96, label %98
96: ; preds = %88
%97 = call i32 @puts(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.12, i64 0, i64 0))
store i32 1, i32* %3
br label %140
98: ; preds = %88
%99 = load i8*, i8** %12
%100 = call i32 @puts(i8* %99)
%101 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0))
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.16, i64 0, i64 0), i8** %12
%102 = load i32, i32* %6
%103 = load i8*, i8** %12
%104 = call i64 @add_variable_to_server(i32 %102, i8* %103)
%105 = icmp slt i64 %104, 0
br i1 %105, label %106, label %108
106: ; preds = %98
%107 = call i32 @puts(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.12, i64 0, i64 0))
store i32 1, i32* %3
br label %140
108: ; preds = %98
%109 = load i8*, i8** %12
%110 = call i32 @puts(i8* %109)
%111 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0))
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.17, i64 0, i64 0), i8** %12
%112 = load i32, i32* %6
%113 = load i8*, i8** %12
%114 = call i64 @add_variable_to_server(i32 %112, i8* %113)
%115 = icmp slt i64 %114, 0
br i1 %115, label %116, label %118
116: ; preds = %108
%117 = call i32 @puts(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.12, i64 0, i64 0))
store i32 1, i32* %3
br label %140
118: ; preds = %108
%119 = load i8*, i8** %12
%120 = call i32 @puts(i8* %119)
%121 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0))
store i32 1, i32* %13
br label %122
122: ; preds = %138, %118
%123 = load i32, i32* %13
%124 = icmp sgt i32 %123, 0
br i1 %124, label %125, label %139
125: ; preds = %122
%126 = load i32, i32* %6
%127 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 0
%128 = call i32 @receive_message_from_variable_server(i32 %126, i8* %127, i32 2000, i32 0)
store i32 %128, i32* %13
%129 = load i32, i32* %13
%130 = icmp sle i32 %129, 0
br i1 %130, label %131, label %133
131: ; preds = %125
%132 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.18, i64 0, i64 0))
br label %138
133: ; preds = %125
%134 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.19, i64 0, i64 0))
%135 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 0
%136 = call i32 @puts(i8* %135)
%137 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.20, i64 0, i64 0))
br label %138
138: ; preds = %133, %131
br label %122
139: ; preds = %122
store i32 0, i32* %3
br label %140
140: ; preds = %139, %116, %106, %96, %86, %76, %67, %58, %50, %18
%141 = load i32, i32* %3
ret i32 %141
}

LLVM IR (-O2):
@.str = [10 x i8] c"127.0.0.1\00"
@.str.1 = [57 x i8] c"Port Number not specified as input parameter. Try again!\00"
@.str.2 = [11 x i8] c"Host = %s\0A\00"
@.str.3 = [16 x i8] c"SeverPort = %i\0A\00"
@.str.4 = [19 x i8] c"socket not created\00"
@.str.5 = [47 x i8] c"failed to connect to the Trick Variable Server\00"
@.str.6 = [11 x i8] c"Connected\0A\00"
@.str.7 = [32 x i8] c"failed to set the update period\00"
@.str.8 = [25 x i8] c"Update Period Set to %f\0A\00"
@.str.9 = [28 x i8] c"failed to set the copy mode\00"
@.str.10 = [21 x i8] c"Copy Mode Set to %f\0A\00"
@.str.11 = [5 x i8] c"time\00"
@.str.12 = [30 x i8] c"add variable to server failed\00"
@.str.13 = [17 x i8] c" variable added\0A\00"
@.str.14 = [20 x i8] c"dyn.baseball.pos[0]\00"
@.str.15 = [20 x i8] c"dyn.baseball.pos[1]\00"
@.str.16 = [20 x i8] c"dyn.baseball.pos[2]\00"
@.str.17 = [15 x i8] c"dyn.baseball.g\00"
@.str.18 = [20 x i8] c"no data to receive\0A\00"
@.str.19 = [16 x i8] c"data received:\0A\00"
@.str.20 = [20 x i8] c"------------------\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2000 x i8]
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
br label %88
9: ; preds = %2
%10 = tail call i32 @atoi(i8* %5)
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = icmp eq i8* %12, null
%14 = select i1 %13, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %12
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %14)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %10)
%17 = getelementptr inbounds [2000 x i8], [2000 x i8]* %3, i64 0, i64 0
%18 = tail call i32 (...) @create_default_socket()
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %22
20: ; preds = %9
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
br label %22
22: ; preds = %20, %9
%23 = tail call i64 @connect_to_variable_server(i32 %18, i8* %14, i32 %10)
%24 = icmp slt i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0))
br label %86
27: ; preds = %22
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%29 = tail call i64 @set_cycle(i32 %18, double 5.000000e-01)
%30 = icmp slt i64 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0))
br label %86
33: ; preds = %27
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), double 5.000000e-01)
%35 = tail call i64 @set_copy_mode(i32 %18, double 1.000000e+00)
%36 = icmp slt i64 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %86
39: ; preds = %33
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), double 1.000000e+00)
%41 = tail call i64 @add_variable_to_server(i32 %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
%42 = icmp slt i64 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %39
%44 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.12, i64 0, i64 0))
br label %86
45: ; preds = %39
%46 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
%47 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0))
%48 = tail call i64 @add_variable_to_server(i32 %18, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0))
%49 = icmp slt i64 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %45
%51 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.12, i64 0, i64 0))
br label %86
52: ; preds = %45
%53 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0))
%54 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0))
%55 = tail call i64 @add_variable_to_server(i32 %18, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0))
%56 = icmp slt i64 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %52
%58 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.12, i64 0, i64 0))
br label %86
59: ; preds = %52
%60 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0))
%61 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0))
%62 = tail call i64 @add_variable_to_server(i32 %18, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.16, i64 0, i64 0))
%63 = icmp slt i64 %62, 0
br i1 %63, label %64, label %66
64: ; preds = %59
%65 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.12, i64 0, i64 0))
br label %86
66: ; preds = %59
%67 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.16, i64 0, i64 0))
%68 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0))
%69 = tail call i64 @add_variable_to_server(i32 %18, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.17, i64 0, i64 0))
%70 = icmp slt i64 %69, 0
br i1 %70, label %71, label %73
71: ; preds = %66
%72 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.12, i64 0, i64 0))
br label %86
73: ; preds = %66
%74 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.17, i64 0, i64 0))
%75 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0))
%76 = call i32 @receive_message_from_variable_server(i32 %18, i8* %17, i32 2000, i32 0)
%77 = icmp slt i32 %76, 1
br i1 %77, label %84, label %78
78: ; preds = %73, %78
%79 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.19, i64 0, i64 0))
%80 = call i32 @puts(i8* %17)
%81 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.20, i64 0, i64 0))
%82 = call i32 @receive_message_from_variable_server(i32 %18, i8* %17, i32 2000, i32 0)
%83 = icmp slt i32 %82, 1
br i1 %83, label %84, label %78
84: ; preds = %78, %73
%85 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.18, i64 0, i64 0))
br label %86
86: ; preds = %84, %31, %43, %50, %57, %64, %71, %37, %25
%87 = phi i32 [ 1, %25 ], [ 1, %31 ], [ 1, %37 ], [ 1, %43 ], [ 1, %50 ], [ 1, %57 ], [ 1, %64 ], [ 1, %71 ], [ 0, %84 ]
br label %88
88: ; preds = %86, %7
%89 = phi i32 [ %87, %86 ], [ 1, %7 ]
ret i32 %89
}