#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;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ close(int);
int connect(int, struct sockaddr *, size_t);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_addr(char *);
int /*<<< orphan*/ recv(int, char *, size_t, int /*<<< orphan*/);
int /*<<< orphan*/ send(int, char *, size_t, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
main(int argc, char *argv[]) {
  int tcpfd;
  int ret;
  size_t size, len;
  char txbuf[1024], rcbuf[1024];
  struct sockaddr_in saddr;
  tcpfd = socket(AF_INET, SOCK_STREAM, 0);
  saddr.sin_family = AF_INET;
  saddr.sin_addr.s_addr = inet_addr("192.168.1.106");
  saddr.sin_port = htons(1100);
  ret = connect(tcpfd, (struct sockaddr *)&saddr, size);
  bzero(txbuf, 1024);
  send(tcpfd, txbuf, len, 0);
  bzero(rcbuf, 1024);
  recv(tcpfd, rcbuf, len, 0);
  close(tcpfd);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x840,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
mov    0x2e36(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10a0 <socket@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e33(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x838(%rbp)
lea    0xe3c(%rip),%rdi
call   1070 <inet_addr@plt>
mov    %eax,-0x83c(%rbp)
mov    $0x44c,%edi
call   1040 <htons@plt>
mov    %eax,-0x840(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x840(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1090 <connect@plt>
mov    %eax,-0x18(%rbp)
lea    -0x430(%rbp),%rdi
mov    $0x400,%esi
call   1080 <bzero@plt>
mov    -0x14(%rbp),%edi
lea    -0x430(%rbp),%rsi
mov    -0x28(%rbp),%rdx
xor    %ecx,%ecx
call   1050 <send@plt>
lea    -0x830(%rbp),%rdi
mov    $0x400,%esi
call   1080 <bzero@plt>
mov    -0x14(%rbp),%edi
lea    -0x830(%rbp),%rsi
mov    -0x28(%rbp),%rdx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
xor    %eax,%eax
add    $0x840,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x818,%rsp
mov    0x2e57(%rip),%r14
mov    (%r14),%edi
mov    0x2e3d(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10a0 <socket@plt>
mov    %eax,%ebx
mov    (%r14),%eax
mov    %eax,0x8(%rsp)
lea    0xe4c(%rip),%rdi
call   1070 <inet_addr@plt>
mov    %eax,0x4(%rsp)
mov    $0x44c,%edi
call   1040 <htons@plt>
mov    %eax,(%rsp)
mov    %rsp,%rsi
mov    %ebx,%edi
call   1090 <connect@plt>
lea    0x410(%rsp),%r14
mov    %r14,%rdi
mov    $0x400,%esi
call   1080 <bzero@plt>
mov    %ebx,%edi
mov    %r14,%rsi
xor    %ecx,%ecx
call   1050 <send@plt>
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x400,%esi
call   1080 <bzero@plt>
mov    %ebx,%edi
mov    %r14,%rsi
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %ebx,%edi
call   1060 <close@plt>
xor    %eax,%eax
add    $0x818,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [14 x i8] c"192.168.1.106\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
%8 = alloca i64
%9 = alloca [1024 x i8]
%10 = alloca [1024 x i8]
%11 = alloca %struct.sockaddr_in
store i32 %0, i32* %3
store i8** %1, i8*** %4
%12 = load i32, i32* @AF_INET
%13 = load i32, i32* @SOCK_STREAM
%14 = call i32 @socket(i32 %12, i32 %13, i32 0)
store i32 %14, i32* %5
%15 = load i32, i32* @AF_INET
%16 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 2
store i32 %15, i32* %16
%17 = call i32 @inet_addr(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%18 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 1
%19 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %18, i32 0, i32 0
store i32 %17, i32* %19
%20 = call i32 @htons(i32 1100)
%21 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
store i32 %20, i32* %21
%22 = load i32, i32* %5
%23 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%24 = load i64, i64* %7
%25 = call i32 @connect(i32 %22, %struct.sockaddr* %23, i64 %24)
store i32 %25, i32* %6
%26 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%27 = call i32 @bzero(i8* %26, i32 1024)
%28 = load i32, i32* %5
%29 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%30 = load i64, i64* %8
%31 = call i32 @send(i32 %28, i8* %29, i64 %30, i32 0)
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%33 = call i32 @bzero(i8* %32, i32 1024)
%34 = load i32, i32* %5
%35 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%36 = load i64, i64* %8
%37 = call i32 @recv(i32 %34, i8* %35, i64 %36, i32 0)
%38 = load i32, i32* %5
%39 = call i32 @close(i32 %38)
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [14 x i8] c"192.168.1.106\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = alloca %struct.sockaddr_in
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%8 = bitcast %struct.sockaddr_in* %5 to i8*
%9 = load i32, i32* @AF_INET
%10 = load i32, i32* @SOCK_STREAM
%11 = tail call i32 @socket(i32 %9, i32 %10, i32 0)
%12 = load i32, i32* @AF_INET
%13 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 2
store i32 %12, i32* %13
%14 = tail call i32 @inet_addr(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%15 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 1, i32 0
store i32 %14, i32* %15
%16 = tail call i32 @htons(i32 1100)
%17 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 0
store i32 %16, i32* %17
%18 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%19 = call i32 @connect(i32 %11, %struct.sockaddr* %18, i64 undef)
%20 = call i32 @bzero(i8* %6, i32 1024)
%21 = call i32 @send(i32 %11, i8* %6, i64 undef, i32 0)
%22 = call i32 @bzero(i8* %7, i32 1024)
%23 = call i32 @recv(i32 %11, i8* %7, i64 undef, i32 0)
%24 = call i32 @close(i32 %11)
ret i32 0
}