#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 *);
scalar_t__ 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");
  if (receive_message_from_variable_server(socket_desc, server_reply, 2000,
                                           0) <= 0) {
    puts("data not received\n");
    return 1;
  }
  puts("reply 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    1555 <main+0x3c5>
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    1555 <main+0x3c5>
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    1555 <main+0x3c5>
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    1555 <main+0x3c5>
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    1555 <main+0x3c5>
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    1555 <main+0x3c5>
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    1555 <main+0x3c5>
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    1555 <main+0x3c5>
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    1555 <main+0x3c5>
mov    -0x818(%rbp),%rdi
call   1040 <puts@plt>
lea    0xc5b(%rip),%rdi
call   1040 <puts@plt>
mov    -0x14(%rbp),%edi
lea    -0x800(%rbp),%rsi
mov    $0x7d0,%edx
xor    %ecx,%ecx
call   1080 <receive_message_from_variable_server@plt>
cmp    $0x0,%rax
jg     152a <main+0x39a>
lea    0xc8b(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    1555 <main+0x3c5>
lea    0xc86(%rip),%rdi
call   1040 <puts@plt>
lea    -0x800(%rbp),%rdi
call   1040 <puts@plt>
lea    0xc7f(%rip),%rdi
call   1040 <puts@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x7d0,%rsp
mov    0x8(%rsi),%rdi
test   %rdi,%rdi
je     13a9 <main+0x219>
mov    %rsi,%rbx
call   10a0 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rax
test   %rax,%rax
lea    0xe50(%rip),%rbx
cmovne %rax,%rbx
lea    0xe88(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe82(%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    1202 <main+0x72>
lea    0xe73(%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     13b2 <main+0x222>
lea    0xe91(%rip),%rdi
call   1040 <puts@plt>
movsd  0xdd4(%rip),%xmm0
mov    %r14d,%edi
call   1070 <set_cycle@plt>
test   %rax,%rax
js     13bb <main+0x22b>
lea    0xe97(%rip),%rdi
movsd  0xdb4(%rip),%xmm0
mov    $0x1,%al
call   1060 <printf@plt>
movsd  0xdad(%rip),%xmm0
mov    %r14d,%edi
call   1030 <set_copy_mode@plt>
test   %rax,%rax
js     13cd <main+0x23d>
lea    0xe9d(%rip),%rdi
movsd  0xd8d(%rip),%xmm0
mov    $0x1,%al
call   1060 <printf@plt>
lea    0xe9c(%rip),%rsi
mov    %r14d,%edi
call   1050 <add_variable_to_server@plt>
test   %rax,%rax
js     13c4 <main+0x234>
lea    0xe84(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9b(%rip),%rdi
call   1040 <puts@plt>
lea    0xea0(%rip),%rsi
mov    %r14d,%edi
call   1050 <add_variable_to_server@plt>
test   %rax,%rax
js     13c4 <main+0x234>
lea    0xe88(%rip),%rdi
call   1040 <puts@plt>
lea    0xe6b(%rip),%rdi
call   1040 <puts@plt>
lea    0xe84(%rip),%rsi
mov    %r14d,%edi
call   1050 <add_variable_to_server@plt>
test   %rax,%rax
js     13c4 <main+0x234>
lea    0xe6c(%rip),%rdi
call   1040 <puts@plt>
lea    0xe3b(%rip),%rdi
call   1040 <puts@plt>
lea    0xe68(%rip),%rsi
mov    %r14d,%edi
call   1050 <add_variable_to_server@plt>
test   %rax,%rax
js     13c4 <main+0x234>
lea    0xe50(%rip),%rdi
call   1040 <puts@plt>
lea    0xe0b(%rip),%rdi
call   1040 <puts@plt>
lea    0xe4c(%rip),%rsi
mov    %r14d,%edi
call   1050 <add_variable_to_server@plt>
test   %rax,%rax
js     13c4 <main+0x234>
lea    0xe38(%rip),%rdi
call   1040 <puts@plt>
lea    0xddf(%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   %rax,%rax
jle    13ec <main+0x25c>
lea    0xe29(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rdi
call   1040 <puts@plt>
lea    0xe26(%rip),%rdi
call   1040 <puts@plt>
jmp    13de <main+0x24e>
lea    0xc6a(%rip),%rdi
jmp    13d4 <main+0x244>
lea    0xcc8(%rip),%rdi
jmp    13d4 <main+0x244>
lea    0xcf9(%rip),%rdi
jmp    13d4 <main+0x244>
lea    0xd5f(%rip),%rdi
jmp    13d4 <main+0x244>
lea    0xd20(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x7d0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xdb1(%rip),%rdi
jmp    13d4 <main+0x244>

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 = [19 x i8] c"data not received\0A\00"
@.str.19 = [17 x i8] c"reply 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*
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
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = icmp ne i8* %15, null
br i1 %16, label %19, label %17
17: ; preds = %2
%18 = 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 %132
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32 @atoi(i8* %22)
store i32 %23, i32* %8
br label %24
24: ; preds = %19
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = icmp ne i8* %27, null
br i1 %28, label %29, label %33
29: ; preds = %24
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 2
%32 = load i8*, i8** %31
store i8* %32, i8** %7
br label %33
33: ; preds = %29, %24
%34 = load i8*, i8** %7
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %34)
%36 = load i32, i32* %8
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %36)
%38 = call i32 (...) @create_default_socket()
store i32 %38, i32* %6
%39 = load i32, i32* %6
%40 = icmp eq i32 %39, -1
br i1 %40, label %41, label %43
41: ; preds = %33
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
br label %43
43: ; preds = %41, %33
%44 = load i32, i32* %6
%45 = load i8*, i8** %7
%46 = load i32, i32* %8
%47 = call i64 @connect_to_variable_server(i32 %44, i8* %45, i32 %46)
%48 = icmp slt i64 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %43
%50 = 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 %132
51: ; preds = %43
%52 = 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
%53 = load i32, i32* %6
%54 = load double, double* %10
%55 = call i64 @set_cycle(i32 %53, double %54)
%56 = icmp slt i64 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %51
%58 = 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 %132
59: ; preds = %51
%60 = load double, double* %10
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), double %60)
store double 1.000000e+00, double* %11
%62 = load i32, i32* %6
%63 = load double, double* %11
%64 = call i64 @set_copy_mode(i32 %62, double %63)
%65 = icmp slt i64 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %59
%67 = 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 %132
68: ; preds = %59
%69 = load double, double* %11
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), double %69)
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i8** %12
%71 = load i32, i32* %6
%72 = load i8*, i8** %12
%73 = call i64 @add_variable_to_server(i32 %71, i8* %72)
%74 = icmp slt i64 %73, 0
br i1 %74, label %75, label %77
75: ; preds = %68
%76 = 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 %132
77: ; preds = %68
%78 = load i8*, i8** %12
%79 = call i32 @puts(i8* %78)
%80 = 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
%81 = load i32, i32* %6
%82 = load i8*, i8** %12
%83 = call i64 @add_variable_to_server(i32 %81, i8* %82)
%84 = icmp slt i64 %83, 0
br i1 %84, label %85, label %87
85: ; preds = %77
%86 = 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 %132
87: ; preds = %77
%88 = load i8*, i8** %12
%89 = call i32 @puts(i8* %88)
%90 = 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
%91 = load i32, i32* %6
%92 = load i8*, i8** %12
%93 = call i64 @add_variable_to_server(i32 %91, i8* %92)
%94 = icmp slt i64 %93, 0
br i1 %94, label %95, label %97
95: ; preds = %87
%96 = 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 %132
97: ; preds = %87
%98 = load i8*, i8** %12
%99 = call i32 @puts(i8* %98)
%100 = 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
%101 = load i32, i32* %6
%102 = load i8*, i8** %12
%103 = call i64 @add_variable_to_server(i32 %101, i8* %102)
%104 = icmp slt i64 %103, 0
br i1 %104, label %105, label %107
105: ; preds = %97
%106 = 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 %132
107: ; preds = %97
%108 = load i8*, i8** %12
%109 = call i32 @puts(i8* %108)
%110 = 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
%111 = load i32, i32* %6
%112 = load i8*, i8** %12
%113 = call i64 @add_variable_to_server(i32 %111, i8* %112)
%114 = icmp slt i64 %113, 0
br i1 %114, label %115, label %117
115: ; preds = %107
%116 = 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 %132
117: ; preds = %107
%118 = load i8*, i8** %12
%119 = call i32 @puts(i8* %118)
%120 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0))
%121 = load i32, i32* %6
%122 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 0
%123 = call i64 @receive_message_from_variable_server(i32 %121, i8* %122, i32 2000, i32 0)
%124 = icmp sle i64 %123, 0
br i1 %124, label %125, label %127
125: ; preds = %117
%126 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0))
store i32 1, i32* %3
br label %132
127: ; preds = %117
%128 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.19, i64 0, i64 0))
%129 = getelementptr inbounds [2000 x i8], [2000 x i8]* %9, i64 0, i64 0
%130 = call i32 @puts(i8* %129)
%131 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.20, i64 0, i64 0))
store i32 0, i32* %3
br label %132
132: ; preds = %127, %125, %115, %105, %95, %85, %75, %66, %57, %49, %17
%133 = load i32, i32* %3
ret i32 %133
}

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 = [19 x i8] c"data not received\0A\00"
@.str.19 = [17 x i8] c"reply 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 %86
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 %84
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 %84
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 %84
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 %84
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 %84
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 %84
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 %84
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 %84
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 i64 @receive_message_from_variable_server(i32 %18, i8* %17, i32 2000, i32 0)
%77 = icmp slt i64 %76, 1
br i1 %77, label %78, label %80
78: ; preds = %73
%79 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0))
br label %84
80: ; preds = %73
%81 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.19, i64 0, i64 0))
%82 = call i32 @puts(i8* %17)
%83 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.20, i64 0, i64 0))
br label %84
84: ; preds = %31, %43, %50, %57, %64, %71, %78, %80, %37, %25
%85 = phi i32 [ 1, %25 ], [ 1, %31 ], [ 1, %37 ], [ 1, %43 ], [ 1, %50 ], [ 1, %57 ], [ 1, %64 ], [ 1, %71 ], [ 1, %78 ], [ 0, %80 ]
br label %86
86: ; preds = %84, %7
%87 = phi i32 [ %85, %84 ], [ 1, %7 ]
ret i32 %87
}