#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 */
int /*<<< orphan*/ exit(int);
char *malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ printf(char *, int, char *);
int read(int, char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
char *reception(int sock) {
  char *buffer = malloc(200 * sizeof(char));
  char *cleaned_sentence = malloc(200 * sizeof(char));
  strcpy(cleaned_sentence, "");
  int longueur;
  if ((longueur = read(sock, buffer, 200)) <= 0) {
    exit(1);
    return "";
  }
  int i;
  for (i = 0; i < longueur; i++) {
    if (buffer[i] == '\n') {
      buffer[i] = '\0';
    }
  }
  memcpy(cleaned_sentence, buffer, longueur);
  cleaned_sentence[longueur + 1] = '\0';
  printf("Reception d'un message de taille %d : %s\n", longueur,
         cleaned_sentence);
  return cleaned_sentence;
}


x86 assembly (clang, -O0):
<reception>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    $0xc8,%edi
call   1070 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0xc8,%edi
call   1070 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe97(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0xc8,%edx
call   1050 <read@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
jg     11be <reception+0x5e>
mov    $0x1,%edi
call   1080 <exit@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1205 <reception+0xa5>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    11f2 <reception+0x92>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    11f7 <reception+0x97>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11c5 <reception+0x65>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1060 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rdx
lea    0xdcc(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reception>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
mov    $0xc8,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    $0xc8,%edi
call   1070 <malloc@plt>
mov    %rax,%r14
lea    0xec2(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0xc8,%edx
call   1050 <read@plt>
test   %eax,%eax
jle    13b5 <reception+0x255>
mov    %eax,%ebp
mov    %eax,%eax
cmp    $0x10,%ebp
jae    11b6 <reception+0x56>
xor    %ecx,%ecx
jmp    13a9 <reception+0x249>
mov    %eax,%ecx
and    $0xfffffff0,%ecx
xor    %edx,%edx
movdqa 0xe3b(%rip),%xmm0
movdqa 0xe43(%rip),%xmm1
jmp    11dd <reception+0x7d>
nop
add    $0x10,%rdx
cmp    %rdx,%rcx
je     1366 <reception+0x206>
movq   (%rbx,%rdx,1),%xmm3
movdqa %xmm3,%xmm2
pcmpeqb %xmm0,%xmm2
movd   %xmm2,%esi
test   $0x1,%sil
je     11f8 <reception+0x98>
movb   $0x0,(%rbx,%rdx,1)
movdqa %xmm2,%xmm4
pslld  $0x8,%xmm4
movd   %xmm4,%esi
shr    $0x10,%esi
test   $0x1,%sil
je     1213 <reception+0xb3>
movb   $0x0,0x1(%rbx,%rdx,1)
pshuflw $0x55,%xmm3,%xmm4
pcmpeqb %xmm0,%xmm4
pextrw $0x2,%xmm4,%esi
test   $0x1,%sil
je     122c <reception+0xcc>
movb   $0x0,0x2(%rbx,%rdx,1)
movdqa %xmm2,%xmm4
psllq  $0x18,%xmm4
pextrw $0x3,%xmm4,%esi
test   $0x1,%sil
je     1245 <reception+0xe5>
movb   $0x0,0x3(%rbx,%rdx,1)
pshufd $0x55,%xmm3,%xmm3
pcmpeqb %xmm1,%xmm3
pextrw $0x4,%xmm3,%esi
test   $0x1,%sil
je     125e <reception+0xfe>
movb   $0x0,0x4(%rbx,%rdx,1)
movdqa %xmm2,%xmm3
pslldq $0x5,%xmm3
pextrw $0x5,%xmm3,%esi
test   $0x1,%sil
je     1277 <reception+0x117>
movb   $0x0,0x5(%rbx,%rdx,1)
pextrw $0x3,%xmm2,%esi
test   $0x1,%sil
je     1287 <reception+0x127>
movb   $0x0,0x6(%rbx,%rdx,1)
pslldq $0x7,%xmm2
pextrw $0x7,%xmm2,%esi
test   $0x1,%sil
je     129c <reception+0x13c>
movb   $0x0,0x7(%rbx,%rdx,1)
movq   0x8(%rbx,%rdx,1),%xmm3
movdqa %xmm3,%xmm2
pcmpeqb %xmm0,%xmm2
movd   %xmm2,%esi
test   $0x1,%sil
je     12b9 <reception+0x159>
movb   $0x0,0x8(%rbx,%rdx,1)
movdqa %xmm2,%xmm4
pslld  $0x8,%xmm4
movd   %xmm4,%esi
shr    $0x10,%esi
test   $0x1,%sil
je     12d4 <reception+0x174>
movb   $0x0,0x9(%rbx,%rdx,1)
pshuflw $0x55,%xmm3,%xmm4
pcmpeqb %xmm0,%xmm4
pextrw $0x2,%xmm4,%esi
test   $0x1,%sil
je     12ed <reception+0x18d>
movb   $0x0,0xa(%rbx,%rdx,1)
movdqa %xmm2,%xmm4
psllq  $0x18,%xmm4
pextrw $0x3,%xmm4,%esi
test   $0x1,%sil
je     1306 <reception+0x1a6>
movb   $0x0,0xb(%rbx,%rdx,1)
pshufd $0x55,%xmm3,%xmm3
pcmpeqb %xmm1,%xmm3
pextrw $0x4,%xmm3,%esi
test   $0x1,%sil
je     131f <reception+0x1bf>
movb   $0x0,0xc(%rbx,%rdx,1)
movdqa %xmm2,%xmm3
pslldq $0x5,%xmm3
pextrw $0x5,%xmm3,%esi
test   $0x1,%sil
je     1338 <reception+0x1d8>
movb   $0x0,0xd(%rbx,%rdx,1)
pextrw $0x3,%xmm2,%esi
test   $0x1,%sil
je     1348 <reception+0x1e8>
movb   $0x0,0xe(%rbx,%rdx,1)
pslldq $0x7,%xmm2
pextrw $0x7,%xmm2,%esi
test   $0x1,%sil
je     11d0 <reception+0x70>
movb   $0x0,0xf(%rbx,%rdx,1)
jmp    11d0 <reception+0x70>
cmp    %rax,%rcx
jne    13a9 <reception+0x249>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1060 <memcpy@plt>
movslq %ebp,%rax
movb   $0x0,0x1(%rax,%r14,1)
lea    0xc98(%rip),%rdi
mov    %ebp,%esi
mov    %r14,%rdx
call   1040 <printf@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret
nopw   0x0(%rax,%rax,1)
add    $0x1,%rcx
cmp    %rcx,%rax
je     136b <reception+0x20b>
cmpb   $0xa,(%rbx,%rcx,1)
jne    13a0 <reception+0x240>
movb   $0x0,(%rbx,%rcx,1)
jmp    13a0 <reception+0x240>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [42 x i8] c"Reception d'un message de taille %d : %s\0A\00"
define i8* @reception(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
%7 = call i8* @malloc(i32 200)
store i8* %7, i8** %3
%8 = call i8* @malloc(i32 200)
store i8* %8, i8** %4
%9 = load i8*, i8** %4
%10 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* %2
%12 = load i8*, i8** %3
%13 = call i32 @read(i32 %11, i8* %12, i32 200)
store i32 %13, i32* %5
%14 = icmp sle i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %1
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %1
store i32 0, i32* %6
br label %18
18: ; preds = %36, %17
%19 = load i32, i32* %6
%20 = load i32, i32* %5
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %39
22: ; preds = %18
%23 = load i8*, i8** %3
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 10
br i1 %29, label %30, label %35
30: ; preds = %22
%31 = load i8*, i8** %3
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
store i8 0, i8* %34
br label %35
35: ; preds = %30, %22
br label %36
36: ; preds = %35
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
br label %18
39: ; preds = %18
%40 = load i8*, i8** %4
%41 = load i8*, i8** %3
%42 = load i32, i32* %5
%43 = call i32 @memcpy(i8* %40, i8* %41, i32 %42)
%44 = load i8*, i8** %4
%45 = load i32, i32* %5
%46 = add nsw i32 %45, 1
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %44, i64 %47
store i8 0, i8* %48
%49 = load i32, i32* %5
%50 = load i8*, i8** %4
%51 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %49, i8* %50)
%52 = load i8*, i8** %4
ret i8* %52
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [42 x i8] c"Reception d'un message de taille %d : %s\0A\00"
define i8* @reception(i32 %0) {
%2 = tail call dereferenceable_or_null(200) i8* @malloc(i32 200)
%3 = tail call dereferenceable_or_null(200) i8* @malloc(i32 200)
%4 = tail call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @read(i32 %0, i8* %2, i32 200)
%6 = icmp slt i32 %5, 1
br i1 %6, label %107, label %7
7: ; preds = %1
%8 = zext i32 %5 to i64
%9 = icmp ult i32 %5, 16
br i1 %9, label %105, label %10
10: ; preds = %7
%11 = and i64 %8, 4294967280
br label %12
12: ; preds = %100, %10
%13 = phi i64 [ 0, %10 ], [ %101, %100 ]
%14 = or i64 %13, 8
%15 = getelementptr inbounds i8, i8* %2, i64 %13
%16 = bitcast i8* %15 to <8 x i8>*
%17 = load <8 x i8>, <8 x i8>* %16
%18 = getelementptr inbounds i8, i8* %15, i64 8
%19 = bitcast i8* %18 to <8 x i8>*
%20 = load <8 x i8>, <8 x i8>* %19
%21 = icmp eq <8 x i8> %17, <i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10>
%22 = icmp eq <8 x i8> %20, <i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10>
%23 = extractelement <8 x i1> %21, i64 0
br i1 %23, label %24, label %26
24: ; preds = %12
%25 = getelementptr inbounds i8, i8* %2, i64 %13
store i8 0, i8* %25
br label %26
26: ; preds = %24, %12
%27 = extractelement <8 x i1> %21, i64 1
br i1 %27, label %28, label %31
28: ; preds = %26
%29 = or i64 %13, 1
%30 = getelementptr inbounds i8, i8* %2, i64 %29
store i8 0, i8* %30
br label %31
31: ; preds = %28, %26
%32 = extractelement <8 x i1> %21, i64 2
br i1 %32, label %33, label %36
33: ; preds = %31
%34 = or i64 %13, 2
%35 = getelementptr inbounds i8, i8* %2, i64 %34
store i8 0, i8* %35
br label %36
36: ; preds = %33, %31
%37 = extractelement <8 x i1> %21, i64 3
br i1 %37, label %38, label %41
38: ; preds = %36
%39 = or i64 %13, 3
%40 = getelementptr inbounds i8, i8* %2, i64 %39
store i8 0, i8* %40
br label %41
41: ; preds = %38, %36
%42 = extractelement <8 x i1> %21, i64 4
br i1 %42, label %43, label %46
43: ; preds = %41
%44 = or i64 %13, 4
%45 = getelementptr inbounds i8, i8* %2, i64 %44
store i8 0, i8* %45
br label %46
46: ; preds = %43, %41
%47 = extractelement <8 x i1> %21, i64 5
br i1 %47, label %48, label %51
48: ; preds = %46
%49 = or i64 %13, 5
%50 = getelementptr inbounds i8, i8* %2, i64 %49
store i8 0, i8* %50
br label %51
51: ; preds = %48, %46
%52 = extractelement <8 x i1> %21, i64 6
br i1 %52, label %53, label %56
53: ; preds = %51
%54 = or i64 %13, 6
%55 = getelementptr inbounds i8, i8* %2, i64 %54
store i8 0, i8* %55
br label %56
56: ; preds = %53, %51
%57 = extractelement <8 x i1> %21, i64 7
br i1 %57, label %58, label %61
58: ; preds = %56
%59 = or i64 %13, 7
%60 = getelementptr inbounds i8, i8* %2, i64 %59
store i8 0, i8* %60
br label %61
61: ; preds = %58, %56
%62 = extractelement <8 x i1> %22, i64 0
br i1 %62, label %63, label %65
63: ; preds = %61
%64 = getelementptr inbounds i8, i8* %2, i64 %14
store i8 0, i8* %64
br label %65
65: ; preds = %63, %61
%66 = extractelement <8 x i1> %22, i64 1
br i1 %66, label %67, label %70
67: ; preds = %65
%68 = or i64 %13, 9
%69 = getelementptr inbounds i8, i8* %2, i64 %68
store i8 0, i8* %69
br label %70
70: ; preds = %67, %65
%71 = extractelement <8 x i1> %22, i64 2
br i1 %71, label %72, label %75
72: ; preds = %70
%73 = or i64 %13, 10
%74 = getelementptr inbounds i8, i8* %2, i64 %73
store i8 0, i8* %74
br label %75
75: ; preds = %72, %70
%76 = extractelement <8 x i1> %22, i64 3
br i1 %76, label %77, label %80
77: ; preds = %75
%78 = or i64 %13, 11
%79 = getelementptr inbounds i8, i8* %2, i64 %78
store i8 0, i8* %79
br label %80
80: ; preds = %77, %75
%81 = extractelement <8 x i1> %22, i64 4
br i1 %81, label %82, label %85
82: ; preds = %80
%83 = or i64 %13, 12
%84 = getelementptr inbounds i8, i8* %2, i64 %83
store i8 0, i8* %84
br label %85
85: ; preds = %82, %80
%86 = extractelement <8 x i1> %22, i64 5
br i1 %86, label %87, label %90
87: ; preds = %85
%88 = or i64 %13, 13
%89 = getelementptr inbounds i8, i8* %2, i64 %88
store i8 0, i8* %89
br label %90
90: ; preds = %87, %85
%91 = extractelement <8 x i1> %22, i64 6
br i1 %91, label %92, label %95
92: ; preds = %90
%93 = or i64 %13, 14
%94 = getelementptr inbounds i8, i8* %2, i64 %93
store i8 0, i8* %94
br label %95
95: ; preds = %92, %90
%96 = extractelement <8 x i1> %22, i64 7
br i1 %96, label %97, label %100
97: ; preds = %95
%98 = or i64 %13, 15
%99 = getelementptr inbounds i8, i8* %2, i64 %98
store i8 0, i8* %99
br label %100
100: ; preds = %97, %95
%101 = add nuw i64 %13, 16
%102 = icmp eq i64 %101, %11
br i1 %102, label %103, label %12
103: ; preds = %100
%104 = icmp eq i64 %11, %8
br i1 %104, label %118, label %105
105: ; preds = %7, %103
%106 = phi i64 [ 0, %7 ], [ %11, %103 ]
br label %109
107: ; preds = %1
%108 = tail call i32 @exit(i32 1)
unreachable
109: ; preds = %105, %115
%110 = phi i64 [ %116, %115 ], [ %106, %105 ]
%111 = getelementptr inbounds i8, i8* %2, i64 %110
%112 = load i8, i8* %111
%113 = icmp eq i8 %112, 10
br i1 %113, label %114, label %115
114: ; preds = %109
store i8 0, i8* %111
br label %115
115: ; preds = %109, %114
%116 = add nuw nsw i64 %110, 1
%117 = icmp eq i64 %116, %8
br i1 %117, label %118, label %109
118: ; preds = %115, %103
%119 = tail call i32 @memcpy(i8* %3, i8* %2, i32 %5)
%120 = add nsw i32 %5, 1
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds i8, i8* %3, i64 %121
store i8 0, i8* %122
%123 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %5, i8* %3)
ret i8* %3
}