#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 */
struct stat {
  scalar_t__ st_ino;
};
typedef int /*<<< orphan*/ host;
typedef int /*<<< orphan*/ buffer;
typedef int /*<<< orphan*/ bLogin;

/* Variables and functions */
int MAXPATHLEN;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ gethostname(char *, int);
int /*<<< orphan*/ memset(char *, char, int);
char *realpath(char *, char *);
int recv_socket(int, char *, int, int);
int send_socket(int, char *, int, int);
int /*<<< orphan*/ snprintf(char *, int, char *, unsigned int, long, char *,
                            char *, char *, char *, char *, char *);
scalar_t__ stat(char *, struct stat *);
int /*<<< orphan*/ stderr;
int strlen(char *);
int do_Login(int sock, unsigned int pid, char *node, char *xpname, char *signl,
             char *username, char **m5) {
  char host[25];
  char bLogin[1024];
  char buffer[1024];
  char *path_status = NULL;
  char resolved[MAXPATHLEN];
  int bytes_read, bytes_sent;
  struct stat fileStat;
  memset(bLogin, '\0', sizeof(bLogin));
  memset(buffer, '\0', sizeof(buffer));
  memset(resolved, '\0', MAXPATHLEN);
  gethostname(host, sizeof(host));
  if ((path_status = realpath(xpname, resolved)) == NULL) {
    fprintf(stderr, "do_Login: Probleme avec le path=%s\n", xpname);
    return (1);
  }
  if (stat(resolved, &fileStat) < 0) {
    fprintf(stderr, "do_Login: Cannot stat on path=%s\n", resolved);
    return (1);
  }
  if (strlen(xpname) >= 256 || strlen(node) >= 256 || strlen(signl) >= 256 ||
      strlen(host) >= 256 || strlen(username) >= 256) {
    fprintf(stderr,
            "do_Login: length of string sent to server is above value 256\n");
    return (1);
  }
  snprintf(bLogin, sizeof(bLogin), "I %u %ld %s %s %s %s %s %s", pid,
           (long)fileStat.st_ino, xpname, node, signl, host, username, *m5);
  if ((bytes_sent = send_socket(sock, bLogin, sizeof(bLogin), 20)) <= 0) {
    fprintf(stderr,
            "LOGIN FAILED (Timeout sending) with %s Maestro server from "
            "host=%s node=%s signal=%s\n",
            username, host, node, signl);
    return (1);
  }
  if ((bytes_read = recv_socket(sock, buffer, sizeof(buffer), 20)) <= 0) {
    fprintf(stderr,
            "LOGIN FAILED (Timeout receiving) with %s Maestro server from "
            "host=%s node=%s signal=%s\n",
            username, host, node, signl);
    return (1);
  }
  buffer[bytes_read > 0 ? bytes_read : 0] = '\0';
  if (buffer[0] != '0')
    fprintf(
        stderr,
        "LOGIN FAILED with %s Maestro server from host=%s node=%s signal=%s\n",
        username, host, node, signl);
  return (buffer[0] == '0' ? 0 : 1);
}


