#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 */
typedef int /*<<< orphan*/ pwdts;

/* Variables and functions */
int BUFSIZ;
int basex_status(int);
int /*<<< orphan*/ free(char *);
char *md5(char const *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int read(int, char **, int);
int send_db(int, char *, int);
char *strchr(char *, char);
int strlen(char const *);
int /*<<< orphan*/ strncpy(char *, char const *, int);
int /*<<< orphan*/ warnx(char *, ...);
int write(int, char const *, int);
int basex_authenticate(int sfd, const char *user, const char *passwd) {
  char ts[BUFSIZ];
  char *md5_pwd;
  int ts_len, rc, i;
  memset(ts, 0, BUFSIZ);
  rc = read(sfd, &ts, BUFSIZ);
  if (rc == -1) {
    warnx("Reading timestamp failed.");
    return -1;
  }
  ts_len = strlen(ts);
  int user_len = strlen(user) + 1;
  rc = write(sfd, user, user_len);
  if (rc == -1 || rc != user_len) {
    warnx("Sending username failed. %d != %d", rc, user_len);
    return -1;
  }
  char *p = strchr(ts, ':');
  char *t;
  if (!p) {
    t = ts;
    md5_pwd = md5(passwd);
    if (md5_pwd == NULL) {
      warnx("md5 computation for password failed.");
      return -1;
    }
  } else {
    t = p + 1;
    int user_len = strlen(user);
    int pass_len = strlen(passwd);
    int realm_len = p - ts;
    char codewd[user_len + realm_len + pass_len + 3];
    strncpy(codewd, user, user_len);
    codewd[user_len] = ':';
    strncpy(codewd + user_len + 1, ts, realm_len);
    codewd[user_len + 1 + realm_len] = ':';
    strncpy(codewd + user_len + 1 + realm_len + 1, passwd, pass_len);
    codewd[user_len + 1 + realm_len + 1 + pass_len] = '\0';
    md5_pwd = md5(codewd);
    if (md5_pwd == NULL) {
      warnx("md5 computation for password failed.");
      return -1;
    }
    ts_len = ts_len - realm_len - 1;
  }
  int md5_pwd_len = strlen(md5_pwd);
  int pwdts_len = md5_pwd_len + ts_len + 1;
  char pwdts[pwdts_len];
  memset(pwdts, 0, sizeof(pwdts));
  for (i = 0; i < md5_pwd_len; i++)
    pwdts[i] = md5_pwd[i];
  int j = md5_pwd_len;
  for (i = 0; i < ts_len; i++, j++)
    pwdts[j] = t[i];
  pwdts[pwdts_len - 1] = '\0';
  char *md5_pwdts = md5(pwdts);
  if (md5_pwdts == NULL) {
    warnx("md5 computation for password + timestamp failed.");
    return -1;
  }
  int md5_pwdts_len = strlen(md5_pwdts);
  rc = send_db(sfd, md5_pwdts, md5_pwdts_len + 1);
  if (rc == -1) {
    warnx("Sending credentials failed.");
    return -1;
  }
  free(md5_pwd);
  free(md5_pwdts);
  rc = basex_status(sfd);
  if (rc == -1) {
    warnx("Reading authentification status failed.");
    return -1;
  }
  if (rc != 0) {
    warnx("Authentification failed");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<basex_authenticate>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2e13(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0xa8(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x28(%rbp)
mov    0x2de4(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1090 <memset@plt>
mov    -0xa8(%rbp),%rsi
mov    -0x8(%rbp),%edi
mov    0x2dca(%rip),%rax
mov    (%rax),%edx
call   10a0 <read@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0xffffffff,-0x38(%rbp)
jne    124b <basex_authenticate+0x9b>
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1080 <warnx@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x40(%rbp)
jmp    167e <basex_authenticate+0x4ce>
mov    -0xa8(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x44(%rbp),%edx
call   1050 <write@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0xffffffff,-0x38(%rbp)
je     1291 <basex_authenticate+0xe1>
mov    -0x38(%rbp),%eax
cmp    -0x44(%rbp),%eax
je     12b8 <basex_authenticate+0x108>
mov    -0x38(%rbp),%esi
mov    -0x44(%rbp),%edx
lea    0xd7c(%rip),%rdi
mov    $0x0,%al
call   1080 <warnx@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x40(%rbp)
jmp    167e <basex_authenticate+0x4ce>
mov    -0xa8(%rbp),%rdi
mov    $0x3a,%esi
call   1070 <strchr@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jne    1321 <basex_authenticate+0x171>
mov    -0xa8(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x18(%rbp),%rdi
call   10d0 <md5@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    131c <basex_authenticate+0x16c>
lea    0xd3a(%rip),%rdi
mov    $0x0,%al
call   1080 <warnx@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x40(%rbp)
jmp    167e <basex_authenticate+0x4ce>
jmp    147a <basex_authenticate+0x2ca>
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0xa8(%rbp),%rcx
mov    %eax,-0x60(%rbp)
mov    -0x50(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x64(%rbp)
mov    -0x5c(%rbp),%edx
mov    -0x64(%rbp),%eax
add    %eax,%edx
mov    -0x60(%rbp),%ecx
mov    %ecx,%eax
mov    %edx,%ecx
lea    0x3(%rax,%rcx,1),%eax
mov    %rsp,%rcx
mov    %rcx,-0x70(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0xb0(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x78(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x5c(%rbp),%edx
call   1040 <strncpy@plt>
mov    -0xa8(%rbp),%rsi
mov    -0xb0(%rbp),%rdi
movslq -0x5c(%rbp),%rax
movb   $0x3a,(%rdi,%rax,1)
movslq -0x5c(%rbp),%rax
add    %rax,%rdi
add    $0x1,%rdi
mov    -0x64(%rbp),%edx
call   1040 <strncpy@plt>
mov    -0xb0(%rbp),%rdi
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
add    -0x64(%rbp),%eax
cltq
movb   $0x3a,(%rdi,%rax,1)
movslq -0x5c(%rbp),%rax
add    %rax,%rdi
add    $0x1,%rdi
movslq -0x64(%rbp),%rax
add    %rax,%rdi
add    $0x1,%rdi
mov    -0x18(%rbp),%rsi
mov    -0x60(%rbp),%edx
call   1040 <strncpy@plt>
mov    -0xb0(%rbp),%rdi
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
add    -0x64(%rbp),%eax
add    $0x1,%eax
add    -0x60(%rbp),%eax
cltq
movb   $0x0,(%rdi,%rax,1)
call   10d0 <md5@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    144b <basex_authenticate+0x29b>
lea    0xc0b(%rip),%rdi
mov    $0x0,%al
call   1080 <warnx@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x40(%rbp)
jmp    145e <basex_authenticate+0x2ae>
mov    -0x34(%rbp),%eax
sub    -0x64(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x34(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x70(%rbp),%rax
mov    %rax,%rsp
mov    -0x40(%rbp),%eax
test   %eax,%eax
jne    167e <basex_authenticate+0x4ce>
jmp    1475 <basex_authenticate+0x2c5>
jmp    147a <basex_authenticate+0x2ca>
mov    -0x30(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x7c(%rbp)
mov    -0x7c(%rbp),%edx
mov    -0x34(%rbp),%eax
mov    %eax,%ecx
mov    %edx,%eax
lea    0x1(%rax,%rcx,1),%eax
mov    %eax,-0x80(%rbp)
mov    -0x80(%rbp),%eax
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0xb8(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x88(%rbp)
mov    %eax,%edx
xor    %esi,%esi
call   1090 <memset@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x7c(%rbp),%eax
jge    14ff <basex_authenticate+0x34f>
mov    -0xb8(%rbp),%rax
mov    -0x30(%rbp),%rcx
movslq -0x3c(%rbp),%rdx
mov    (%rcx,%rdx,1),%dl
movslq -0x3c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    14cc <basex_authenticate+0x31c>
mov    -0x7c(%rbp),%eax
mov    %eax,-0x8c(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1554 <basex_authenticate+0x3a4>
mov    -0xb8(%rbp),%rax
mov    -0x58(%rbp),%rcx
movslq -0x3c(%rbp),%rdx
mov    (%rcx,%rdx,1),%dl
movslq -0x8c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    150f <basex_authenticate+0x35f>
mov    -0xb8(%rbp),%rdi
mov    -0x80(%rbp),%eax
sub    $0x1,%eax
cltq
movb   $0x0,(%rdi,%rax,1)
call   10d0 <md5@plt>
mov    %rax,-0x98(%rbp)
cmpq   $0x0,-0x98(%rbp)
jne    15a2 <basex_authenticate+0x3f2>
lea    0xad9(%rip),%rdi
mov    $0x0,%al
call   1080 <warnx@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x40(%rbp)
jmp    167e <basex_authenticate+0x4ce>
mov    -0x98(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x9c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x98(%rbp),%rsi
mov    -0x9c(%rbp),%edx
add    $0x1,%edx
call   10b0 <send_db@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0xffffffff,-0x38(%rbp)
jne    15fa <basex_authenticate+0x44a>
lea    0xab2(%rip),%rdi
mov    $0x0,%al
call   1080 <warnx@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x40(%rbp)
jmp    167e <basex_authenticate+0x4ce>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x98(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%edi
call   10c0 <basex_status@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0xffffffff,-0x38(%rbp)
jne    1645 <basex_authenticate+0x495>
lea    0xa83(%rip),%rdi
mov    $0x0,%al
call   1080 <warnx@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x40(%rbp)
jmp    167e <basex_authenticate+0x4ce>
cmpl   $0x0,-0x38(%rbp)
je     1670 <basex_authenticate+0x4c0>
lea    0xa80(%rip),%rdi
mov    $0x0,%al
call   1080 <warnx@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x40(%rbp)
jmp    167e <basex_authenticate+0x4ce>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<basex_authenticate>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdx,%r12
mov    %rsi,%r14
mov    %edi,%r13d
mov    0x2e0f(%rip),%rbx
mov    (%rbx),%edx
mov    %rsp,%r15
mov    %rdx,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    %r15,%rdi
xor    %esi,%esi
call   1090 <memset@plt>
mov    (%rbx),%edx
mov    %r13d,%edi
mov    %r15,%rsi
call   10a0 <read@plt>
cmp    $0xffffffff,%eax
je     132c <basex_authenticate+0x17c>
mov    %r15,%rdi
call   1060 <strlen@plt>
mov    %rax,-0x48(%rbp)
mov    %r14,%rdi
call   1060 <strlen@plt>
mov    %eax,%ebx
add    $0x1,%ebx
mov    %r13d,%edi
mov    %r14,%rsi
mov    %ebx,%edx
call   1050 <write@plt>
cmp    $0xffffffff,%eax
je     133c <basex_authenticate+0x18c>
cmp    %ebx,%eax
jne    133c <basex_authenticate+0x18c>
mov    %r15,%rdi
mov    $0x3a,%esi
call   1070 <strchr@plt>
mov    %rax,-0x40(%rbp)
test   %rax,%rax
je     1362 <basex_authenticate+0x1b2>
mov    %r13d,-0x2c(%rbp)
mov    %r14,%rdi
call   1060 <strlen@plt>
mov    %eax,%ebx
mov    %r12,%rdi
call   1060 <strlen@plt>
mov    %rax,-0x58(%rbp)
mov    %rsp,-0x38(%rbp)
mov    -0x40(%rbp),%r13
sub    %r15,%r13
lea    (%rbx,%r13,1),%ecx
mov    %rcx,-0x60(%rbp)
add    %eax,%ecx
add    $0x3,%ecx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %r12,-0x50(%rbp)
mov    %rsp,%r12
sub    %rcx,%r12
mov    %r12,%rsp
mov    %r12,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1040 <strncpy@plt>
movslq %ebx,%rbx
lea    (%r12,%rbx,1),%r14
movb   $0x3a,(%rbx,%r12,1)
lea    (%rbx,%r12,1),%rdi
add    $0x1,%rdi
mov    %r15,%rsi
mov    %r13d,%edx
call   1040 <strncpy@plt>
lea    (%rbx,%r13,1),%eax
add    $0x1,%eax
cltq
movb   $0x3a,(%rax,%r12,1)
movslq %r13d,%rax
lea    0x2(%rax,%r14,1),%rdi
mov    -0x50(%rbp),%rsi
mov    -0x58(%rbp),%rbx
mov    %ebx,%edx
call   1040 <strncpy@plt>
mov    -0x60(%rbp),%rax
add    %ebx,%eax
add    $0x2,%eax
cltq
movb   $0x0,(%rax,%r12,1)
mov    %r12,%rdi
call   10d0 <md5@plt>
test   %rax,%rax
je     1564 <basex_authenticate+0x3b4>
mov    %rax,%r12
mov    -0x40(%rbp),%r15
add    $0x1,%r15
not    %r13d
mov    -0x48(%rbp),%rbx
add    %r13d,%ebx
mov    -0x38(%rbp),%rsp
jmp    137e <basex_authenticate+0x1ce>
lea    0xccd(%rip),%rdi
xor    %eax,%eax
call   1080 <warnx@plt>
jmp    134e <basex_authenticate+0x19e>
lea    0xcd7(%rip),%rdi
mov    %eax,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1080 <warnx@plt>
mov    $0xffffffff,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r12,%rdi
call   10d0 <md5@plt>
test   %rax,%rax
je     1598 <basex_authenticate+0x3e8>
mov    %rax,%r12
mov    %r13d,-0x2c(%rbp)
mov    -0x48(%rbp),%rbx
mov    %r12,%rdi
call   1060 <strlen@plt>
mov    %eax,%r14d
lea    (%r14,%rbx,1),%edx
add    $0x1,%edx
lea    0xf(%rdx),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%r13
sub    %rax,%r13
mov    %r13,%rsp
mov    %r13,%rdi
xor    %esi,%esi
call   1090 <memset@plt>
test   %r14d,%r14d
jle    1444 <basex_authenticate+0x294>
mov    %r14d,%r9d
cmp    $0x8,%r14d
jb     13d7 <basex_authenticate+0x227>
lea    (%r12,%r9,1),%rcx
cmp    %rcx,%r13
jae    15a4 <basex_authenticate+0x3f4>
lea    (%r9,%r13,1),%rcx
cmp    %rcx,%r12
jae    15a4 <basex_authenticate+0x3f4>
xor    %ecx,%ecx
mov    %rcx,%rdx
not    %rdx
add    %r9,%rdx
mov    %r9,%rsi
and    $0x3,%rsi
je     1404 <basex_authenticate+0x254>
nopl   0x0(%rax,%rax,1)
movzbl (%r12,%rcx,1),%eax
mov    %al,0x0(%r13,%rcx,1)
add    $0x1,%rcx
add    $0xffffffffffffffff,%rsi
jne    13f0 <basex_authenticate+0x240>
cmp    $0x3,%rdx
jb     1444 <basex_authenticate+0x294>
nopw   0x0(%rax,%rax,1)
movzbl (%r12,%rcx,1),%eax
mov    %al,0x0(%r13,%rcx,1)
movzbl 0x1(%r12,%rcx,1),%eax
mov    %al,0x1(%r13,%rcx,1)
movzbl 0x2(%r12,%rcx,1),%eax
mov    %al,0x2(%r13,%rcx,1)
movzbl 0x3(%r12,%rcx,1),%eax
mov    %al,0x3(%r13,%rcx,1)
add    $0x4,%rcx
cmp    %rcx,%r9
jne    1410 <basex_authenticate+0x260>
lea    (%r14,%rbx,1),%r8d
test   %ebx,%ebx
jle    14fb <basex_authenticate+0x34b>
movslq %r14d,%rdx
mov    %ebx,%r11d
cmp    $0x8,%ebx
jb     147c <basex_authenticate+0x2cc>
lea    (%rdx,%r13,1),%r10
lea    (%r15,%r11,1),%rax
cmp    %rax,%r10
jae    15b1 <basex_authenticate+0x401>
lea    (%rdx,%r11,1),%rax
add    %r13,%rax
cmp    %rax,%r15
jae    15b1 <basex_authenticate+0x401>
xor    %esi,%esi
mov    %rsi,%rdi
not    %rdi
add    %r11,%rdi
mov    %r11,%rcx
and    $0x3,%rcx
je     14a8 <basex_authenticate+0x2f8>
movzbl (%r15,%rsi,1),%eax
mov    %al,0x0(%r13,%rdx,1)
add    $0x1,%rsi
add    $0x1,%rdx
add    $0xffffffffffffffff,%rcx
jne    1490 <basex_authenticate+0x2e0>
cmp    $0x3,%rdi
jb     14fb <basex_authenticate+0x34b>
sub    %rsi,%r11
lea    (%rsi,%r15,1),%rax
add    $0x3,%rax
lea    (%rdx,%r13,1),%rcx
add    $0x3,%rcx
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl -0x3(%rax,%rdx,1),%ebx
mov    %bl,-0x3(%rcx,%rdx,1)
movzbl -0x2(%rax,%rdx,1),%ebx
mov    %bl,-0x2(%rcx,%rdx,1)
movzbl -0x1(%rax,%rdx,1),%ebx
mov    %bl,-0x1(%rcx,%rdx,1)
movzbl (%rax,%rdx,1),%ebx
mov    %bl,(%rcx,%rdx,1)
add    $0x4,%rdx
cmp    %rdx,%r11
jne    14d0 <basex_authenticate+0x320>
movslq %r8d,%rax
movb   $0x0,0x0(%r13,%rax,1)
mov    %r13,%rdi
call   10d0 <md5@plt>
test   %rax,%rax
je     1580 <basex_authenticate+0x3d0>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <strlen@plt>
lea    0x1(%rax),%edx
mov    -0x2c(%rbp),%r14d
mov    %r14d,%edi
mov    %rbx,%rsi
call   10b0 <send_db@plt>
cmp    $0xffffffff,%eax
je     158c <basex_authenticate+0x3dc>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14d,%edi
call   10c0 <basex_status@plt>
test   %eax,%eax
je     1353 <basex_authenticate+0x1a3>
cmp    $0xffffffff,%eax
jne    15bd <basex_authenticate+0x40d>
lea    0xb4f(%rip),%rdi
jmp    1333 <basex_authenticate+0x183>
lea    0xad1(%rip),%rdi
xor    %eax,%eax
call   1080 <warnx@plt>
mov    $0xffffffff,%eax
mov    -0x38(%rbp),%rsp
jmp    1353 <basex_authenticate+0x1a3>
lea    0xada(%rip),%rdi
jmp    1333 <basex_authenticate+0x183>
lea    0xaff(%rip),%rdi
jmp    1333 <basex_authenticate+0x183>
lea    0xa9d(%rip),%rdi
jmp    1333 <basex_authenticate+0x183>
cmp    $0x20,%r14d
jae    15c9 <basex_authenticate+0x419>
xor    %ecx,%ecx
jmp    16ee <basex_authenticate+0x53e>
cmp    $0x20,%ebx
jae    15f2 <basex_authenticate+0x442>
xor    %esi,%esi
jmp    17da <basex_authenticate+0x62a>
lea    0xb12(%rip),%rdi
jmp    1333 <basex_authenticate+0x183>
mov    %r9d,%ecx
and    $0xffffffe0,%ecx
lea    -0x20(%rcx),%rdx
mov    %rdx,%rsi
shr    $0x5,%rsi
add    $0x1,%rsi
mov    %esi,%r8d
and    $0x3,%r8d
cmp    $0x60,%rdx
jae    161f <basex_authenticate+0x46f>
xor    %edi,%edi
jmp    1699 <basex_authenticate+0x4e9>
mov    %r11d,%esi
and    $0xffffffe0,%esi
lea    -0x20(%rsi),%rcx
mov    %rcx,%rax
shr    $0x5,%rax
add    $0x1,%rax
mov    %eax,%r9d
and    $0x3,%r9d
cmp    $0x60,%rcx
jae    1720 <basex_authenticate+0x570>
xor    %edi,%edi
jmp    1790 <basex_authenticate+0x5e0>
and    $0xfffffffffffffffc,%rsi
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
nop
movups (%r12,%rdi,1),%xmm0
movups 0x10(%r12,%rdi,1),%xmm1
movaps %xmm0,0x0(%r13,%rdi,1)
movaps %xmm1,0x10(%r13,%rdi,1)
movups 0x20(%r12,%rdi,1),%xmm0
movups 0x30(%r12,%rdi,1),%xmm1
movaps %xmm0,0x20(%r13,%rdi,1)
movaps %xmm1,0x30(%r13,%rdi,1)
movups 0x40(%r12,%rdi,1),%xmm0
movups 0x50(%r12,%rdi,1),%xmm1
movaps %xmm0,0x40(%r13,%rdi,1)
movaps %xmm1,0x50(%r13,%rdi,1)
movups 0x60(%r12,%rdi,1),%xmm0
movups 0x70(%r12,%rdi,1),%xmm1
movaps %xmm0,0x60(%r13,%rdi,1)
movaps %xmm1,0x70(%r13,%rdi,1)
sub    $0xffffffffffffff80,%rdi
add    $0xfffffffffffffffc,%rsi
jne    1630 <basex_authenticate+0x480>
test   %r8,%r8
je     16db <basex_authenticate+0x52b>
lea    (%rdi,%r13,1),%rsi
add    $0x10,%rsi
add    %r12,%rdi
add    $0x10,%rdi
shl    $0x5,%r8
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movups -0x10(%rdi,%rdx,1),%xmm0
movups (%rdi,%rdx,1),%xmm1
movaps %xmm0,-0x10(%rsi,%rdx,1)
movaps %xmm1,(%rsi,%rdx,1)
add    $0x20,%rdx
cmp    %rdx,%r8
jne    16c0 <basex_authenticate+0x510>
cmp    %r9,%rcx
je     1444 <basex_authenticate+0x294>
test   $0x18,%r9b
je     13d9 <basex_authenticate+0x229>
mov    %rcx,%rdx
mov    %r9d,%ecx
and    $0xfffffff8,%ecx
nopw   0x0(%rax,%rax,1)
mov    (%r12,%rdx,1),%rsi
mov    %rsi,0x0(%r13,%rdx,1)
add    $0x8,%rdx
cmp    %rdx,%rcx
jne    1700 <basex_authenticate+0x550>
cmp    %r9,%rcx
je     1444 <basex_authenticate+0x294>
jmp    13d9 <basex_authenticate+0x229>
and    $0xfffffffffffffffc,%rax
lea    (%rdx,%r13,1),%rcx
add    $0x70,%rcx
xor    %edi,%edi
xchg   %ax,%ax
movups (%r15,%rdi,1),%xmm0
movups 0x10(%r15,%rdi,1),%xmm1
movups %xmm0,-0x70(%rcx,%rdi,1)
movups %xmm1,-0x60(%rcx,%rdi,1)
movups 0x20(%r15,%rdi,1),%xmm0
movups 0x30(%r15,%rdi,1),%xmm1
movups %xmm0,-0x50(%rcx,%rdi,1)
movups %xmm1,-0x40(%rcx,%rdi,1)
movups 0x40(%r15,%rdi,1),%xmm0
movups 0x50(%r15,%rdi,1),%xmm1
movups %xmm0,-0x30(%rcx,%rdi,1)
movups %xmm1,-0x20(%rcx,%rdi,1)
movups 0x60(%r15,%rdi,1),%xmm0
movups 0x70(%r15,%rdi,1),%xmm1
movups %xmm0,-0x10(%rcx,%rdi,1)
movups %xmm1,(%rcx,%rdi,1)
sub    $0xffffffffffffff80,%rdi
add    $0xfffffffffffffffc,%rax
jne    1730 <basex_authenticate+0x580>
test   %r9,%r9
je     17cb <basex_authenticate+0x61b>
lea    (%rdi,%r15,1),%rax
add    $0x10,%rax
add    %rdx,%rdi
lea    (%rdi,%r13,1),%rcx
add    $0x10,%rcx
shl    $0x5,%r9
xor    %edi,%edi
xchg   %ax,%ax
movups -0x10(%rax,%rdi,1),%xmm0
movups (%rax,%rdi,1),%xmm1
movups %xmm0,-0x10(%rcx,%rdi,1)
movups %xmm1,(%rcx,%rdi,1)
add    $0x20,%rdi
cmp    %rdi,%r9
jne    17b0 <basex_authenticate+0x600>
cmp    %r11,%rsi
je     14fb <basex_authenticate+0x34b>
test   $0x18,%r11b
je     180f <basex_authenticate+0x65f>
mov    %rsi,%rax
mov    %r11d,%esi
and    $0xfffffff8,%esi
add    %rsi,%rdx
cs nopw 0x0(%rax,%rax,1)
mov    (%r15,%rax,1),%rcx
mov    %rcx,(%r10,%rax,1)
add    $0x8,%rax
cmp    %rax,%rsi
jne    17f0 <basex_authenticate+0x640>
cmp    %r11,%rsi
jne    147e <basex_authenticate+0x2ce>
jmp    14fb <basex_authenticate+0x34b>
add    %rsi,%rdx
jmp    147e <basex_authenticate+0x2ce>

LLVM IR (-O0):
@BUFSIZ = global i32 0
@.str = [26 x i8] c"Reading timestamp failed.\00"
@.str.1 = [34 x i8] c"Sending username failed. %d != %d\00"
@.str.2 = [37 x i8] c"md5 computation for password failed.\00"
@.str.3 = [49 x i8] c"md5 computation for password + timestamp failed.\00"
@.str.4 = [28 x i8] c"Sending credentials failed.\00"
@.str.5 = [40 x i8] c"Reading authentification status failed.\00"
@.str.6 = [24 x i8] c"Authentification failed\00"
define i32 @basex_authenticate(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i8*
%22 = alloca i64
%23 = alloca i32
%24 = alloca i32
%25 = alloca i64
%26 = alloca i32
%27 = alloca i8*
%28 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%29 = load i32, i32* @BUFSIZ
%30 = zext i32 %29 to i64
%31 = call i8* @llvm.stacksave()
store i8* %31, i8** %8
%32 = alloca i8, i64 %30
store i64 %30, i64* %9
%33 = load i32, i32* @BUFSIZ
%34 = call i32 @memset(i8* %32, i32 0, i32 %33)
%35 = load i32, i32* %5
%36 = bitcast i8* %32 to i8**
%37 = load i32, i32* @BUFSIZ
%38 = call i32 @read(i32 %35, i8** %36, i32 %37)
store i32 %38, i32* %12
%39 = load i32, i32* %12
%40 = icmp eq i32 %39, -1
br i1 %40, label %41, label %43
41: ; preds = %3
%42 = call i32 (i8*, ...) @warnx(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %4
store i32 1, i32* %14
br label %234
43: ; preds = %3
%44 = call i32 @strlen(i8* %32)
store i32 %44, i32* %11
%45 = load i8*, i8** %6
%46 = call i32 @strlen(i8* %45)
%47 = add nsw i32 %46, 1
store i32 %47, i32* %15
%48 = load i32, i32* %5
%49 = load i8*, i8** %6
%50 = load i32, i32* %15
%51 = call i32 @write(i32 %48, i8* %49, i32 %50)
store i32 %51, i32* %12
%52 = load i32, i32* %12
%53 = icmp eq i32 %52, -1
br i1 %53, label %58, label %54
54: ; preds = %43
%55 = load i32, i32* %12
%56 = load i32, i32* %15
%57 = icmp ne i32 %55, %56
br i1 %57, label %58, label %62
58: ; preds = %54, %43
%59 = load i32, i32* %12
%60 = load i32, i32* %15
%61 = call i32 (i8*, ...) @warnx(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %59, i32 %60)
store i32 -1, i32* %4
store i32 1, i32* %14
br label %234
62: ; preds = %54
%63 = call i8* @strchr(i8* %32, i8 signext 58)
store i8* %63, i8** %16
%64 = load i8*, i8** %16
%65 = icmp ne i8* %64, null
br i1 %65, label %74, label %66
66: ; preds = %62
store i8* %32, i8** %17
%67 = load i8*, i8** %7
%68 = call i8* @md5(i8* %67)
store i8* %68, i8** %10
%69 = load i8*, i8** %10
%70 = icmp eq i8* %69, null
br i1 %70, label %71, label %73
71: ; preds = %66
%72 = call i32 (i8*, ...) @warnx(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %4
store i32 1, i32* %14
br label %234
73: ; preds = %66
br label %147
74: ; preds = %62
%75 = load i8*, i8** %16
%76 = getelementptr inbounds i8, i8* %75, i64 1
store i8* %76, i8** %17
%77 = load i8*, i8** %6
%78 = call i32 @strlen(i8* %77)
store i32 %78, i32* %18
%79 = load i8*, i8** %7
%80 = call i32 @strlen(i8* %79)
store i32 %80, i32* %19
%81 = load i8*, i8** %16
%82 = ptrtoint i8* %81 to i64
%83 = ptrtoint i8* %32 to i64
%84 = sub i64 %82, %83
%85 = trunc i64 %84 to i32
store i32 %85, i32* %20
%86 = load i32, i32* %18
%87 = load i32, i32* %20
%88 = add nsw i32 %86, %87
%89 = load i32, i32* %19
%90 = add nsw i32 %88, %89
%91 = add nsw i32 %90, 3
%92 = zext i32 %91 to i64
%93 = call i8* @llvm.stacksave()
store i8* %93, i8** %21
%94 = alloca i8, i64 %92
store i64 %92, i64* %22
%95 = load i8*, i8** %6
%96 = load i32, i32* %18
%97 = call i32 @strncpy(i8* %94, i8* %95, i32 %96)
%98 = load i32, i32* %18
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds i8, i8* %94, i64 %99
store i8 58, i8* %100
%101 = load i32, i32* %18
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds i8, i8* %94, i64 %102
%104 = getelementptr inbounds i8, i8* %103, i64 1
%105 = load i32, i32* %20
%106 = call i32 @strncpy(i8* %104, i8* %32, i32 %105)
%107 = load i32, i32* %18
%108 = add nsw i32 %107, 1
%109 = load i32, i32* %20
%110 = add nsw i32 %108, %109
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds i8, i8* %94, i64 %111
store i8 58, i8* %112
%113 = load i32, i32* %18
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds i8, i8* %94, i64 %114
%116 = getelementptr inbounds i8, i8* %115, i64 1
%117 = load i32, i32* %20
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds i8, i8* %116, i64 %118
%120 = getelementptr inbounds i8, i8* %119, i64 1
%121 = load i8*, i8** %7
%122 = load i32, i32* %19
%123 = call i32 @strncpy(i8* %120, i8* %121, i32 %122)
%124 = load i32, i32* %18
%125 = add nsw i32 %124, 1
%126 = load i32, i32* %20
%127 = add nsw i32 %125, %126
%128 = add nsw i32 %127, 1
%129 = load i32, i32* %19
%130 = add nsw i32 %128, %129
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds i8, i8* %94, i64 %131
store i8 0, i8* %132
%133 = call i8* @md5(i8* %94)
store i8* %133, i8** %10
%134 = load i8*, i8** %10
%135 = icmp eq i8* %134, null
br i1 %135, label %136, label %138
136: ; preds = %74
%137 = call i32 (i8*, ...) @warnx(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %4
store i32 1, i32* %14
br label %143
138: ; preds = %74
%139 = load i32, i32* %11
%140 = load i32, i32* %20
%141 = sub nsw i32 %139, %140
%142 = sub nsw i32 %141, 1
store i32 %142, i32* %11
store i32 0, i32* %14
br label %143
143: ; preds = %138, %136
%144 = load i8*, i8** %21
%145 = load i32, i32* %14
switch i32 %145, label %234 [
i32 0, label %146
]
146: ; preds = %143
br label %147
147: ; preds = %146, %73
%148 = load i8*, i8** %10
%149 = call i32 @strlen(i8* %148)
store i32 %149, i32* %23
%150 = load i32, i32* %23
%151 = load i32, i32* %11
%152 = add nsw i32 %150, %151
%153 = add nsw i32 %152, 1
store i32 %153, i32* %24
%154 = load i32, i32* %24
%155 = zext i32 %154 to i64
%156 = alloca i8, i64 %155
store i64 %155, i64* %25
%157 = trunc i64 %155 to i32
%158 = call i32 @memset(i8* %156, i32 0, i32 %157)
store i32 0, i32* %13
br label %159
159: ; preds = %172, %147
%160 = load i32, i32* %13
%161 = load i32, i32* %23
%162 = icmp slt i32 %160, %161
br i1 %162, label %163, label %175
163: ; preds = %159
%164 = load i8*, i8** %10
%165 = load i32, i32* %13
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds i8, i8* %164, i64 %166
%168 = load i8, i8* %167
%169 = load i32, i32* %13
%170 = sext i32 %169 to i64
%171 = getelementptr inbounds i8, i8* %156, i64 %170
store i8 %168, i8* %171
br label %172
172: ; preds = %163
%173 = load i32, i32* %13
%174 = add nsw i32 %173, 1
store i32 %174, i32* %13
br label %159
175: ; preds = %159
%176 = load i32, i32* %23
store i32 %176, i32* %26
store i32 0, i32* %13
br label %177
177: ; preds = %190, %175
%178 = load i32, i32* %13
%179 = load i32, i32* %11
%180 = icmp slt i32 %178, %179
br i1 %180, label %181, label %195
181: ; preds = %177
%182 = load i8*, i8** %17
%183 = load i32, i32* %13
%184 = sext i32 %183 to i64
%185 = getelementptr inbounds i8, i8* %182, i64 %184
%186 = load i8, i8* %185
%187 = load i32, i32* %26
%188 = sext i32 %187 to i64
%189 = getelementptr inbounds i8, i8* %156, i64 %188
store i8 %186, i8* %189
br label %190
190: ; preds = %181
%191 = load i32, i32* %13
%192 = add nsw i32 %191, 1
store i32 %192, i32* %13
%193 = load i32, i32* %26
%194 = add nsw i32 %193, 1
store i32 %194, i32* %26
br label %177
195: ; preds = %177
%196 = load i32, i32* %24
%197 = sub nsw i32 %196, 1
%198 = sext i32 %197 to i64
%199 = getelementptr inbounds i8, i8* %156, i64 %198
store i8 0, i8* %199
%200 = call i8* @md5(i8* %156)
store i8* %200, i8** %27
%201 = load i8*, i8** %27
%202 = icmp eq i8* %201, null
br i1 %202, label %203, label %205
203: ; preds = %195
%204 = call i32 (i8*, ...) @warnx(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %4
store i32 1, i32* %14
br label %234
205: ; preds = %195
%206 = load i8*, i8** %27
%207 = call i32 @strlen(i8* %206)
store i32 %207, i32* %28
%208 = load i32, i32* %5
%209 = load i8*, i8** %27
%210 = load i32, i32* %28
%211 = add nsw i32 %210, 1
%212 = call i32 @send_db(i32 %208, i8* %209, i32 %211)
store i32 %212, i32* %12
%213 = load i32, i32* %12
%214 = icmp eq i32 %213, -1
br i1 %214, label %215, label %217
215: ; preds = %205
%216 = call i32 (i8*, ...) @warnx(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %4
store i32 1, i32* %14
br label %234
217: ; preds = %205
%218 = load i8*, i8** %10
%219 = call i32 @free(i8* %218)
%220 = load i8*, i8** %27
%221 = call i32 @free(i8* %220)
%222 = load i32, i32* %5
%223 = call i32 @basex_status(i32 %222)
store i32 %223, i32* %12
%224 = load i32, i32* %12
%225 = icmp eq i32 %224, -1
br i1 %225, label %226, label %228
226: ; preds = %217
%227 = call i32 (i8*, ...) @warnx(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %4
store i32 1, i32* %14
br label %234
228: ; preds = %217
%229 = load i32, i32* %12
%230 = icmp ne i32 %229, 0
br i1 %230, label %231, label %233
231: ; preds = %228
%232 = call i32 (i8*, ...) @warnx(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
store i32 -1, i32* %4
store i32 1, i32* %14
br label %234
233: ; preds = %228
store i32 0, i32* %4
store i32 1, i32* %14
br label %234
234: ; preds = %233, %231, %226, %215, %203, %143, %71, %58, %41
%235 = load i8*, i8** %8
%236 = load i32, i32* %4
ret i32 %236
}

LLVM IR (-O2):
@BUFSIZ = global i32 0
@.str = [26 x i8] c"Reading timestamp failed.\00"
@.str.1 = [34 x i8] c"Sending username failed. %d != %d\00"
@.str.2 = [37 x i8] c"md5 computation for password failed.\00"
@.str.3 = [49 x i8] c"md5 computation for password + timestamp failed.\00"
@.str.4 = [28 x i8] c"Sending credentials failed.\00"
@.str.5 = [40 x i8] c"Reading authentification status failed.\00"
@.str.6 = [24 x i8] c"Authentification failed\00"
define i32 @basex_authenticate(i32 %0, i8* %1, i8* %2) {
%4 = load i32, i32* @BUFSIZ
%5 = zext i32 %4 to i64
%6 = alloca i8, i64 %5
%7 = call i32 @memset(i8* %6, i32 0, i32 %4)
%8 = bitcast i8* %6 to i8**
%9 = load i32, i32* @BUFSIZ
%10 = call i32 @read(i32 %0, i8** %8, i32 %9)
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = call i32 (i8*, ...) @warnx(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %413
14: ; preds = %3
%15 = call i32 @strlen(i8* %6)
%16 = call i32 @strlen(i8* %1)
%17 = add nsw i32 %16, 1
%18 = call i32 @write(i32 %0, i8* %1, i32 %17)
%19 = icmp ne i32 %18, -1
%20 = icmp eq i32 %18, %17
%21 = and i1 %19, %20
br i1 %21, label %24, label %22
22: ; preds = %14
%23 = call i32 (i8*, ...) @warnx(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %18, i32 %17)
br label %413
24: ; preds = %14
%25 = call i8* @strchr(i8* %6, i8 signext 58)
%26 = icmp eq i8* %25, null
br i1 %26, label %27, label %32
27: ; preds = %24
%28 = call i8* @md5(i8* %2)
%29 = icmp eq i8* %28, null
br i1 %29, label %30, label %70
30: ; preds = %27
%31 = call i32 (i8*, ...) @warnx(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
br label %413
32: ; preds = %24
%33 = call i32 @strlen(i8* %1)
%34 = call i32 @strlen(i8* %2)
%35 = ptrtoint i8* %25 to i64
%36 = ptrtoint i8* %6 to i64
%37 = sub i64 %35, %36
%38 = trunc i64 %37 to i32
%39 = add i32 %33, %38
%40 = add i32 %39, 3
%41 = add i32 %40, %34
%42 = zext i32 %41 to i64
%43 = call i8* @llvm.stacksave()
%44 = alloca i8, i64 %42
%45 = call i32 @strncpy(i8* %44, i8* %1, i32 %33)
%46 = sext i32 %33 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
store i8 58, i8* %47
%48 = getelementptr inbounds i8, i8* %47, i64 1
%49 = call i32 @strncpy(i8* %48, i8* %6, i32 %38)
%50 = add i32 %39, 1
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8, i8* %44, i64 %51
store i8 58, i8* %52
%53 = shl i64 %37, 32
%54 = ashr exact i64 %53, 32
%55 = getelementptr inbounds i8, i8* %48, i64 %54
%56 = getelementptr inbounds i8, i8* %55, i64 1
%57 = call i32 @strncpy(i8* %56, i8* %2, i32 %34)
%58 = add i32 %34, 1
%59 = add i32 %58, %50
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8, i8* %44, i64 %60
store i8 0, i8* %61
%62 = call i8* @md5(i8* %44)
%63 = icmp eq i8* %62, null
br i1 %63, label %64, label %66
64: ; preds = %32
%65 = call i32 (i8*, ...) @warnx(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
br label %413
66: ; preds = %32
%67 = getelementptr inbounds i8, i8* %25, i64 1
%68 = xor i32 %38, -1
%69 = add i32 %15, %68
br label %70
70: ; preds = %66, %27
%71 = phi i8* [ %67, %66 ], [ %6, %27 ]
%72 = phi i32 [ %69, %66 ], [ %15, %27 ]
%73 = phi i8* [ %62, %66 ], [ %28, %27 ]
%74 = call i32 @strlen(i8* %73)
%75 = add nsw i32 %74, %72
%76 = add nsw i32 %75, 1
%77 = zext i32 %76 to i64
%78 = alloca i8, i64 %77
%79 = call i32 @memset(i8* %78, i32 0, i32 %76)
%80 = icmp sgt i32 %74, 0
br i1 %80, label %81, label %206
81: ; preds = %70
%82 = zext i32 %74 to i64
%83 = icmp ult i32 %74, 8
br i1 %83, label %188, label %84
84: ; preds = %81
%85 = getelementptr i8, i8* %78, i64 %82
%86 = getelementptr i8, i8* %73, i64 %82
%87 = icmp ult i8* %78, %86
%88 = icmp ult i8* %73, %85
%89 = and i1 %87, %88
br i1 %89, label %188, label %90
90: ; preds = %84
%91 = icmp ult i32 %74, 32
br i1 %91, label %174, label %92
92: ; preds = %90
%93 = and i64 %82, 4294967264
%94 = add nsw i64 %93, -32
%95 = lshr exact i64 %94, 5
%96 = add nuw nsw i64 %95, 1
%97 = and i64 %96, 3
%98 = icmp ult i64 %94, 96
br i1 %98, label %150, label %99
99: ; preds = %92
%100 = and i64 %96, 1152921504606846972
br label %101
101: ; preds = %101, %99
%102 = phi i64 [ 0, %99 ], [ %147, %101 ]
%103 = phi i64 [ 0, %99 ], [ %148, %101 ]
%104 = getelementptr inbounds i8, i8* %73, i64 %102
%105 = bitcast i8* %104 to <16 x i8>*
%106 = load <16 x i8>, <16 x i8>* %105
%107 = getelementptr inbounds i8, i8* %104, i64 16
%108 = bitcast i8* %107 to <16 x i8>*
%109 = load <16 x i8>, <16 x i8>* %108
%110 = getelementptr inbounds i8, i8* %78, i64 %102
%111 = bitcast i8* %110 to <16 x i8>*
store <16 x i8> %106, <16 x i8>* %111
%112 = getelementptr inbounds i8, i8* %110, i64 16
%113 = bitcast i8* %112 to <16 x i8>*
store <16 x i8> %109, <16 x i8>* %113
%114 = or i64 %102, 32
%115 = getelementptr inbounds i8, i8* %73, i64 %114
%116 = bitcast i8* %115 to <16 x i8>*
%117 = load <16 x i8>, <16 x i8>* %116
%118 = getelementptr inbounds i8, i8* %115, i64 16
%119 = bitcast i8* %118 to <16 x i8>*
%120 = load <16 x i8>, <16 x i8>* %119
%121 = getelementptr inbounds i8, i8* %78, i64 %114
%122 = bitcast i8* %121 to <16 x i8>*
store <16 x i8> %117, <16 x i8>* %122
%123 = getelementptr inbounds i8, i8* %121, i64 16
%124 = bitcast i8* %123 to <16 x i8>*
store <16 x i8> %120, <16 x i8>* %124
%125 = or i64 %102, 64
%126 = getelementptr inbounds i8, i8* %73, i64 %125
%127 = bitcast i8* %126 to <16 x i8>*
%128 = load <16 x i8>, <16 x i8>* %127
%129 = getelementptr inbounds i8, i8* %126, i64 16
%130 = bitcast i8* %129 to <16 x i8>*
%131 = load <16 x i8>, <16 x i8>* %130
%132 = getelementptr inbounds i8, i8* %78, i64 %125
%133 = bitcast i8* %132 to <16 x i8>*
store <16 x i8> %128, <16 x i8>* %133
%134 = getelementptr inbounds i8, i8* %132, i64 16
%135 = bitcast i8* %134 to <16 x i8>*
store <16 x i8> %131, <16 x i8>* %135
%136 = or i64 %102, 96
%137 = getelementptr inbounds i8, i8* %73, i64 %136
%138 = bitcast i8* %137 to <16 x i8>*
%139 = load <16 x i8>, <16 x i8>* %138
%140 = getelementptr inbounds i8, i8* %137, i64 16
%141 = bitcast i8* %140 to <16 x i8>*
%142 = load <16 x i8>, <16 x i8>* %141
%143 = getelementptr inbounds i8, i8* %78, i64 %136
%144 = bitcast i8* %143 to <16 x i8>*
store <16 x i8> %139, <16 x i8>* %144
%145 = getelementptr inbounds i8, i8* %143, i64 16
%146 = bitcast i8* %145 to <16 x i8>*
store <16 x i8> %142, <16 x i8>* %146
%147 = add nuw i64 %102, 128
%148 = add i64 %103, 4
%149 = icmp eq i64 %148, %100
br i1 %149, label %150, label %101
150: ; preds = %101, %92
%151 = phi i64 [ 0, %92 ], [ %147, %101 ]
%152 = icmp eq i64 %97, 0
br i1 %152, label %169, label %153
153: ; preds = %150, %153
%154 = phi i64 [ %166, %153 ], [ %151, %150 ]
%155 = phi i64 [ %167, %153 ], [ 0, %150 ]
%156 = getelementptr inbounds i8, i8* %73, i64 %154
%157 = bitcast i8* %156 to <16 x i8>*
%158 = load <16 x i8>, <16 x i8>* %157
%159 = getelementptr inbounds i8, i8* %156, i64 16
%160 = bitcast i8* %159 to <16 x i8>*
%161 = load <16 x i8>, <16 x i8>* %160
%162 = getelementptr inbounds i8, i8* %78, i64 %154
%163 = bitcast i8* %162 to <16 x i8>*
store <16 x i8> %158, <16 x i8>* %163
%164 = getelementptr inbounds i8, i8* %162, i64 16
%165 = bitcast i8* %164 to <16 x i8>*
store <16 x i8> %161, <16 x i8>* %165
%166 = add nuw i64 %154, 32
%167 = add i64 %155, 1
%168 = icmp eq i64 %167, %97
br i1 %168, label %169, label %153
169: ; preds = %153, %150
%170 = icmp eq i64 %93, %82
br i1 %170, label %206, label %171
171: ; preds = %169
%172 = and i64 %82, 24
%173 = icmp eq i64 %172, 0
br i1 %173, label %188, label %174
174: ; preds = %90, %171
%175 = phi i64 [ %93, %171 ], [ 0, %90 ]
%176 = and i64 %82, 4294967288
br label %177
177: ; preds = %177, %174
%178 = phi i64 [ %175, %174 ], [ %184, %177 ]
%179 = getelementptr inbounds i8, i8* %73, i64 %178
%180 = bitcast i8* %179 to <8 x i8>*
%181 = load <8 x i8>, <8 x i8>* %180
%182 = getelementptr inbounds i8, i8* %78, i64 %178
%183 = bitcast i8* %182 to <8 x i8>*
store <8 x i8> %181, <8 x i8>* %183
%184 = add nuw i64 %178, 8
%185 = icmp eq i64 %184, %176
br i1 %185, label %186, label %177
186: ; preds = %177
%187 = icmp eq i64 %176, %82
br i1 %187, label %206, label %188
188: ; preds = %84, %81, %171, %186
%189 = phi i64 [ 0, %81 ], [ 0, %84 ], [ %93, %171 ], [ %176, %186 ]
%190 = xor i64 %189, -1
%191 = add nsw i64 %190, %82
%192 = and i64 %82, 3
%193 = icmp eq i64 %192, 0
br i1 %193, label %203, label %194
194: ; preds = %188, %194
%195 = phi i64 [ %200, %194 ], [ %189, %188 ]
%196 = phi i64 [ %201, %194 ], [ 0, %188 ]
%197 = getelementptr inbounds i8, i8* %73, i64 %195
%198 = load i8, i8* %197
%199 = getelementptr inbounds i8, i8* %78, i64 %195
store i8 %198, i8* %199
%200 = add nuw nsw i64 %195, 1
%201 = add i64 %196, 1
%202 = icmp eq i64 %201, %192
br i1 %202, label %203, label %194
203: ; preds = %194, %188
%204 = phi i64 [ %189, %188 ], [ %200, %194 ]
%205 = icmp ult i64 %191, 3
br i1 %205, label %206, label %348
206: ; preds = %203, %348, %169, %186, %70
%207 = icmp sgt i32 %72, 0
br i1 %207, label %208, label %391
208: ; preds = %206
%209 = sext i32 %74 to i64
%210 = zext i32 %72 to i64
%211 = icmp ult i32 %72, 8
br i1 %211, label %326, label %212
212: ; preds = %208
%213 = getelementptr i8, i8* %78, i64 %209
%214 = add nsw i64 %209, %210
%215 = getelementptr i8, i8* %78, i64 %214
%216 = getelementptr i8, i8* %71, i64 %210
%217 = icmp ult i8* %213, %216
%218 = icmp ult i8* %71, %215
%219 = and i1 %217, %218
br i1 %219, label %326, label %220
220: ; preds = %212
%221 = icmp ult i32 %72, 32
br i1 %221, label %310, label %222
222: ; preds = %220
%223 = and i64 %210, 4294967264
%224 = add nsw i64 %223, -32
%225 = lshr exact i64 %224, 5
%226 = add nuw nsw i64 %225, 1
%227 = and i64 %226, 3
%228 = icmp ult i64 %224, 96
br i1 %228, label %284, label %229
229: ; preds = %222
%230 = and i64 %226, 1152921504606846972
br label %231
231: ; preds = %231, %229
%232 = phi i64 [ 0, %229 ], [ %281, %231 ]
%233 = phi i64 [ 0, %229 ], [ %282, %231 ]
%234 = add i64 %232, %209
%235 = getelementptr inbounds i8, i8* %71, i64 %232
%236 = bitcast i8* %235 to <16 x i8>*
%237 = load <16 x i8>, <16 x i8>* %236
%238 = getelementptr inbounds i8, i8* %235, i64 16
%239 = bitcast i8* %238 to <16 x i8>*
%240 = load <16 x i8>, <16 x i8>* %239
%241 = getelementptr inbounds i8, i8* %78, i64 %234
%242 = bitcast i8* %241 to <16 x i8>*
store <16 x i8> %237, <16 x i8>* %242
%243 = getelementptr inbounds i8, i8* %241, i64 16
%244 = bitcast i8* %243 to <16 x i8>*
store <16 x i8> %240, <16 x i8>* %244
%245 = or i64 %232, 32
%246 = add i64 %245, %209
%247 = getelementptr inbounds i8, i8* %71, i64 %245
%248 = bitcast i8* %247 to <16 x i8>*
%249 = load <16 x i8>, <16 x i8>* %248
%250 = getelementptr inbounds i8, i8* %247, i64 16
%251 = bitcast i8* %250 to <16 x i8>*
%252 = load <16 x i8>, <16 x i8>* %251
%253 = getelementptr inbounds i8, i8* %78, i64 %246
%254 = bitcast i8* %253 to <16 x i8>*
store <16 x i8> %249, <16 x i8>* %254
%255 = getelementptr inbounds i8, i8* %253, i64 16
%256 = bitcast i8* %255 to <16 x i8>*
store <16 x i8> %252, <16 x i8>* %256
%257 = or i64 %232, 64
%258 = add i64 %257, %209
%259 = getelementptr inbounds i8, i8* %71, i64 %257
%260 = bitcast i8* %259 to <16 x i8>*
%261 = load <16 x i8>, <16 x i8>* %260
%262 = getelementptr inbounds i8, i8* %259, i64 16
%263 = bitcast i8* %262 to <16 x i8>*
%264 = load <16 x i8>, <16 x i8>* %263
%265 = getelementptr inbounds i8, i8* %78, i64 %258
%266 = bitcast i8* %265 to <16 x i8>*
store <16 x i8> %261, <16 x i8>* %266
%267 = getelementptr inbounds i8, i8* %265, i64 16
%268 = bitcast i8* %267 to <16 x i8>*
store <16 x i8> %264, <16 x i8>* %268
%269 = or i64 %232, 96
%270 = add i64 %269, %209
%271 = getelementptr inbounds i8, i8* %71, i64 %269
%272 = bitcast i8* %271 to <16 x i8>*
%273 = load <16 x i8>, <16 x i8>* %272
%274 = getelementptr inbounds i8, i8* %271, i64 16
%275 = bitcast i8* %274 to <16 x i8>*
%276 = load <16 x i8>, <16 x i8>* %275
%277 = getelementptr inbounds i8, i8* %78, i64 %270
%278 = bitcast i8* %277 to <16 x i8>*
store <16 x i8> %273, <16 x i8>* %278
%279 = getelementptr inbounds i8, i8* %277, i64 16
%280 = bitcast i8* %279 to <16 x i8>*
store <16 x i8> %276, <16 x i8>* %280
%281 = add nuw i64 %232, 128
%282 = add i64 %233, 4
%283 = icmp eq i64 %282, %230
br i1 %283, label %284, label %231
284: ; preds = %231, %222
%285 = phi i64 [ 0, %222 ], [ %281, %231 ]
%286 = icmp eq i64 %227, 0
br i1 %286, label %304, label %287
287: ; preds = %284, %287
%288 = phi i64 [ %301, %287 ], [ %285, %284 ]
%289 = phi i64 [ %302, %287 ], [ 0, %284 ]
%290 = add i64 %288, %209
%291 = getelementptr inbounds i8, i8* %71, i64 %288
%292 = bitcast i8* %291 to <16 x i8>*
%293 = load <16 x i8>, <16 x i8>* %292
%294 = getelementptr inbounds i8, i8* %291, i64 16
%295 = bitcast i8* %294 to <16 x i8>*
%296 = load <16 x i8>, <16 x i8>* %295
%297 = getelementptr inbounds i8, i8* %78, i64 %290
%298 = bitcast i8* %297 to <16 x i8>*
store <16 x i8> %293, <16 x i8>* %298
%299 = getelementptr inbounds i8, i8* %297, i64 16
%300 = bitcast i8* %299 to <16 x i8>*
store <16 x i8> %296, <16 x i8>* %300
%301 = add nuw i64 %288, 32
%302 = add i64 %289, 1
%303 = icmp eq i64 %302, %227
br i1 %303, label %304, label %287
304: ; preds = %287, %284
%305 = icmp eq i64 %223, %210
br i1 %305, label %391, label %306
306: ; preds = %304
%307 = add nsw i64 %223, %209
%308 = and i64 %210, 24
%309 = icmp eq i64 %308, 0
br i1 %309, label %326, label %310
310: ; preds = %220, %306
%311 = phi i64 [ %223, %306 ], [ 0, %220 ]
%312 = and i64 %210, 4294967288
%313 = add nsw i64 %312, %209
br label %314
314: ; preds = %314, %310
%315 = phi i64 [ %311, %310 ], [ %322, %314 ]
%316 = add i64 %315, %209
%317 = getelementptr inbounds i8, i8* %71, i64 %315
%318 = bitcast i8* %317 to <8 x i8>*
%319 = load <8 x i8>, <8 x i8>* %318
%320 = getelementptr inbounds i8, i8* %78, i64 %316
%321 = bitcast i8* %320 to <8 x i8>*
store <8 x i8> %319, <8 x i8>* %321
%322 = add nuw i64 %315, 8
%323 = icmp eq i64 %322, %312
br i1 %323, label %324, label %314
324: ; preds = %314
%325 = icmp eq i64 %312, %210
br i1 %325, label %391, label %326
326: ; preds = %212, %208, %306, %324
%327 = phi i64 [ 0, %208 ], [ 0, %212 ], [ %223, %306 ], [ %312, %324 ]
%328 = phi i64 [ %209, %208 ], [ %209, %212 ], [ %307, %306 ], [ %313, %324 ]
%329 = xor i64 %327, -1
%330 = add nsw i64 %329, %210
%331 = and i64 %210, 3
%332 = icmp eq i64 %331, 0
br i1 %332, label %344, label %333
333: ; preds = %326, %333
%334 = phi i64 [ %340, %333 ], [ %327, %326 ]
%335 = phi i64 [ %341, %333 ], [ %328, %326 ]
%336 = phi i64 [ %342, %333 ], [ 0, %326 ]
%337 = getelementptr inbounds i8, i8* %71, i64 %334
%338 = load i8, i8* %337
%339 = getelementptr inbounds i8, i8* %78, i64 %335
store i8 %338, i8* %339
%340 = add nuw nsw i64 %334, 1
%341 = add nsw i64 %335, 1
%342 = add i64 %336, 1
%343 = icmp eq i64 %342, %331
br i1 %343, label %344, label %333
344: ; preds = %333, %326
%345 = phi i64 [ %327, %326 ], [ %340, %333 ]
%346 = phi i64 [ %328, %326 ], [ %341, %333 ]
%347 = icmp ult i64 %330, 3
br i1 %347, label %391, label %367
348: ; preds = %203, %348
%349 = phi i64 [ %365, %348 ], [ %204, %203 ]
%350 = getelementptr inbounds i8, i8* %73, i64 %349
%351 = load i8, i8* %350
%352 = getelementptr inbounds i8, i8* %78, i64 %349
store i8 %351, i8* %352
%353 = add nuw nsw i64 %349, 1
%354 = getelementptr inbounds i8, i8* %73, i64 %353
%355 = load i8, i8* %354
%356 = getelementptr inbounds i8, i8* %78, i64 %353
store i8 %355, i8* %356
%357 = add nuw nsw i64 %349, 2
%358 = getelementptr inbounds i8, i8* %73, i64 %357
%359 = load i8, i8* %358
%360 = getelementptr inbounds i8, i8* %78, i64 %357
store i8 %359, i8* %360
%361 = add nuw nsw i64 %349, 3
%362 = getelementptr inbounds i8, i8* %73, i64 %361
%363 = load i8, i8* %362
%364 = getelementptr inbounds i8, i8* %78, i64 %361
store i8 %363, i8* %364
%365 = add nuw nsw i64 %349, 4
%366 = icmp eq i64 %365, %82
br i1 %366, label %206, label %348
367: ; preds = %344, %367
%368 = phi i64 [ %388, %367 ], [ %345, %344 ]
%369 = phi i64 [ %389, %367 ], [ %346, %344 ]
%370 = getelementptr inbounds i8, i8* %71, i64 %368
%371 = load i8, i8* %370
%372 = getelementptr inbounds i8, i8* %78, i64 %369
store i8 %371, i8* %372
%373 = add nuw nsw i64 %368, 1
%374 = add nsw i64 %369, 1
%375 = getelementptr inbounds i8, i8* %71, i64 %373
%376 = load i8, i8* %375
%377 = getelementptr inbounds i8, i8* %78, i64 %374
store i8 %376, i8* %377
%378 = add nuw nsw i64 %368, 2
%379 = add nsw i64 %369, 2
%380 = getelementptr inbounds i8, i8* %71, i64 %378
%381 = load i8, i8* %380
%382 = getelementptr inbounds i8, i8* %78, i64 %379
store i8 %381, i8* %382
%383 = add nuw nsw i64 %368, 3
%384 = add nsw i64 %369, 3
%385 = getelementptr inbounds i8, i8* %71, i64 %383
%386 = load i8, i8* %385
%387 = getelementptr inbounds i8, i8* %78, i64 %384
store i8 %386, i8* %387
%388 = add nuw nsw i64 %368, 4
%389 = add nsw i64 %369, 4
%390 = icmp eq i64 %388, %210
br i1 %390, label %391, label %367
391: ; preds = %344, %367, %304, %324, %206
%392 = sext i32 %75 to i64
%393 = getelementptr inbounds i8, i8* %78, i64 %392
store i8 0, i8* %393
%394 = call i8* @md5(i8* %78)
%395 = icmp eq i8* %394, null
br i1 %395, label %396, label %398
396: ; preds = %391
%397 = call i32 (i8*, ...) @warnx(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0))
br label %413
398: ; preds = %391
%399 = call i32 @strlen(i8* %394)
%400 = add nsw i32 %399, 1
%401 = call i32 @send_db(i32 %0, i8* %394, i32 %400)
%402 = icmp eq i32 %401, -1
br i1 %402, label %403, label %405
403: ; preds = %398
%404 = call i32 (i8*, ...) @warnx(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
br label %413
405: ; preds = %398
%406 = call i32 @free(i8* %73)
%407 = call i32 @free(i8* %394)
%408 = call i32 @basex_status(i32 %0)
switch i32 %408, label %411 [
i32 -1, label %409
i32 0, label %413
]
409: ; preds = %405
%410 = call i32 (i8*, ...) @warnx(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
br label %413
411: ; preds = %405
%412 = call i32 (i8*, ...) @warnx(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
br label %413
413: ; preds = %64, %22, %396, %405, %411, %409, %403, %30, %12
%414 = phi i32 [ -1, %12 ], [ -1, %22 ], [ -1, %30 ], [ -1, %396 ], [ -1, %403 ], [ -1, %409 ], [ -1, %411 ], [ %408, %405 ], [ -1, %64 ]
ret i32 %414
}