#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*/ err_dump(char *);
int readprot(int, char *, int);
int /*<<< orphan*/ smsg(char *);
int strecho(int sockfd) {
  int n;
  char line[512];
  extern void reply_c(int, char *);
  line[1] = 0;
  while (line[1] != 117) {
    n = readprot(sockfd, line, 512);
    if (n == 0)
      return 1;
    else if (n < 0)
      err_dump("<server> : strecho - eroare in readprot");
    reply_c(sockfd, line);
  }
  smsg("Server: Conexion Closed !\n Acces disabled for one minnute ...");
  return 0;
}


x86 assembly (clang, -O0):
<strecho>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    %edi,-0x8(%rbp)
movb   $0x0,-0x20f(%rbp)
movsbl -0x20f(%rbp),%eax
cmp    $0x75,%eax
je     11c1 <strecho+0x81>
mov    -0x8(%rbp),%edi
lea    -0x210(%rbp),%rsi
mov    $0x200,%edx
call   1050 <readprot@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1192 <strecho+0x52>
movl   $0x1,-0x4(%rbp)
jmp    11d4 <strecho+0x94>
cmpl   $0x0,-0xc(%rbp)
jge    11a8 <strecho+0x68>
lea    0xe5d(%rip),%rdi
call   1040 <err_dump@plt>
jmp    11ad <strecho+0x6d>
mov    -0x8(%rbp),%edi
lea    -0x210(%rbp),%rsi
call   1030 <reply_c@plt>
jmp    1155 <strecho+0x15>
lea    0xe60(%rip),%rdi
call   1060 <smsg@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strecho>:
push   %r15
push   %r14
push   %rbx
sub    $0x200,%rsp
mov    %edi,%ebx
movb   $0x0,0x1(%rsp)
mov    %rsp,%r14
lea    0xea3(%rip),%r15
jmp    1171 <strecho+0x31>
nop
mov    %ebx,%edi
mov    %r14,%rsi
call   1030 <reply_c@plt>
cmpb   $0x75,0x1(%rsp)
je     1190 <strecho+0x50>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x200,%edx
call   1050 <readprot@plt>
test   %eax,%eax
je     11a0 <strecho+0x60>
jns    1160 <strecho+0x20>
mov    %r15,%rdi
call   1040 <err_dump@plt>
jmp    1160 <strecho+0x20>
lea    0xe91(%rip),%rdi
call   1060 <smsg@plt>
xor    %eax,%eax
jmp    11a5 <strecho+0x65>
mov    $0x1,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [40 x i8] c"<server> : strecho - eroare in readprot\00"
@.str.1 = [62 x i8] c"Server: Conexion Closed !\0A Acces disabled for one minnute ...\00"
define i32 @strecho(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [512 x i8]
store i32 %0, i32* %3
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 1
store i8 0, i8* %6
br label %7
7: ; preds = %25, %1
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 1
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 117
br i1 %11, label %12, label %28
12: ; preds = %7
%13 = load i32, i32* %3
%14 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%15 = call i32 @readprot(i32 %13, i8* %14, i32 512)
store i32 %15, i32* %4
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %12
store i32 1, i32* %2
br label %30
19: ; preds = %12
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i32 @err_dump(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %24
24: ; preds = %22, %19
br label %25
25: ; preds = %24
%26 = load i32, i32* %3
%27 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
br label %7
28: ; preds = %7
%29 = call i32 @smsg(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %2
br label %30
30: ; preds = %28, %18
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
@.str = [40 x i8] c"<server> : strecho - eroare in readprot\00"
@.str.1 = [62 x i8] c"Server: Conexion Closed !\0A Acces disabled for one minnute ...\00"
define i32 @strecho(i32 %0) {
%2 = alloca [512 x i8]
%3 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 1
store i8 0, i8* %4
br label %5
5: ; preds = %1, %12
%6 = call i32 @readprot(i32 %0, i8* %3, i32 512)
%7 = icmp eq i32 %6, 0
br i1 %7, label %17, label %8
8: ; preds = %5
%9 = icmp slt i32 %6, 0
br i1 %9, label %10, label %12
10: ; preds = %8
%11 = call i32 @err_dump(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %8, %10
%13 = load i8, i8* %4
%14 = icmp eq i8 %13, 117
br i1 %14, label %15, label %5
15: ; preds = %12
%16 = call i32 @smsg(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %5, %15
%18 = phi i32 [ 0, %15 ], [ 1, %5 ]
ret i32 %18
}