x86 assembly (clang, -O0):
<do_Login>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x890,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
mov    %r9,-0x40(%rbp)
movq   $0x0,-0x868(%rbp)
mov    0x2e1e(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x870(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x898(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x878(%rbp)
lea    -0x460(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
lea    -0x860(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
mov    -0x898(%rbp),%rdi
mov    0x2dbc(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <memset@plt>
lea    -0x60(%rbp),%rdi
mov    $0x19,%esi
call   10b0 <gethostname@plt>
mov    -0x898(%rbp),%rsi
mov    -0x30(%rbp),%rdi
call   1080 <realpath@plt>
mov    %rax,-0x868(%rbp)
cmp    $0x0,%rax
jne    1295 <do_Login+0x105>
mov    0x2d6d(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rdx
lea    0xd88(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x14(%rbp)
movl   $0x1,-0x88c(%rbp)
jmp    1531 <do_Login+0x3a1>
mov    -0x898(%rbp),%rdi
lea    -0x888(%rbp),%rsi
call   1070 <stat@plt>
cmp    $0x0,%rax
jge    12e6 <do_Login+0x156>
mov    -0x898(%rbp),%rdx
mov    0x2d18(%rip),%rax
mov    (%rax),%edi
lea    0xd5b(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x14(%rbp)
movl   $0x1,-0x88c(%rbp)
jmp    1531 <do_Login+0x3a1>
mov    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x100,%eax
jge    134a <do_Login+0x1ba>
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x100,%eax
jge    134a <do_Login+0x1ba>
mov    -0x38(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x100,%eax
jge    134a <do_Login+0x1ba>
lea    -0x60(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x100,%eax
jge    134a <do_Login+0x1ba>
mov    -0x40(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x100,%eax
jl     1377 <do_Login+0x1e7>
mov    0x2c87(%rip),%rax
mov    (%rax),%edi
lea    0xcec(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x14(%rbp)
movl   $0x1,-0x88c(%rbp)
jmp    1531 <do_Login+0x3a1>
lea    -0x460(%rbp),%rdi
mov    -0x1c(%rbp),%ecx
mov    -0x888(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    -0x28(%rbp),%r14
mov    -0x38(%rbp),%rbx
lea    -0x60(%rbp),%r11
mov    -0x40(%rbp),%r10
mov    0x10(%rbp),%rax
mov    (%rax),%rax
mov    $0x400,%esi
lea    0xcd5(%rip),%rdx
sub    $0x30,%rsp
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1040 <snprintf@plt>
add    $0x30,%rsp
mov    -0x18(%rbp),%edi
lea    -0x460(%rbp),%rsi
mov    $0x400,%edx
mov    $0x14,%ecx
call   10a0 <send_socket@plt>
mov    %eax,-0x880(%rbp)
cmp    $0x0,%eax
jg     1439 <do_Login+0x2a9>
mov    0x2bd5(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%rdx
lea    -0x60(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x38(%rbp),%r9
lea    0xc83(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x14(%rbp)
movl   $0x1,-0x88c(%rbp)
jmp    1531 <do_Login+0x3a1>
mov    -0x18(%rbp),%edi
lea    -0x860(%rbp),%rsi
mov    $0x400,%edx
mov    $0x14,%ecx
call   1090 <recv_socket@plt>
mov    %eax,-0x87c(%rbp)
cmp    $0x0,%eax
jg     149e <do_Login+0x30e>
mov    0x2b70(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%rdx
lea    -0x60(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x38(%rbp),%r9
lea    0xc74(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x14(%rbp)
movl   $0x1,-0x88c(%rbp)
jmp    1531 <do_Login+0x3a1>
cmpl   $0x0,-0x87c(%rbp)
jle    14bc <do_Login+0x32c>
mov    -0x87c(%rbp),%eax
mov    %eax,-0x89c(%rbp)
jmp    14c9 <do_Login+0x339>
xor    %eax,%eax
mov    %eax,-0x89c(%rbp)
jmp    14c9 <do_Login+0x339>
mov    -0x89c(%rbp),%eax
cltq
movb   $0x0,-0x860(%rbp,%rax,1)
movsbl -0x860(%rbp),%eax
cmp    $0x30,%eax
je     1510 <do_Login+0x380>
mov    0x2ae8(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%rdx
lea    -0x60(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x38(%rbp),%r9
lea    0xc44(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movsbl -0x860(%rbp),%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x30,%edx
cmove  %ecx,%eax
mov    %eax,-0x14(%rbp)
movl   $0x1,-0x88c(%rbp)
mov    -0x870(%rbp),%rax
mov    %rax,%rsp
mov    -0x14(%rbp),%eax
lea    -0x10(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_Login>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x848,%rsp
mov    %r9,-0x38(%rbp)
mov    %r8,-0x40(%rbp)
mov    %rcx,%rbx
mov    %rdx,%r12
mov    %esi,-0x2c(%rbp)
mov    %edi,-0x30(%rbp)
mov    %rsp,%r15
mov    0x2e26(%rip),%r13
mov    0x0(%r13),%eax
mov    %rsp,%r14
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
lea    -0x870(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
lea    -0x470(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
mov    0x0(%r13),%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
lea    -0x70(%rbp),%rdi
mov    $0x19,%esi
call   10b0 <gethostname@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <realpath@plt>
test   %rax,%rax
je     12af <do_Login+0x11f>
lea    -0x48(%rbp),%rsi
mov    %r14,%rdi
call   1070 <stat@plt>
test   %rax,%rax
js     12c4 <do_Login+0x134>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0xff,%eax
jg     1296 <do_Login+0x106>
mov    %r12,%r13
mov    %r12,%rdi
call   1030 <strlen@plt>
cmp    $0xff,%eax
jg     1296 <do_Login+0x106>
mov    -0x40(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0xff,%eax
jg     1296 <do_Login+0x106>
lea    -0x70(%rbp),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
cmp    $0xff,%eax
jg     1296 <do_Login+0x106>
mov    -0x38(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x100,%eax
jl     12f5 <do_Login+0x165>
mov    0x2d3b(%rip),%rax
mov    (%rax),%edi
lea    0xda0(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    12de <do_Login+0x14e>
mov    0x2d22(%rip),%rax
mov    (%rax),%edi
lea    0xd41(%rip),%rsi
mov    %rbx,%rdx
jmp    12d7 <do_Login+0x147>
mov    0x2d0d(%rip),%rax
mov    (%rax),%edi
lea    0xd50(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%eax
mov    %r15,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x10(%rbp),%rax
mov    -0x48(%rbp),%r8
sub    $0x8,%rsp
lea    0xd7c(%rip),%rdx
lea    -0x870(%rbp),%rdi
mov    $0x400,%esi
mov    -0x2c(%rbp),%ecx
mov    %rbx,%r9
push   (%rax)
mov    -0x38(%rbp),%r12
push   %r12
push   %r14
mov    -0x40(%rbp),%r14
push   %r14
push   %r13
call   1040 <snprintf@plt>
add    $0x30,%rsp
mov    -0x30(%rbp),%ebx
mov    %ebx,%edi
lea    -0x870(%rbp),%rsi
mov    $0x400,%edx
mov    $0x14,%ecx
call   10a0 <send_socket@plt>
test   %eax,%eax
jle    13be <do_Login+0x22e>
lea    -0x470(%rbp),%rsi
mov    %ebx,%edi
mov    $0x400,%edx
mov    $0x14,%ecx
call   1090 <recv_socket@plt>
test   %eax,%eax
jle    13d0 <do_Login+0x240>
mov    %eax,%eax
movb   $0x0,-0x470(%rbp,%rax,1)
xor    %eax,%eax
cmpb   $0x30,-0x470(%rbp)
je     12e3 <do_Login+0x153>
mov    0x2c48(%rip),%rax
mov    (%rax),%edi
lea    0xdb4(%rip),%rsi
lea    -0x70(%rbp),%rcx
mov    %r12,%rdx
mov    %r13,%r8
mov    %r14,%r9
xor    %eax,%eax
call   1060 <fprintf@plt>
xor    %eax,%eax
cmpb   $0x30,-0x470(%rbp)
setne  %al
jmp    12e3 <do_Login+0x153>
mov    0x2c13(%rip),%rax
mov    (%rax),%edi
lea    0xcd1(%rip),%rsi
jmp    13e0 <do_Login+0x250>
mov    0x2c01(%rip),%rax
mov    (%rax),%edi
lea    0xd15(%rip),%rsi
lea    -0x70(%rbp),%rcx
mov    %r12,%rdx
mov    %r13,%r8
mov    %r14,%r9
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    12de <do_Login+0x14e>

LLVM IR (-O0):
%struct.stat = type { i64 }
@MAXPATHLEN = global i32 0
@stderr = global i32 0
@.str = [36 x i8] c"do_Login: Probleme avec le path=%s\0A\00"
@.str.1 = [34 x i8] c"do_Login: Cannot stat on path=%s\0A\00"
@.str.2 = [62 x i8] c"do_Login: length of string sent to server is above value 256\0A\00"
@.str.3 = [27 x i8] c"I %u %ld %s %s %s %s %s %s\00"
@.str.4 = [86 x i8] c"LOGIN FAILED (Timeout sending) with %s Maestro server from host=%s node=%s signal=%s\0A\00"
@.str.5 = [88 x i8] c"LOGIN FAILED (Timeout receiving) with %s Maestro server from host=%s node=%s signal=%s\0A\00"
@.str.6 = [68 x i8] c"LOGIN FAILED with %s Maestro server from host=%s node=%s signal=%s\0A\00"
define i32 @do_Login(i32 %0, i32 %1, i8* %2, i8* %3, i8* %4, i8* %5, i8** %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8**
%16 = alloca [25 x i8]
%17 = alloca [1024 x i8]
%18 = alloca [1024 x i8]
%19 = alloca i8*
%20 = alloca i8*
%21 = alloca i64
%22 = alloca i32
%23 = alloca i32
%24 = alloca %struct.stat
%25 = alloca i32
store i32 %0, i32* %9
store i32 %1, i32* %10
store i8* %2, i8** %11
store i8* %3, i8** %12
store i8* %4, i8** %13
store i8* %5, i8** %14
store i8** %6, i8*** %15
store i8* null, i8** %19
%26 = load i32, i32* @MAXPATHLEN
%27 = zext i32 %26 to i64
%28 = call i8* @llvm.stacksave()
store i8* %28, i8** %20
%29 = alloca i8, i64 %27
store i64 %27, i64* %21
%30 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
%31 = call i32 @memset(i8* %30, i8 signext 0, i32 1024)
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %18, i64 0, i64 0
%33 = call i32 @memset(i8* %32, i8 signext 0, i32 1024)
%34 = load i32, i32* @MAXPATHLEN
%35 = call i32 @memset(i8* %29, i8 signext 0, i32 %34)
%36 = getelementptr inbounds [25 x i8], [25 x i8]* %16, i64 0, i64 0
%37 = call i32 @gethostname(i8* %36, i32 25)
%38 = load i8*, i8** %12
%39 = call i8* @realpath(i8* %38, i8* %29)
store i8* %39, i8** %19
%40 = icmp eq i8* %39, null
br i1 %40, label %41, label %45
41: ; preds = %7
%42 = load i32, i32* @stderr
%43 = load i8*, i8** %12
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %43)
store i32 1, i32* %8
store i32 1, i32* %25
br label %138
45: ; preds = %7
%46 = call i64 @stat(i8* %29, %struct.stat* %24)
%47 = icmp slt i64 %46, 0
br i1 %47, label %48, label %51
48: ; preds = %45
%49 = load i32, i32* @stderr
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* %29)
store i32 1, i32* %8
store i32 1, i32* %25
br label %138
51: ; preds = %45
%52 = load i8*, i8** %12
%53 = call i32 @strlen(i8* %52)
%54 = icmp sge i32 %53, 256
br i1 %54, label %71, label %55
55: ; preds = %51
%56 = load i8*, i8** %11
%57 = call i32 @strlen(i8* %56)
%58 = icmp sge i32 %57, 256
br i1 %58, label %71, label %59
59: ; preds = %55
%60 = load i8*, i8** %13
%61 = call i32 @strlen(i8* %60)
%62 = icmp sge i32 %61, 256
br i1 %62, label %71, label %63
63: ; preds = %59
%64 = getelementptr inbounds [25 x i8], [25 x i8]* %16, i64 0, i64 0
%65 = call i32 @strlen(i8* %64)
%66 = icmp sge i32 %65, 256
br i1 %66, label %71, label %67
67: ; preds = %63
%68 = load i8*, i8** %14
%69 = call i32 @strlen(i8* %68)
%70 = icmp sge i32 %69, 256
br i1 %70, label %71, label %74
71: ; preds = %67, %63, %59, %55, %51
%72 = load i32, i32* @stderr
%73 = call i32 (i32, i8*, ...) @fprintf(i32 %72, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %8
store i32 1, i32* %25
br label %138
74: ; preds = %67
%75 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
%76 = load i32, i32* %10
%77 = getelementptr inbounds %struct.stat, %struct.stat* %24, i32 0, i32 0
%78 = load i64, i64* %77
%79 = load i8*, i8** %12
%80 = load i8*, i8** %11
%81 = load i8*, i8** %13
%82 = getelementptr inbounds [25 x i8], [25 x i8]* %16, i64 0, i64 0
%83 = load i8*, i8** %14
%84 = load i8**, i8*** %15
%85 = load i8*, i8** %84
%86 = call i32 @snprintf(i8* %75, i32 1024, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %76, i64 %78, i8* %79, i8* %80, i8* %81, i8* %82, i8* %83, i8* %85)
%87 = load i32, i32* %9
%88 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
%89 = call i32 @send_socket(i32 %87, i8* %88, i32 1024, i32 20)
store i32 %89, i32* %23
%90 = icmp sle i32 %89, 0
br i1 %90, label %91, label %98
91: ; preds = %74
%92 = load i32, i32* @stderr
%93 = load i8*, i8** %14
%94 = getelementptr inbounds [25 x i8], [25 x i8]* %16, i64 0, i64 0
%95 = load i8*, i8** %11
%96 = load i8*, i8** %13
%97 = call i32 (i32, i8*, ...) @fprintf(i32 %92, i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.4, i64 0, i64 0), i8* %93, i8* %94, i8* %95, i8* %96)
store i32 1, i32* %8
store i32 1, i32* %25
br label %138
98: ; preds = %74
%99 = load i32, i32* %9
%100 = getelementptr inbounds [1024 x i8], [1024 x i8]* %18, i64 0, i64 0
%101 = call i32 @recv_socket(i32 %99, i8* %100, i32 1024, i32 20)
store i32 %101, i32* %22
%102 = icmp sle i32 %101, 0
br i1 %102, label %103, label %110
103: ; preds = %98
%104 = load i32, i32* @stderr
%105 = load i8*, i8** %14
%106 = getelementptr inbounds [25 x i8], [25 x i8]* %16, i64 0, i64 0
%107 = load i8*, i8** %11
%108 = load i8*, i8** %13
%109 = call i32 (i32, i8*, ...) @fprintf(i32 %104, i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str.5, i64 0, i64 0), i8* %105, i8* %106, i8* %107, i8* %108)
store i32 1, i32* %8
store i32 1, i32* %25
br label %138
110: ; preds = %98
%111 = load i32, i32* %22
%112 = icmp sgt i32 %111, 0
br i1 %112, label %113, label %115
113: ; preds = %110
%114 = load i32, i32* %22
br label %116
115: ; preds = %110
br label %116
116: ; preds = %115, %113
%117 = phi i32 [ %114, %113 ], [ 0, %115 ]
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds [1024 x i8], [1024 x i8]* %18, i64 0, i64 %118
store i8 0, i8* %119
%120 = getelementptr inbounds [1024 x i8], [1024 x i8]* %18, i64 0, i64 0
%121 = load i8, i8* %120
%122 = sext i8 %121 to i32
%123 = icmp ne i32 %122, 48
br i1 %123, label %124, label %131
124: ; preds = %116
%125 = load i32, i32* @stderr
%126 = load i8*, i8** %14
%127 = getelementptr inbounds [25 x i8], [25 x i8]* %16, i64 0, i64 0
%128 = load i8*, i8** %11
%129 = load i8*, i8** %13
%130 = call i32 (i32, i8*, ...) @fprintf(i32 %125, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.6, i64 0, i64 0), i8* %126, i8* %127, i8* %128, i8* %129)
br label %131
131: ; preds = %124, %116
%132 = getelementptr inbounds [1024 x i8], [1024 x i8]* %18, i64 0, i64 0
%133 = load i8, i8* %132
%134 = sext i8 %133 to i32
%135 = icmp eq i32 %134, 48
%136 = zext i1 %135 to i64
%137 = select i1 %135, i32 0, i32 1
store i32 %137, i32* %8
store i32 1, i32* %25
br label %138
138: ; preds = %131, %103, %91, %71, %48, %41
%139 = load i8*, i8** %20
%140 = load i32, i32* %8
ret i32 %140
}

LLVM IR (-O2):
%struct.stat = type { i64 }
@MAXPATHLEN = global i32 0
@stderr = global i32 0
@.str = [36 x i8] c"do_Login: Probleme avec le path=%s\0A\00"
@.str.1 = [34 x i8] c"do_Login: Cannot stat on path=%s\0A\00"
@.str.2 = [62 x i8] c"do_Login: length of string sent to server is above value 256\0A\00"
@.str.3 = [27 x i8] c"I %u %ld %s %s %s %s %s %s\00"
@.str.4 = [86 x i8] c"LOGIN FAILED (Timeout sending) with %s Maestro server from host=%s node=%s signal=%s\0A\00"
@.str.5 = [88 x i8] c"LOGIN FAILED (Timeout receiving) with %s Maestro server from host=%s node=%s signal=%s\0A\00"
@.str.6 = [68 x i8] c"LOGIN FAILED with %s Maestro server from host=%s node=%s signal=%s\0A\00"
define i32 @do_Login(i32 %0, i32 %1, i8* %2, i8* %3, i8* %4, i8* %5, i8** nocapture %6) {
%8 = alloca [25 x i8]
%9 = alloca [1024 x i8]
%10 = alloca [1024 x i8]
%11 = alloca %struct.stat
%12 = getelementptr inbounds [25 x i8], [25 x i8]* %8, i64 0, i64 0
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%15 = load i32, i32* @MAXPATHLEN
%16 = zext i32 %15 to i64
%17 = tail call i8* @llvm.stacksave()
%18 = alloca i8, i64 %16
%19 = bitcast %struct.stat* %11 to i8*
%20 = call i32 @memset(i8* %13, i8 signext 0, i32 1024)
%21 = call i32 @memset(i8* %14, i8 signext 0, i32 1024)
%22 = load i32, i32* @MAXPATHLEN
%23 = call i32 @memset(i8* %18, i8 signext 0, i32 %22)
%24 = call i32 @gethostname(i8* %12, i32 25)
%25 = call i8* @realpath(i8* %3, i8* %18)
%26 = icmp eq i8* %25, null
br i1 %26, label %27, label %30
27: ; preds = %7
%28 = load i32, i32* @stderr
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %3)
br label %81
30: ; preds = %7
%31 = call i64 @stat(i8* %18, %struct.stat* %11)
%32 = icmp slt i64 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load i32, i32* @stderr
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* %18)
br label %81
36: ; preds = %30
%37 = call i32 @strlen(i8* %3)
%38 = icmp sgt i32 %37, 255
br i1 %38, label %51, label %39
39: ; preds = %36
%40 = call i32 @strlen(i8* %2)
%41 = icmp sgt i32 %40, 255
br i1 %41, label %51, label %42
42: ; preds = %39
%43 = call i32 @strlen(i8* %4)
%44 = icmp sgt i32 %43, 255
br i1 %44, label %51, label %45
45: ; preds = %42
%46 = call i32 @strlen(i8* %12)
%47 = icmp sgt i32 %46, 255
br i1 %47, label %51, label %48
48: ; preds = %45
%49 = call i32 @strlen(i8* %5)
%50 = icmp sgt i32 %49, 255
br i1 %50, label %51, label %54
51: ; preds = %48, %45, %42, %39, %36
%52 = load i32, i32* @stderr
%53 = call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.2, i64 0, i64 0))
br label %81
54: ; preds = %48
%55 = getelementptr inbounds %struct.stat, %struct.stat* %11, i64 0, i32 0
%56 = load i64, i64* %55
%57 = load i8*, i8** %6
%58 = call i32 @snprintf(i8* %13, i32 1024, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %1, i64 %56, i8* %3, i8* %2, i8* %4, i8* %12, i8* %5, i8* %57)
%59 = call i32 @send_socket(i32 %0, i8* %13, i32 1024, i32 20)
%60 = icmp slt i32 %59, 1
br i1 %60, label %61, label %64
61: ; preds = %54
%62 = load i32, i32* @stderr
%63 = call i32 (i32, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.4, i64 0, i64 0), i8* %5, i8* %12, i8* %2, i8* %4)
br label %81
64: ; preds = %54
%65 = call i32 @recv_socket(i32 %0, i8* %14, i32 1024, i32 20)
%66 = icmp slt i32 %65, 1
br i1 %66, label %67, label %70
67: ; preds = %64
%68 = load i32, i32* @stderr
%69 = call i32 (i32, i8*, ...) @fprintf(i32 %68, i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str.5, i64 0, i64 0), i8* %5, i8* %12, i8* %2, i8* %4)
br label %81
70: ; preds = %64
%71 = zext i32 %65 to i64
%72 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 %71
store i8 0, i8* %72
%73 = load i8, i8* %14
%74 = icmp eq i8 %73, 48
br i1 %74, label %81, label %75
75: ; preds = %70
%76 = load i32, i32* @stderr
%77 = call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.6, i64 0, i64 0), i8* %5, i8* %12, i8* %2, i8* %4)
%78 = load i8, i8* %14
%79 = icmp ne i8 %78, 48
%80 = zext i1 %79 to i32
br label %81
81: ; preds = %70, %75, %67, %61, %51, %33, %27
%82 = phi i32 [ 1, %27 ], [ 1, %33 ], [ 1, %51 ], [ 1, %61 ], [ 1, %67 ], [ %80, %75 ], [ 0, %70 ]
ret i32 %82
}