#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;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ server_address;
typedef int /*<<< orphan*/ client_address;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
int atoi(char *);
int /*<<< orphan*/ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ listen(int, int);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int /*<<< orphan*/ send(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  while (1) {
    int portno;
    int n;
    socklen_t clientAddressSize;
    int sockfd, newsockfd;
    struct sockaddr_in server_address, client_address;
    char buffer[256];
    char bufferRep[32];
    if (argc < 2) {
      printf("ERROR, no port provided\n");
      exit(1);
    }
    sockfd = socket(AF_INET, SOCK_STREAM, 0);
    if (sockfd < 0) {
      printf("ERROR opening socket\n");
    }
    bzero((char *)&server_address, sizeof(server_address));
    portno = atoi(argv[1]);
    server_address.sin_family = AF_INET;
    server_address.sin_addr.s_addr = INADDR_ANY;
    server_address.sin_port = htons(portno);
    bind(sockfd, (struct sockaddr *)&server_address, sizeof(server_address));
    listen(sockfd, 5);
    clientAddressSize = sizeof(client_address);
    newsockfd =
        accept(sockfd, (struct sockaddr *)&client_address, &clientAddressSize);
    bzero(buffer, 256);
    n = read(newsockfd, buffer, 255);
    int nombreA = buffer[0] | ((int)buffer[1] << 8) | ((int)buffer[2] << 16) |
                  ((int)buffer[3] << 24);
    int nombreB = buffer[4] | ((int)buffer[5] << 8) | ((int)buffer[6] << 16) |
                  ((int)buffer[7] << 24);
    char op = buffer[8];
    int res;
    printf("%d\n", nombreA);
    printf("%d\n", nombreB);
    printf("%c\n", op);
    if (op == '+') {
      res = nombreA + nombreB;
    } else if (op == '-') {
      res = nombreA - nombreB;
    } else if (op == '/') {
      res = nombreA / nombreB;
    } else {
      printf("%s", "erreur\n");
    }
    bufferRep[0] = res & 0xff;
    bufferRep[1] = (res >> 8) & 0xff;
    bufferRep[2] = (res >> 16) & 0xff;
    bufferRep[3] = (res >> 24) & 0xff;
    int retourTest = bufferRep[0] | ((int)bufferRep[1] << 8) |
                     ((int)bufferRep[2] << 16) | ((int)bufferRep[3] << 24);
    printf("%d\n", retourTest);
    send(newsockfd, (char *)bufferRep, 4, 0);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x180,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11eb <main+0x3b>
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    0x2df6(%rip),%rax
mov    (%rax),%edi
mov    0x2dd5(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10d0 <socket@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    121f <main+0x6f>
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0xc,%esi
call   1090 <bzero@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    0x2da4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    0x2d90(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <htons@plt>
mov    %eax,-0x30(%rbp)
mov    -0x20(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0xc,%edx
call   1080 <bind@plt>
mov    -0x20(%rbp),%edi
mov    $0x5,%esi
call   1070 <listen@plt>
movl   $0xc,-0x1c(%rbp)
mov    -0x20(%rbp),%edi
lea    -0x40(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   10a0 <accept@plt>
mov    %eax,-0x24(%rbp)
lea    -0x140(%rbp),%rdi
mov    $0x100,%esi
call   1090 <bzero@plt>
mov    -0x24(%rbp),%edi
lea    -0x140(%rbp),%rsi
mov    $0xff,%edx
call   1060 <read@plt>
mov    %eax,-0x18(%rbp)
movsbl -0x140(%rbp),%eax
movsbl -0x13f(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movsbl -0x13e(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
movsbl -0x13d(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x164(%rbp)
movsbl -0x13c(%rbp),%eax
movsbl -0x13b(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movsbl -0x13a(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
movsbl -0x139(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x168(%rbp)
mov    -0x138(%rbp),%al
mov    %al,-0x169(%rbp)
mov    -0x164(%rbp),%esi
lea    0xcf4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x168(%rbp),%esi
lea    0xce0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsbl -0x169(%rbp),%esi
lea    0xccf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsbl -0x169(%rbp),%eax
cmp    $0x2b,%eax
jne    1392 <main+0x1e2>
mov    -0x164(%rbp),%eax
add    -0x168(%rbp),%eax
mov    %eax,-0x170(%rbp)
jmp    1400 <main+0x250>
movsbl -0x169(%rbp),%eax
cmp    $0x2d,%eax
jne    13b9 <main+0x209>
mov    -0x164(%rbp),%eax
sub    -0x168(%rbp),%eax
mov    %eax,-0x170(%rbp)
jmp    13fb <main+0x24b>
movsbl -0x169(%rbp),%eax
cmp    $0x2f,%eax
jne    13e1 <main+0x231>
mov    -0x164(%rbp),%eax
cltd
idivl  -0x168(%rbp)
mov    %eax,-0x170(%rbp)
jmp    13f6 <main+0x246>
lea    0xc4f(%rip),%rdi
lea    0xc4b(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    13fb <main+0x24b>
jmp    1400 <main+0x250>
mov    -0x170(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x160(%rbp)
mov    -0x170(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,-0x15f(%rbp)
mov    -0x170(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
mov    %al,-0x15e(%rbp)
mov    -0x170(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
mov    %al,-0x15d(%rbp)
movsbl -0x160(%rbp),%eax
movsbl -0x15f(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movsbl -0x15e(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
movsbl -0x15d(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x174(%rbp)
mov    -0x174(%rbp),%esi
lea    0xba4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%edi
lea    -0x160(%rbp),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
jmp    11c9 <main+0x19>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x158,%rsp
mov    %rsi,0x18(%rsp)
cmp    $0x2,%edi
jl     13d1 <main+0x211>
mov    0x2e02(%rip),%rbx
jmp    124f <main+0x8f>
nopl   0x0(%rax,%rax,1)
sub    %r15d,%r12d
mov    %r12d,%r14d
mov    0x2deb(%rip),%rbx
mov    %r14d,%eax
shr    $0x8,%eax
mov    %r14d,%ecx
shr    $0x10,%ecx
mov    %r14d,0x30(%rsp)
movsbl %r14b,%edx
movsbl %al,%eax
shl    $0x8,%eax
movsbl %cl,%ecx
shl    $0x10,%ecx
mov    %r14d,%esi
and    $0xff000000,%esi
or     %edx,%esi
or     %eax,%esi
or     %ecx,%esi
lea    0xdcc(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r13d,%edi
lea    0x30(%rsp),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1050 <send@plt>
mov    (%rbx),%edi
mov    0x2d78(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
mov    %eax,%ebp
test   %eax,%eax
jns    1273 <main+0xb3>
lea    0xda1(%rip),%rdi
call   1030 <puts@plt>
lea    0x8(%rsp),%r15
mov    %r15,%rdi
mov    $0xc,%esi
call   10a0 <bzero@plt>
mov    0x18(%rsp),%rax
mov    0x8(%rax),%rdi
call   10c0 <atoi@plt>
mov    (%rbx),%ecx
mov    %ecx,0x10(%rsp)
mov    0x2d40(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,0xc(%rsp)
mov    %eax,%edi
call   1040 <htons@plt>
mov    %eax,0x8(%rsp)
mov    %ebp,%edi
mov    %r15,%rsi
mov    $0xc,%edx
call   1090 <bind@plt>
mov    %ebp,%edi
mov    $0x5,%esi
call   1080 <listen@plt>
movl   $0xc,0x4(%rsp)
mov    %ebp,%edi
lea    0x20(%rsp),%rsi
lea    0x4(%rsp),%rdx
call   10b0 <accept@plt>
mov    %eax,%r13d
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
call   10a0 <bzero@plt>
mov    %r13d,%edi
mov    %rbx,%rsi
mov    $0xff,%edx
call   1070 <read@plt>
movsbl 0x50(%rsp),%eax
movsbl 0x51(%rsp),%ecx
shl    $0x8,%ecx
or     %eax,%ecx
movsbl 0x52(%rsp),%eax
shl    $0x10,%eax
movzbl 0x53(%rsp),%r12d
shl    $0x18,%r12d
or     %eax,%r12d
or     %ecx,%r12d
movsbl 0x54(%rsp),%eax
movsbl 0x55(%rsp),%ecx
shl    $0x8,%ecx
or     %eax,%ecx
movsbl 0x56(%rsp),%eax
shl    $0x10,%eax
movzbl 0x57(%rsp),%r15d
shl    $0x18,%r15d
or     %eax,%r15d
or     %ecx,%r15d
movsbl 0x58(%rsp),%ebp
lea    0xc9c(%rip),%rbx
mov    %rbx,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xc7f(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    $0x2f,%ebp
je     13b0 <main+0x1f0>
cmp    $0x2d,%bpl
je     11f0 <main+0x30>
cmp    $0x2b,%bpl
jne    13c0 <main+0x200>
add    %r12d,%r15d
mov    %r15d,%r14d
jmp    11f6 <main+0x36>
xchg   %ax,%ax
mov    %r12d,%eax
cltd
idiv   %r15d
mov    %eax,%r14d
jmp    11f6 <main+0x36>
nop
lea    0xc41(%rip),%rdi
call   1030 <puts@plt>
jmp    11f6 <main+0x36>
lea    0xc4c(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [25 x i8] c"ERROR, no port provided\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [22 x i8] c"ERROR opening socket\0A\00"
@INADDR_ANY = global i32 0
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [4 x i8] c"%c\0A\00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [8 x i8] c"erreur\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca %struct.sockaddr_in
%12 = alloca %struct.sockaddr_in
%13 = alloca [256 x i8]
%14 = alloca [32 x i8]
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8
%18 = alloca i32
%19 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %20
20: ; preds = %2, %134
%21 = load i32, i32* %4
%22 = icmp slt i32 %21, 2
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %20
%27 = load i32, i32* @AF_INET
%28 = load i32, i32* @SOCK_STREAM
%29 = call i32 @socket(i32 %27, i32 %28, i32 0)
store i32 %29, i32* %9
%30 = load i32, i32* %9
%31 = icmp slt i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %26
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %34
34: ; preds = %32, %26
%35 = bitcast %struct.sockaddr_in* %11 to i8*
%36 = call i32 @bzero(i8* %35, i32 12)
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 1
%39 = load i8*, i8** %38
%40 = call i32 @atoi(i8* %39)
store i32 %40, i32* %6
%41 = load i32, i32* @AF_INET
%42 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 2
store i32 %41, i32* %42
%43 = load i32, i32* @INADDR_ANY
%44 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 1
%45 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %44, i32 0, i32 0
store i32 %43, i32* %45
%46 = load i32, i32* %6
%47 = call i32 @htons(i32 %46)
%48 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
store i32 %47, i32* %48
%49 = load i32, i32* %9
%50 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%51 = call i32 @bind(i32 %49, %struct.sockaddr* %50, i32 12)
%52 = load i32, i32* %9
%53 = call i32 @listen(i32 %52, i32 5)
store i32 12, i32* %8
%54 = load i32, i32* %9
%55 = bitcast %struct.sockaddr_in* %12 to %struct.sockaddr*
%56 = call i32 @accept(i32 %54, %struct.sockaddr* %55, i32* %8)
store i32 %56, i32* %10
%57 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%58 = call i32 @bzero(i8* %57, i32 256)
%59 = load i32, i32* %10
%60 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%61 = call i32 @read(i32 %59, i8* %60, i32 255)
store i32 %61, i32* %7
%62 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 1
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
%68 = shl i32 %67, 8
%69 = or i32 %64, %68
%70 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 2
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = shl i32 %72, 16
%74 = or i32 %69, %73
%75 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 3
%76 = load i8, i8* %75
%77 = sext i8 %76 to i32
%78 = shl i32 %77, 24
%79 = or i32 %74, %78
store i32 %79, i32* %15
%80 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 4
%81 = load i8, i8* %80
%82 = sext i8 %81 to i32
%83 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 5
%84 = load i8, i8* %83
%85 = sext i8 %84 to i32
%86 = shl i32 %85, 8
%87 = or i32 %82, %86
%88 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 6
%89 = load i8, i8* %88
%90 = sext i8 %89 to i32
%91 = shl i32 %90, 16
%92 = or i32 %87, %91
%93 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 7
%94 = load i8, i8* %93
%95 = sext i8 %94 to i32
%96 = shl i32 %95, 24
%97 = or i32 %92, %96
store i32 %97, i32* %16
%98 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 8
%99 = load i8, i8* %98
store i8 %99, i8* %17
%100 = load i32, i32* %15
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %100)
%102 = load i32, i32* %16
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %102)
%104 = load i8, i8* %17
%105 = sext i8 %104 to i32
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %105)
%107 = load i8, i8* %17
%108 = sext i8 %107 to i32
%109 = icmp eq i32 %108, 43
br i1 %109, label %110, label %114
110: ; preds = %34
%111 = load i32, i32* %15
%112 = load i32, i32* %16
%113 = add nsw i32 %111, %112
store i32 %113, i32* %18
br label %134
114: ; preds = %34
%115 = load i8, i8* %17
%116 = sext i8 %115 to i32
%117 = icmp eq i32 %116, 45
br i1 %117, label %118, label %122
118: ; preds = %114
%119 = load i32, i32* %15
%120 = load i32, i32* %16
%121 = sub nsw i32 %119, %120
store i32 %121, i32* %18
br label %133
122: ; preds = %114
%123 = load i8, i8* %17
%124 = sext i8 %123 to i32
%125 = icmp eq i32 %124, 47
br i1 %125, label %126, label %130
126: ; preds = %122
%127 = load i32, i32* %15
%128 = load i32, i32* %16
%129 = sdiv i32 %127, %128
store i32 %129, i32* %18
br label %132
130: ; preds = %122
%131 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
br label %132
132: ; preds = %130, %126
br label %133
133: ; preds = %132, %118
br label %134
134: ; preds = %133, %110
%135 = load i32, i32* %18
%136 = and i32 %135, 255
%137 = trunc i32 %136 to i8
%138 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 0
store i8 %137, i8* %138
%139 = load i32, i32* %18
%140 = ashr i32 %139, 8
%141 = and i32 %140, 255
%142 = trunc i32 %141 to i8
%143 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 1
store i8 %142, i8* %143
%144 = load i32, i32* %18
%145 = ashr i32 %144, 16
%146 = and i32 %145, 255
%147 = trunc i32 %146 to i8
%148 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 2
store i8 %147, i8* %148
%149 = load i32, i32* %18
%150 = ashr i32 %149, 24
%151 = and i32 %150, 255
%152 = trunc i32 %151 to i8
%153 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 3
store i8 %152, i8* %153
%154 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 0
%155 = load i8, i8* %154
%156 = sext i8 %155 to i32
%157 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 1
%158 = load i8, i8* %157
%159 = sext i8 %158 to i32
%160 = shl i32 %159, 8
%161 = or i32 %156, %160
%162 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 2
%163 = load i8, i8* %162
%164 = sext i8 %163 to i32
%165 = shl i32 %164, 16
%166 = or i32 %161, %165
%167 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 3
%168 = load i8, i8* %167
%169 = sext i8 %168 to i32
%170 = shl i32 %169, 24
%171 = or i32 %166, %170
store i32 %171, i32* %19
%172 = load i32, i32* %19
%173 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %172)
%174 = load i32, i32* %10
%175 = getelementptr inbounds [32 x i8], [32 x i8]* %14, i64 0, i64 0
%176 = call i32 @send(i32 %174, i8* %175, i32 4, i32 0)
br label %20
}

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
@INADDR_ANY = global i32 0
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [4 x i8] c"%c\0A\00"
@str = [7 x i8] c"erreur\00"
@str.6 = [21 x i8] c"ERROR opening socket\00"
@str.7 = [24 x i8] c"ERROR, no port provided\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca %struct.sockaddr_in
%5 = alloca %struct.sockaddr_in
%6 = alloca [256 x i8]
%7 = alloca [32 x i8]
%8 = bitcast i32* %3 to i8*
%9 = bitcast %struct.sockaddr_in* %4 to i8*
%10 = bitcast %struct.sockaddr_in* %5 to i8*
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%13 = icmp slt i32 %0, 2
br i1 %13, label %32, label %14
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
%17 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1, i32 0
%18 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
%19 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%20 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 1
%22 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 2
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 3
%24 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 4
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 5
%26 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 6
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 7
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 8
%29 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 1
%30 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 2
%31 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 3
br label %35
32: ; preds = %2
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.7, i64 0, i64 0))
%34 = call i32 @exit(i32 1)
unreachable
35: ; preds = %96, %14
%36 = phi i32 [ undef, %14 ], [ %97, %96 ]
%37 = load i32, i32* @AF_INET
%38 = load i32, i32* @SOCK_STREAM
%39 = call i32 @socket(i32 %37, i32 %38, i32 0)
%40 = icmp slt i32 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %35
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.6, i64 0, i64 0))
br label %43
43: ; preds = %41, %35
%44 = call i32 @bzero(i8* %9, i32 12)
%45 = load i8*, i8** %15
%46 = call i32 @atoi(i8* %45)
%47 = load i32, i32* @AF_INET
store i32 %47, i32* %16
%48 = load i32, i32* @INADDR_ANY
store i32 %48, i32* %17
%49 = call i32 @htons(i32 %46)
store i32 %49, i32* %18
%50 = call i32 @bind(i32 %39, %struct.sockaddr* %19, i32 12)
%51 = call i32 @listen(i32 %39, i32 5)
store i32 12, i32* %3
%52 = call i32 @accept(i32 %39, %struct.sockaddr* %20, i32* %3)
%53 = call i32 @bzero(i8* %11, i32 256)
%54 = call i32 @read(i32 %52, i8* %11, i32 255)
%55 = load i8, i8* %11
%56 = sext i8 %55 to i32
%57 = load i8, i8* %21
%58 = sext i8 %57 to i32
%59 = shl nsw i32 %58, 8
%60 = or i32 %59, %56
%61 = load i8, i8* %22
%62 = sext i8 %61 to i32
%63 = shl nsw i32 %62, 16
%64 = or i32 %60, %63
%65 = load i8, i8* %23
%66 = zext i8 %65 to i32
%67 = shl nuw i32 %66, 24
%68 = or i32 %64, %67
%69 = load i8, i8* %24
%70 = sext i8 %69 to i32
%71 = load i8, i8* %25
%72 = sext i8 %71 to i32
%73 = shl nsw i32 %72, 8
%74 = or i32 %73, %70
%75 = load i8, i8* %26
%76 = sext i8 %75 to i32
%77 = shl nsw i32 %76, 16
%78 = or i32 %74, %77
%79 = load i8, i8* %27
%80 = zext i8 %79 to i32
%81 = shl nuw i32 %80, 24
%82 = or i32 %78, %81
%83 = load i8, i8* %28
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %68)
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %82)
%86 = sext i8 %83 to i32
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %86)
switch i8 %83, label %94 [
i8 43, label %88
i8 45, label %90
i8 47, label %92
]
88: ; preds = %43
%89 = add nsw i32 %82, %68
br label %96
90: ; preds = %43
%91 = sub nsw i32 %68, %82
br label %96
92: ; preds = %43
%93 = sdiv i32 %68, %82
br label %96
94: ; preds = %43
%95 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
br label %96
96: ; preds = %90, %94, %92, %88
%97 = phi i32 [ %89, %88 ], [ %91, %90 ], [ %93, %92 ], [ %36, %94 ]
%98 = trunc i32 %97 to i8
store i8 %98, i8* %12
%99 = lshr i32 %97, 8
%100 = trunc i32 %99 to i8
store i8 %100, i8* %29
%101 = lshr i32 %97, 16
%102 = trunc i32 %101 to i8
store i8 %102, i8* %30
%103 = lshr i32 %97, 24
%104 = trunc i32 %103 to i8
store i8 %104, i8* %31
%105 = shl i32 %97, 24
%106 = ashr exact i32 %105, 24
%107 = shl i32 %99, 24
%108 = ashr exact i32 %107, 16
%109 = shl i32 %101, 24
%110 = ashr exact i32 %109, 8
%111 = and i32 %97, -16777216
%112 = or i32 %106, %111
%113 = or i32 %112, %108
%114 = or i32 %113, %110
%115 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %114)
%116 = call i32 @send(i32 %52, i8* %12, i32 4, i32 0)
br label %35
}