#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 {
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ serveradr;
typedef int /*<<< orphan*/ clientadr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
char *inet_ntoa(TYPE_1__);
int listen(int, int);
int /*<<< orphan*/ print_run_time(char *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ read(int, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ write(int, char *, int);
int main(int argc, char *argv[]) {
  int res = 0;
  char *filedir;
  struct sockaddr_in serveradr;
  struct sockaddr_in clientadr;
  int socketfd = 0, clientsfd = 0;
  int server_len = 0, client_len = 0;
  char ch;
  if (1 != argc) {
    do {
      print_run_time("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                     "outputs/2022-01-22/02-19-57/repos/zuokong2006/am3359/"
                     "refs/heads/master/app/socket/server.c",
                     34);
      printf("E:input param error.\r\n");
    } while (0);
    exit(0);
  }
  socketfd = socket(AF_INET, SOCK_STREAM, 0);
  if (-1 == socketfd) {
    do {
      print_run_time("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                     "outputs/2022-01-22/02-19-57/repos/zuokong2006/am3359/"
                     "refs/heads/master/app/socket/server.c",
                     42);
      printf("E:failed to create socket!\r\n");
    } while (0);
    exit(0);
  } else {
    do {
      print_run_time("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                     "outputs/2022-01-22/02-19-57/repos/zuokong2006/am3359/"
                     "refs/heads/master/app/socket/server.c",
                     47);
      printf("D:create Socket Despcritor sucessfully.\r\n");
    } while (0);
  }
  serveradr.sin_family = AF_INET;
  serveradr.sin_port = htons(5000);
  serveradr.sin_addr.s_addr = htonl(INADDR_ANY);
  server_len = sizeof(serveradr);
  if (-1 == bind(socketfd, (struct sockaddr *)&serveradr, server_len)) {
    do {
      print_run_time("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                     "outputs/2022-01-22/02-19-57/repos/zuokong2006/am3359/"
                     "refs/heads/master/app/socket/server.c",
                     58);
      printf("E:failed to bind Port 5000.\r\n");
    } while (0);
    exit(0);
  } else {
    do {
      print_run_time("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                     "outputs/2022-01-22/02-19-57/repos/zuokong2006/am3359/"
                     "refs/heads/master/app/socket/server.c",
                     63);
      printf("D:bind the Port 5000 sucessfully.\r\n");
    } while (0);
  }
  if (-1 == listen(socketfd, 10)) {
    do {
      print_run_time("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                     "outputs/2022-01-22/02-19-57/repos/zuokong2006/am3359/"
                     "refs/heads/master/app/socket/server.c",
                     69);
      printf("E:failed to listen Port 5000.\n\r\n");
    } while (0);
    exit(0);
  } else {
    do {
      print_run_time("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                     "outputs/2022-01-22/02-19-57/repos/zuokong2006/am3359/"
                     "refs/heads/master/app/socket/server.c",
                     74);
      printf("D:listening the Port 5000 sucessfully.\r\n");
    } while (0);
  }
  while (1) {
    client_len = sizeof(clientadr);
    clientsfd = accept(socketfd, (struct sockaddr *)&clientadr, &client_len);
    if (-1 == clientsfd) {
      do {
        print_run_time(
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/zuokong2006/am3359/refs/heads/master/"
            "app/socket/server.c",
            84);
        printf("E:Obtain new Socket Despcritor error.\r\n");
      } while (0);
      continue;
    } else {
      do {
        print_run_time(
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/zuokong2006/am3359/refs/heads/master/"
            "app/socket/server.c",
            89);
        printf("D:Server has got connect from %s.\r\n",
               inet_ntoa(clientadr.sin_addr));
      } while (0);
    }
    read(clientsfd, &ch, 1);
    ch++;
    write(clientsfd, &ch, 1);
    close(clientsfd);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
mov    $0x1,%eax
cmp    -0x8(%rbp),%eax
je     1242 <main+0x72>
jmp    121c <main+0x4c>
lea    0xddd(%rip),%rdi
mov    $0x22,%esi
call   10a0 <print_run_time@plt>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
mov    0x2d9f(%rip),%rax
mov    (%rax),%edi
mov    0x2d7e(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10f0 <socket@plt>
mov    %eax,-0x44(%rbp)
mov    $0xffffffff,%eax
cmp    -0x44(%rbp),%eax
jne    1297 <main+0xc7>
jmp    1271 <main+0xa1>
lea    0xd88(%rip),%rdi
mov    $0x2a,%esi
call   10a0 <print_run_time@plt>
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
jmp    129c <main+0xcc>
lea    0xd5d(%rip),%rdi
mov    $0x2f,%esi
call   10a0 <print_run_time@plt>
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    12c0 <main+0xf0>
mov    0x2d21(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    $0x1388,%edi
call   1050 <htons@plt>
mov    %eax,-0x2c(%rbp)
mov    0x2d00(%rip),%rax
mov    (%rax),%edi
call   1070 <htonl@plt>
mov    %eax,-0x30(%rbp)
movl   $0xc,-0x4c(%rbp)
mov    -0x44(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    -0x4c(%rbp),%edx
call   10c0 <bind@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    133a <main+0x16a>
jmp    1314 <main+0x144>
lea    0xce5(%rip),%rdi
mov    $0x3a,%esi
call   10a0 <print_run_time@plt>
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
jmp    133f <main+0x16f>
lea    0xcba(%rip),%rdi
mov    $0x3f,%esi
call   10a0 <print_run_time@plt>
lea    0xdb8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1363 <main+0x193>
mov    -0x44(%rbp),%edi
mov    $0xa,%esi
call   10b0 <listen@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    13aa <main+0x1da>
jmp    1384 <main+0x1b4>
lea    0xc75(%rip),%rdi
mov    $0x45,%esi
call   10a0 <print_run_time@plt>
lea    0xd97(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
jmp    13af <main+0x1df>
lea    0xc4a(%rip),%rdi
mov    $0x4a,%esi
call   10a0 <print_run_time@plt>
lea    0xd8d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    13d3 <main+0x203>
jmp    13d8 <main+0x208>
movl   $0xc,-0x50(%rbp)
mov    -0x44(%rbp),%edi
lea    -0x40(%rbp),%rsi
lea    -0x50(%rbp),%rdx
call   10d0 <accept@plt>
mov    %eax,-0x48(%rbp)
mov    $0xffffffff,%eax
cmp    -0x48(%rbp),%eax
jne    1429 <main+0x259>
jmp    1405 <main+0x235>
lea    0xbf4(%rip),%rdi
mov    $0x54,%esi
call   10a0 <print_run_time@plt>
lea    0xd60(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    13d8 <main+0x208>
jmp    142e <main+0x25e>
lea    0xbcb(%rip),%rdi
mov    $0x59,%esi
call   10a0 <print_run_time@plt>
mov    -0x40(%rbp),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xd54(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    145d <main+0x28d>
mov    -0x48(%rbp),%edi
lea    -0x51(%rbp),%rsi
mov    $0x1,%edx
call   1090 <read@plt>
mov    -0x51(%rbp),%al
add    $0x1,%al
mov    %al,-0x51(%rbp)
mov    -0x48(%rbp),%edi
lea    -0x51(%rbp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    -0x48(%rbp),%edi
call   1080 <close@plt>
jmp    13d8 <main+0x208>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
cmp    $0x1,%edi
jne    1368 <main+0x188>
mov    0x2dea(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2dc8(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
cmp    $0xffffffff,%eax
je     1382 <main+0x1a2>
mov    %eax,%ebx
lea    0xddd(%rip),%rdi
mov    $0x2f,%esi
call   10b0 <print_run_time@plt>
lea    0xe83(%rip),%rdi
call   1030 <puts@plt>
mov    0x0(%rbp),%eax
mov    %eax,0x10(%rsp)
mov    $0x1388,%edi
call   1060 <htons@plt>
mov    %eax,0xc(%rsp)
mov    0x2d8b(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,0x8(%rsp)
lea    0x8(%rsp),%rsi
mov    %ebx,%edi
mov    $0xc,%edx
call   10d0 <bind@plt>
lea    0xd88(%rip),%rdi
cmp    $0xffffffff,%eax
je     139c <main+0x1bc>
mov    $0x3f,%esi
call   10b0 <print_run_time@plt>
lea    0xe4e(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
mov    $0xa,%esi
call   10c0 <listen@plt>
cmp    $0xffffffff,%eax
je     13af <main+0x1cf>
lea    0xd4d(%rip),%r14
mov    %r14,%rdi
mov    $0x4a,%esi
call   10b0 <print_run_time@plt>
lea    0xe3c(%rip),%rdi
call   1030 <puts@plt>
lea    0x18(%rsp),%r15
lea    0x4(%rsp),%r12
lea    0x3(%rsp),%r13
jmp    1333 <main+0x153>
nopl   (%rax)
mov    %eax,%ebp
mov    %r14,%rdi
mov    $0x59,%esi
call   10b0 <print_run_time@plt>
mov    0x18(%rsp),%edi
call   1050 <inet_ntoa@plt>
lea    0xd94(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %ebp,%edi
mov    %r13,%rsi
mov    $0x1,%edx
call   10a0 <read@plt>
addb   $0x1,0x3(%rsp)
mov    %ebp,%edi
mov    %r13,%rsi
mov    $0x1,%edx
call   1040 <write@plt>
mov    %ebp,%edi
call   1090 <close@plt>
movl   $0xc,0x4(%rsp)
mov    %ebx,%edi
mov    %r15,%rsi
mov    %r12,%rdx
call   10e0 <accept@plt>
cmp    $0xffffffff,%eax
jne    12e0 <main+0x100>
mov    %r14,%rdi
mov    $0x54,%esi
call   10b0 <print_run_time@plt>
lea    0xdca(%rip),%rdi
call   1030 <puts@plt>
jmp    1333 <main+0x153>
lea    0xc91(%rip),%rdi
mov    $0x22,%esi
call   10b0 <print_run_time@plt>
lea    0xe2b(%rip),%rdi
jmp    13c7 <main+0x1e7>
lea    0xc77(%rip),%rdi
mov    $0x2a,%esi
call   10b0 <print_run_time@plt>
lea    0xdf5(%rip),%rdi
jmp    13c7 <main+0x1e7>
mov    $0x3a,%esi
call   10b0 <print_run_time@plt>
lea    0xdc5(%rip),%rdi
jmp    13c7 <main+0x1e7>
lea    0xc4a(%rip),%rdi
mov    $0x45,%esi
call   10b0 <print_run_time@plt>
lea    0xd8b(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [147 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/zuokong2006/am3359/refs/heads/master/app/socket/server.c\00"
@.str.1 = [23 x i8] c"E:input param error.\0D\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [29 x i8] c"E:failed to create socket!\0D\0A\00"
@.str.3 = [42 x i8] c"D:create Socket Despcritor sucessfully.\0D\0A\00"
@INADDR_ANY = global i32 0
@.str.4 = [30 x i8] c"E:failed to bind Port 5000.\0D\0A\00"
@.str.5 = [36 x i8] c"D:bind the Port 5000 sucessfully.\0D\0A\00"
@.str.6 = [33 x i8] c"E:failed to listen Port 5000.\0A\0D\0A\00"
@.str.7 = [41 x i8] c"D:listening the Port 5000 sucessfully.\0D\0A\00"
@.str.8 = [40 x i8] c"E:Obtain new Socket Despcritor error.\0D\0A\00"
@.str.9 = [36 x i8] c"D:Server has got connect from %s.\0D\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 %struct.sockaddr_in
%9 = alloca %struct.sockaddr_in
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
store i32 0, i32* %13
%15 = load i32, i32* %4
%16 = icmp ne i32 1, %15
br i1 %16, label %17, label %23
17: ; preds = %2
br label %18
18: ; preds = %17
%19 = call i32 @print_run_time(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 34)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %21
21: ; preds = %18
%22 = call i32 @exit(i32 0)
unreachable
23: ; preds = %2
%24 = load i32, i32* @AF_INET
%25 = load i32, i32* @SOCK_STREAM
%26 = call i32 @socket(i32 %24, i32 %25, i32 0)
store i32 %26, i32* %10
%27 = load i32, i32* %10
%28 = icmp eq i32 -1, %27
br i1 %28, label %29, label %35
29: ; preds = %23
br label %30
30: ; preds = %29
%31 = call i32 @print_run_time(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 42)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %33
33: ; preds = %30
%34 = call i32 @exit(i32 0)
unreachable
35: ; preds = %23
br label %36
36: ; preds = %35
%37 = call i32 @print_run_time(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 47)
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
br label %39
39: ; preds = %36
br label %40
40: ; preds = %39
%41 = load i32, i32* @AF_INET
%42 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 2
store i32 %41, i32* %42
%43 = call i32 @htons(i32 5000)
%44 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 1
store i32 %43, i32* %44
%45 = load i32, i32* @INADDR_ANY
%46 = call i32 @htonl(i32 %45)
%47 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 0
%48 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %47, i32 0, i32 0
store i32 %46, i32* %48
store i32 12, i32* %12
%49 = load i32, i32* %10
%50 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%51 = load i32, i32* %12
%52 = call i32 @bind(i32 %49, %struct.sockaddr* %50, i32 %51)
%53 = icmp eq i32 -1, %52
br i1 %53, label %54, label %60
54: ; preds = %40
br label %55
55: ; preds = %54
%56 = call i32 @print_run_time(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 58)
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
br label %58
58: ; preds = %55
%59 = call i32 @exit(i32 0)
unreachable
60: ; preds = %40
br label %61
61: ; preds = %60
%62 = call i32 @print_run_time(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 63)
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
br label %64
64: ; preds = %61
br label %65
65: ; preds = %64
%66 = load i32, i32* %10
%67 = call i32 @listen(i32 %66, i32 10)
%68 = icmp eq i32 -1, %67
br i1 %68, label %69, label %75
69: ; preds = %65
br label %70
70: ; preds = %69
%71 = call i32 @print_run_time(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 69)
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0))
br label %73
73: ; preds = %70
%74 = call i32 @exit(i32 0)
unreachable
75: ; preds = %65
br label %76
76: ; preds = %75
%77 = call i32 @print_run_time(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 74)
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
br label %79
79: ; preds = %76
br label %80
80: ; preds = %79
br label %81
81: ; preds = %80, %91, %101
store i32 12, i32* %13
%82 = load i32, i32* %10
%83 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%84 = call i32 @accept(i32 %82, %struct.sockaddr* %83, i32* %13)
store i32 %84, i32* %11
%85 = load i32, i32* %11
%86 = icmp eq i32 -1, %85
br i1 %86, label %87, label %92
87: ; preds = %81
br label %88
88: ; preds = %87
%89 = call i32 @print_run_time(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 84)
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0))
br label %91
91: ; preds = %88
br label %81
92: ; preds = %81
br label %93
93: ; preds = %92
%94 = call i32 @print_run_time(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 89)
%95 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 0
%96 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %95, i32 0, i32 0
%97 = load i32, i32* %96
%98 = call i8* @inet_ntoa(i32 %97)
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0), i8* %98)
br label %100
100: ; preds = %93
br label %101
101: ; preds = %100
%102 = load i32, i32* %11
%103 = call i32 @read(i32 %102, i8* %14, i32 1)
%104 = load i8, i8* %14
%105 = add i8 %104, 1
store i8 %105, i8* %14
%106 = load i32, i32* %11
%107 = call i32 @write(i32 %106, i8* %14, i32 1)
%108 = load i32, i32* %11
%109 = call i32 @close(i32 %108)
br label %81
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [147 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/zuokong2006/am3359/refs/heads/master/app/socket/server.c\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@INADDR_ANY = global i32 0
@.str.9 = [36 x i8] c"D:Server has got connect from %s.\0D\0A\00"
@str = [41 x i8] c"D:create Socket Despcritor sucessfully.\0D\00"
@str.10 = [35 x i8] c"D:bind the Port 5000 sucessfully.\0D\00"
@str.11 = [40 x i8] c"D:listening the Port 5000 sucessfully.\0D\00"
@str.12 = [39 x i8] c"E:Obtain new Socket Despcritor error.\0D\00"
@str.13 = [32 x i8] c"E:failed to listen Port 5000.\0A\0D\00"
@str.14 = [29 x i8] c"E:failed to bind Port 5000.\0D\00"
@str.15 = [28 x i8] c"E:failed to create socket!\0D\00"
@str.16 = [22 x i8] c"E:input param error.\0D\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
%6 = alloca i8
%7 = bitcast %struct.sockaddr_in* %3 to i8*
%8 = bitcast %struct.sockaddr_in* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = icmp eq i32 %0, 1
br i1 %10, label %15, label %11
11: ; preds = %2
%12 = tail call i32 @print_run_time(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 34)
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.16, i64 0, i64 0))
%14 = tail call i32 @exit(i32 0)
unreachable
15: ; preds = %2
%16 = load i32, i32* @AF_INET
%17 = load i32, i32* @SOCK_STREAM
%18 = tail call i32 @socket(i32 %16, i32 %17, i32 0)
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %24
20: ; preds = %15
%21 = tail call i32 @print_run_time(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 42)
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.15, i64 0, i64 0))
%23 = tail call i32 @exit(i32 0)
unreachable
24: ; preds = %15
%25 = tail call i32 @print_run_time(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 47)
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%27 = load i32, i32* @AF_INET
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %27, i32* %28
%29 = tail call i32 @htons(i32 5000)
%30 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %29, i32* %30
%31 = load i32, i32* @INADDR_ANY
%32 = tail call i32 @htonl(i32 %31)
%33 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0, i32 0
store i32 %32, i32* %33
%34 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%35 = call i32 @bind(i32 %18, %struct.sockaddr* %34, i32 12)
%36 = icmp eq i32 %35, -1
br i1 %36, label %37, label %41
37: ; preds = %24
%38 = call i32 @print_run_time(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 58)
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.14, i64 0, i64 0))
%40 = call i32 @exit(i32 0)
unreachable
41: ; preds = %24
%42 = call i32 @print_run_time(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 63)
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.10, i64 0, i64 0))
%44 = call i32 @listen(i32 %18, i32 10)
%45 = icmp eq i32 %44, -1
br i1 %45, label %46, label %50
46: ; preds = %41
%47 = call i32 @print_run_time(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 69)
%48 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.13, i64 0, i64 0))
%49 = call i32 @exit(i32 0)
unreachable
50: ; preds = %41
%51 = call i32 @print_run_time(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 74)
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.11, i64 0, i64 0))
%53 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%54 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0, i32 0
br label %55
55: ; preds = %61, %50
store i32 12, i32* %5
%56 = call i32 @accept(i32 %18, %struct.sockaddr* %53, i32* %5)
%57 = icmp eq i32 %56, -1
br i1 %57, label %58, label %62
58: ; preds = %55
%59 = call i32 @print_run_time(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 84)
%60 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.12, i64 0, i64 0))
br label %61
61: ; preds = %58, %62
br label %55
62: ; preds = %55
%63 = call i32 @print_run_time(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 89)
%64 = load i32, i32* %54
%65 = call i8* @inet_ntoa(i32 %64)
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0), i8* %65)
%67 = call i32 @read(i32 %56, i8* %6, i32 1)
%68 = load i8, i8* %6
%69 = add i8 %68, 1
store i8 %69, i8* %6
%70 = call i32 @write(i32 %56, i8* %6, i32 1)
%71 = call i32 @close(i32 %56)
br label %61
}