#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 passwd {
  scalar_t__ pw_dir;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ DEBUG(int, char *, ...);
scalar_t__ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(char *);
char *getenv(char *);
int getline(char **, size_t *, int /*<<< orphan*/ *);
scalar_t__ getpwuid(int /*<<< orphan*/);
int /*<<< orphan*/ getuid();
char *malloc(scalar_t__);
char *rindex(char *, char);
char *scramble(char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strdup(scalar_t__);
scalar_t__ strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, scalar_t__);
int /*<<< orphan*/ *strstr(char *, char *);
char *get_cvs_passwd_from_file(char *user, char *hostname) {
  char *home = NULL;
  char *home_env = NULL;
  struct passwd *pw;
  char *passfile = NULL;
  FILE *fp;
  char *user_at_host;
  int line_length;
  long line = 0;
  char *linebuf = NULL;
  size_t linebuf_len;
  char *passwd_chunk;
  char *password_tmp;
  char *password;
  int i = 0;
  if ((home_env = getenv("HOME")) != NULL) {
    home = home_env;
  } else if ((pw = (struct passwd *)getpwuid(getuid())) && pw->pw_dir) {
    home = strdup(pw->pw_dir);
  } else {
    DEBUG(2, "[get_cvs_passwd_from_file] Could not find home dir");
    return NULL;
  }
  DEBUG(3, "[get_cvs_passwd_from_file] home dir: %s", home);
  passfile = malloc(strlen(home) + strlen(".cvspass") + 3);
  strcpy(passfile, home);
  strcat(passfile, "/");
  strcat(passfile, ".cvspass");
  fp = fopen(passfile, "r");
  if (fp == NULL) {
    return NULL;
  }
  user_at_host = malloc(strlen(user) + strlen(hostname) + 3);
  strcat(user_at_host, user);
  strcat(user_at_host, "@");
  strcat(user_at_host, hostname);
  while ((line_length = getline(&linebuf, &linebuf_len, fp)) >= 0) {
    line++;
    if ((strstr(linebuf, user_at_host) != NULL) &&
        ((strstr(linebuf, "pserver") != NULL)) &&
        ((passwd_chunk = rindex(linebuf, ' ')) != NULL) &&
        ((passwd_chunk = rindex(linebuf, 'A')) != NULL)) {
      DEBUG(3, "[get_cvs_passwd_from_file] password line .cvspass: \n\t%s",
            linebuf);
      password_tmp = malloc(strlen(passwd_chunk));
      strncpy(password_tmp, passwd_chunk + 1, strlen(passwd_chunk) - 2);
      password = scramble(password_tmp);
      for (i = 0; password[i]; i++)
        password[i] = password[i + 1];
      free(password_tmp);
    } else {
      password = NULL;
    }
  }
  if (fclose(fp) < 0) {
  }
  free(home);
  free(passfile);
  free(user_at_host);
  DEBUG(3, "[get_cvs_passwd_from_file] returning password: %s", password);
  return password;
}


x86 assembly (clang, -O0):
<get_cvs_passwd_from_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x58(%rbp)
movq   $0x0,-0x60(%rbp)
movl   $0x0,-0x84(%rbp)
lea    0xda4(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     127c <get_cvs_passwd_from_file+0x6c>
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    12e0 <get_cvs_passwd_from_file+0xd0>
mov    $0x0,%al
call   10c0 <getuid@plt>
mov    %eax,%edi
call   10a0 <getpwuid@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     12bb <get_cvs_passwd_from_file+0xab>
mov    -0x30(%rbp),%rax
cmpq   $0x0,(%rax)
je     12bb <get_cvs_passwd_from_file+0xab>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
call   1120 <strdup@plt>
mov    %rax,-0x20(%rbp)
jmp    12db <get_cvs_passwd_from_file+0xcb>
mov    $0x2,%edi
lea    0xd3e(%rip),%rsi
mov    $0x0,%al
call   1050 <DEBUG@plt>
movq   $0x0,-0x8(%rbp)
jmp    15a6 <get_cvs_passwd_from_file+0x396>
jmp    12e0 <get_cvs_passwd_from_file+0xd0>
mov    -0x20(%rbp),%rdx
mov    $0x3,%edi
lea    0xd48(%rip),%rsi
mov    $0x0,%al
call   1050 <DEBUG@plt>
mov    -0x20(%rbp),%rdi
call   10b0 <strlen@plt>
mov    %rax,-0x90(%rbp)
lea    0xd52(%rip),%rdi
call   10b0 <strlen@plt>
mov    -0x90(%rbp),%rdi
add    %rax,%rdi
add    $0x3,%rdi
call   10d0 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1080 <strcpy@plt>
mov    -0x38(%rbp),%rdi
lea    0xd27(%rip),%rsi
call   1110 <strcat@plt>
mov    -0x38(%rbp),%rdi
lea    0xd0e(%rip),%rsi
call   1110 <strcat@plt>
mov    -0x38(%rbp),%rdi
lea    0xd11(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1383 <get_cvs_passwd_from_file+0x173>
movq   $0x0,-0x8(%rbp)
jmp    15a6 <get_cvs_passwd_from_file+0x396>
mov    -0x10(%rbp),%rdi
call   10b0 <strlen@plt>
mov    %rax,-0x98(%rbp)
mov    -0x18(%rbp),%rdi
call   10b0 <strlen@plt>
mov    -0x98(%rbp),%rdi
add    %rax,%rdi
add    $0x3,%rdi
call   10d0 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1110 <strcat@plt>
mov    -0x48(%rbp),%rdi
lea    0xca0(%rip),%rsi
call   1110 <strcat@plt>
mov    -0x48(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1110 <strcat@plt>
mov    -0x40(%rbp),%rdx
lea    -0x60(%rbp),%rdi
lea    -0x68(%rbp),%rsi
call   1100 <getline@plt>
mov    %eax,-0x4c(%rbp)
cmp    $0x0,%eax
jl     1554 <get_cvs_passwd_from_file+0x344>
mov    -0x58(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
mov    -0x60(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   1130 <strstr@plt>
cmp    $0x0,%rax
je     1547 <get_cvs_passwd_from_file+0x337>
mov    -0x60(%rbp),%rdi
lea    0xc45(%rip),%rsi
call   1130 <strstr@plt>
cmp    $0x0,%rax
je     1547 <get_cvs_passwd_from_file+0x337>
mov    -0x60(%rbp),%rdi
mov    $0x20,%esi
call   10f0 <rindex@plt>
mov    %rax,-0x70(%rbp)
cmp    $0x0,%rax
je     1547 <get_cvs_passwd_from_file+0x337>
mov    -0x60(%rbp),%rdi
mov    $0x41,%esi
call   10f0 <rindex@plt>
mov    %rax,-0x70(%rbp)
cmp    $0x0,%rax
je     1547 <get_cvs_passwd_from_file+0x337>
mov    -0x60(%rbp),%rdx
mov    $0x3,%edi
lea    0xbf6(%rip),%rsi
mov    $0x0,%al
call   1050 <DEBUG@plt>
mov    -0x70(%rbp),%rdi
call   10b0 <strlen@plt>
mov    %rax,%rdi
call   10d0 <malloc@plt>
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    -0x70(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xa0(%rbp)
mov    -0x70(%rbp),%rdi
call   10b0 <strlen@plt>
mov    -0xa8(%rbp),%rdi
mov    -0xa0(%rbp),%rsi
mov    %rax,%rdx
sub    $0x2,%rdx
call   1060 <strncpy@plt>
mov    -0x78(%rbp),%rdi
call   1070 <scramble@plt>
mov    %rax,-0x80(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x80(%rbp),%rax
movslq -0x84(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1539 <get_cvs_passwd_from_file+0x329>
mov    -0x80(%rbp),%rax
mov    -0x84(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x80(%rbp),%rax
movslq -0x84(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    14ef <get_cvs_passwd_from_file+0x2df>
mov    -0x78(%rbp),%rdi
call   1040 <free@plt>
jmp    154f <get_cvs_passwd_from_file+0x33f>
movq   $0x0,-0x80(%rbp)
jmp    13dd <get_cvs_passwd_from_file+0x1cd>
mov    -0x40(%rbp),%rdi
call   1090 <fclose@plt>
cmp    $0x0,%rax
jge    156c <get_cvs_passwd_from_file+0x35c>
jmp    156c <get_cvs_passwd_from_file+0x35c>
mov    -0x20(%rbp),%rdi
call   1040 <free@plt>
mov    -0x38(%rbp),%rdi
call   1040 <free@plt>
mov    -0x48(%rbp),%rdi
call   1040 <free@plt>
mov    -0x80(%rbp),%rdx
mov    $0x3,%edi
lea    0xb16(%rip),%rsi
mov    $0x0,%al
call   1050 <DEBUG@plt>
mov    -0x80(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_cvs_passwd_from_file>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
movq   $0x0,0x8(%rsp)
lea    0xdcc(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%r13
test   %rax,%rax
jne    126c <get_cvs_passwd_from_file+0x5c>
xor    %eax,%eax
call   10c0 <getuid@plt>
mov    %eax,%edi
call   10a0 <getpwuid@plt>
test   %rax,%rax
je     1447 <get_cvs_passwd_from_file+0x237>
mov    (%rax),%rdi
test   %rdi,%rdi
je     1447 <get_cvs_passwd_from_file+0x237>
call   1120 <strdup@plt>
mov    %rax,%r13
lea    0xdc5(%rip),%rsi
xor    %ebx,%ebx
mov    $0x3,%edi
mov    %r13,%rdx
xor    %eax,%eax
call   1050 <DEBUG@plt>
mov    %r13,%rdi
call   10b0 <strlen@plt>
lea    0xb(%rax),%rdi
call   10d0 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %r13,%rsi
call   1080 <strcpy@plt>
lea    0xdbf(%rip),%rsi
mov    %rbp,%rdi
call   1110 <strcat@plt>
lea    0xda7(%rip),%rsi
mov    %rbp,%rdi
call   1110 <strcat@plt>
lea    0xdab(%rip),%rsi
mov    %rbp,%rdi
call   10e0 <fopen@plt>
test   %rax,%rax
je     1498 <get_cvs_passwd_from_file+0x288>
mov    %rax,%r12
mov    %rbp,0x18(%rsp)
mov    %r13,0x20(%rsp)
mov    %r15,%rdi
call   10b0 <strlen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   10b0 <strlen@plt>
lea    (%rbx,%rax,1),%rdi
add    $0x3,%rdi
call   10d0 <malloc@plt>
mov    %rax,%r13
mov    %rax,%rdi
mov    %r15,%rsi
call   1110 <strcat@plt>
lea    0xd50(%rip),%rsi
mov    %r13,%rdi
call   1110 <strcat@plt>
mov    %r13,%rdi
mov    %r14,%rsi
call   1110 <strcat@plt>
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    %r12,%rdx
call   1100 <getline@plt>
test   %eax,%eax
js     145e <get_cvs_passwd_from_file+0x24e>
lea    0x8(%rsp),%r14
lea    0x10(%rsp),%rbp
lea    0xd14(%rip),%r15
jmp    1378 <get_cvs_passwd_from_file+0x168>
nopl   0x0(%rax,%rax,1)
xor    %ebx,%ebx
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
call   1100 <getline@plt>
test   %eax,%eax
js     145e <get_cvs_passwd_from_file+0x24e>
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    %r13,%rsi
call   1130 <strstr@plt>
test   %rax,%rax
je     1360 <get_cvs_passwd_from_file+0x150>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1130 <strstr@plt>
test   %rax,%rax
je     1360 <get_cvs_passwd_from_file+0x150>
mov    %rbx,%rdi
mov    $0x20,%esi
call   10f0 <rindex@plt>
test   %rax,%rax
je     1360 <get_cvs_passwd_from_file+0x150>
mov    0x8(%rsp),%rdi
mov    $0x41,%esi
call   10f0 <rindex@plt>
test   %rax,%rax
je     1360 <get_cvs_passwd_from_file+0x150>
mov    %rax,%rbx
mov    0x8(%rsp),%rdx
mov    $0x3,%edi
lea    0xc9e(%rip),%rsi
xor    %eax,%eax
call   1050 <DEBUG@plt>
mov    %rbx,%rdi
call   10b0 <strlen@plt>
mov    %rax,%rbp
mov    %rax,%rdi
call   10d0 <malloc@plt>
mov    %rax,%r15
add    $0x1,%rbx
add    $0xfffffffffffffffe,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1060 <strncpy@plt>
mov    %r15,%rdi
call   1070 <scramble@plt>
mov    %rax,%rbx
cmpb   $0x0,(%rax)
je     142e <get_cvs_passwd_from_file+0x21e>
lea    0x1(%rbx),%rax
xchg   %ax,%ax
movzbl (%rax),%ecx
mov    %cl,-0x1(%rax)
add    $0x1,%rax
test   %cl,%cl
jne    1420 <get_cvs_passwd_from_file+0x210>
mov    %r15,%rdi
call   1040 <free@plt>
lea    0x10(%rsp),%rbp
lea    0xc2b(%rip),%r15
jmp    1362 <get_cvs_passwd_from_file+0x152>
lea    0xbb7(%rip),%rsi
xor    %ebx,%ebx
mov    $0x2,%edi
xor    %eax,%eax
call   1050 <DEBUG@plt>
jmp    1498 <get_cvs_passwd_from_file+0x288>
mov    %r12,%rdi
call   1090 <fclose@plt>
mov    0x20(%rsp),%rdi
call   1040 <free@plt>
mov    0x18(%rsp),%rdi
call   1040 <free@plt>
mov    %r13,%rdi
call   1040 <free@plt>
lea    0xc24(%rip),%rsi
mov    $0x3,%edi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <DEBUG@plt>
mov    %rbx,%rax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.passwd = type { i64 }
@.str = [5 x i8] c"HOME\00"
@.str.1 = [51 x i8] c"[get_cvs_passwd_from_file] Could not find home dir\00"
@.str.2 = [40 x i8] c"[get_cvs_passwd_from_file] home dir: %s\00"
@.str.3 = [9 x i8] c".cvspass\00"
@.str.4 = [2 x i8] c"/\00"
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [2 x i8] c"@\00"
@.str.7 = [8 x i8] c"pserver\00"
@.str.8 = [56 x i8] c"[get_cvs_passwd_from_file] password line .cvspass: \0A\09%s\00"
@.str.9 = [50 x i8] c"[get_cvs_passwd_from_file] returning password: %s\00"
define i8* @get_cvs_passwd_from_file(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca %struct.passwd*
%9 = alloca i8*
%10 = alloca i32*
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i64
%14 = alloca i8*
%15 = alloca i64
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* null, i8** %6
store i8* null, i8** %7
store i8* null, i8** %9
store i64 0, i64* %13
store i8* null, i8** %14
store i32 0, i32* %19
%20 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %20, i8** %7
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %24
22: ; preds = %2
%23 = load i8*, i8** %7
store i8* %23, i8** %6
br label %42
24: ; preds = %2
%25 = call i32 (...) @getuid()
%26 = call i64 @getpwuid(i32 %25)
%27 = inttoptr i64 %26 to %struct.passwd*
store %struct.passwd* %27, %struct.passwd** %8
%28 = icmp ne %struct.passwd* %27, null
br i1 %28, label %29, label %39
29: ; preds = %24
%30 = load %struct.passwd*, %struct.passwd** %8
%31 = getelementptr inbounds %struct.passwd, %struct.passwd* %30, i32 0, i32 0
%32 = load i64, i64* %31
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %39
34: ; preds = %29
%35 = load %struct.passwd*, %struct.passwd** %8
%36 = getelementptr inbounds %struct.passwd, %struct.passwd* %35, i32 0, i32 0
%37 = load i64, i64* %36
%38 = call i8* @strdup(i64 %37)
store i8* %38, i8** %6
br label %41
39: ; preds = %29, %24
%40 = call i32 (i32, i8*, ...) @DEBUG(i32 2, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
store i8* null, i8** %3
br label %158
41: ; preds = %34
br label %42
42: ; preds = %41, %22
%43 = load i8*, i8** %6
%44 = call i32 (i32, i8*, ...) @DEBUG(i32 3, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %43)
%45 = load i8*, i8** %6
%46 = call i64 @strlen(i8* %45)
%47 = call i64 @strlen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%48 = add nsw i64 %46, %47
%49 = add nsw i64 %48, 3
%50 = call i8* @malloc(i64 %49)
store i8* %50, i8** %9
%51 = load i8*, i8** %9
%52 = load i8*, i8** %6
%53 = call i32 @strcpy(i8* %51, i8* %52)
%54 = load i8*, i8** %9
%55 = call i32 @strcat(i8* %54, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%56 = load i8*, i8** %9
%57 = call i32 @strcat(i8* %56, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%58 = load i8*, i8** %9
%59 = call i32* @fopen(i8* %58, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %59, i32** %10
%60 = load i32*, i32** %10
%61 = icmp eq i32* %60, null
br i1 %61, label %62, label %63
62: ; preds = %42
store i8* null, i8** %3
br label %158
63: ; preds = %42
%64 = load i8*, i8** %4
%65 = call i64 @strlen(i8* %64)
%66 = load i8*, i8** %5
%67 = call i64 @strlen(i8* %66)
%68 = add nsw i64 %65, %67
%69 = add nsw i64 %68, 3
%70 = call i8* @malloc(i64 %69)
store i8* %70, i8** %11
%71 = load i8*, i8** %11
%72 = load i8*, i8** %4
%73 = call i32 @strcat(i8* %71, i8* %72)
%74 = load i8*, i8** %11
%75 = call i32 @strcat(i8* %74, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%76 = load i8*, i8** %11
%77 = load i8*, i8** %5
%78 = call i32 @strcat(i8* %76, i8* %77)
br label %79
79: ; preds = %142, %63
%80 = load i32*, i32** %10
%81 = call i32 @getline(i8** %14, i64* %15, i32* %80)
store i32 %81, i32* %12
%82 = icmp sge i32 %81, 0
br i1 %82, label %83, label %143
83: ; preds = %79
%84 = load i64, i64* %13
%85 = add nsw i64 %84, 1
store i64 %85, i64* %13
%86 = load i8*, i8** %14
%87 = load i8*, i8** %11
%88 = call i32* @strstr(i8* %86, i8* %87)
%89 = icmp ne i32* %88, null
br i1 %89, label %90, label %141
90: ; preds = %83
%91 = load i8*, i8** %14
%92 = call i32* @strstr(i8* %91, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%93 = icmp ne i32* %92, null
br i1 %93, label %94, label %141
94: ; preds = %90
%95 = load i8*, i8** %14
%96 = call i8* @rindex(i8* %95, i8 signext 32)
store i8* %96, i8** %16
%97 = icmp ne i8* %96, null
br i1 %97, label %98, label %141
98: ; preds = %94
%99 = load i8*, i8** %14
%100 = call i8* @rindex(i8* %99, i8 signext 65)
store i8* %100, i8** %16
%101 = icmp ne i8* %100, null
br i1 %101, label %102, label %141
102: ; preds = %98
%103 = load i8*, i8** %14
%104 = call i32 (i32, i8*, ...) @DEBUG(i32 3, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.8, i64 0, i64 0), i8* %103)
%105 = load i8*, i8** %16
%106 = call i64 @strlen(i8* %105)
%107 = call i8* @malloc(i64 %106)
store i8* %107, i8** %17
%108 = load i8*, i8** %17
%109 = load i8*, i8** %16
%110 = getelementptr inbounds i8, i8* %109, i64 1
%111 = load i8*, i8** %16
%112 = call i64 @strlen(i8* %111)
%113 = sub nsw i64 %112, 2
%114 = call i32 @strncpy(i8* %108, i8* %110, i64 %113)
%115 = load i8*, i8** %17
%116 = call i8* @scramble(i8* %115)
store i8* %116, i8** %18
store i32 0, i32* %19
br label %117
117: ; preds = %135, %102
%118 = load i8*, i8** %18
%119 = load i32, i32* %19
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds i8, i8* %118, i64 %120
%122 = load i8, i8* %121
%123 = icmp ne i8 %122, 0
br i1 %123, label %124, label %138
124: ; preds = %117
%125 = load i8*, i8** %18
%126 = load i32, i32* %19
%127 = add nsw i32 %126, 1
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds i8, i8* %125, i64 %128
%130 = load i8, i8* %129
%131 = load i8*, i8** %18
%132 = load i32, i32* %19
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds i8, i8* %131, i64 %133
store i8 %130, i8* %134
br label %135
135: ; preds = %124
%136 = load i32, i32* %19
%137 = add nsw i32 %136, 1
store i32 %137, i32* %19
br label %117
138: ; preds = %117
%139 = load i8*, i8** %17
%140 = call i32 @free(i8* %139)
br label %142
141: ; preds = %98, %94, %90, %83
store i8* null, i8** %18
br label %142
142: ; preds = %141, %138
br label %79
143: ; preds = %79
%144 = load i32*, i32** %10
%145 = call i64 @fclose(i32* %144)
%146 = icmp slt i64 %145, 0
br i1 %146, label %147, label %148
147: ; preds = %143
br label %148
148: ; preds = %147, %143
%149 = load i8*, i8** %6
%150 = call i32 @free(i8* %149)
%151 = load i8*, i8** %9
%152 = call i32 @free(i8* %151)
%153 = load i8*, i8** %11
%154 = call i32 @free(i8* %153)
%155 = load i8*, i8** %18
%156 = call i32 (i32, i8*, ...) @DEBUG(i32 3, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.9, i64 0, i64 0), i8* %155)
%157 = load i8*, i8** %18
store i8* %157, i8** %3
br label %158
158: ; preds = %148, %62, %39
%159 = load i8*, i8** %3
ret i8* %159
}

LLVM IR (-O2):
%struct.passwd = type { i64 }
@.str = [5 x i8] c"HOME\00"
@.str.1 = [51 x i8] c"[get_cvs_passwd_from_file] Could not find home dir\00"
@.str.2 = [40 x i8] c"[get_cvs_passwd_from_file] home dir: %s\00"
@.str.3 = [9 x i8] c".cvspass\00"
@.str.4 = [2 x i8] c"/\00"
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [2 x i8] c"@\00"
@.str.7 = [8 x i8] c"pserver\00"
@.str.8 = [56 x i8] c"[get_cvs_passwd_from_file] password line .cvspass: \0A\09%s\00"
@.str.9 = [50 x i8] c"[get_cvs_passwd_from_file] returning password: %s\00"
define i8* @get_cvs_passwd_from_file(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%6 = bitcast i64* %4 to i8*
%7 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %22
9: ; preds = %2
%10 = tail call i32 (...) @getuid()
%11 = tail call i64 @getpwuid(i32 %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %20, label %13
13: ; preds = %9
%14 = inttoptr i64 %11 to %struct.passwd*
%15 = getelementptr inbounds %struct.passwd, %struct.passwd* %14, i64 0, i32 0
%16 = load i64, i64* %15
%17 = icmp eq i64 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %13
%19 = tail call i8* @strdup(i64 %16)
br label %22
20: ; preds = %13, %9
%21 = tail call i32 (i32, i8*, ...) @DEBUG(i32 2, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
br label %90
22: ; preds = %2, %18
%23 = phi i8* [ %19, %18 ], [ %7, %2 ]
%24 = tail call i32 (i32, i8*, ...) @DEBUG(i32 3, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %23)
%25 = tail call i64 @strlen(i8* dereferenceable(1) %23)
%26 = add nsw i64 %25, 11
%27 = tail call i8* @malloc(i64 %26)
%28 = tail call i32 @strcpy(i8* %27, i8* %23)
%29 = tail call i32 @strcat(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%30 = tail call i32 @strcat(i8* %27, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%31 = tail call i32* @fopen(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%32 = icmp eq i32* %31, null
br i1 %32, label %90, label %33
33: ; preds = %22
%34 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%35 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%36 = add i64 %34, 3
%37 = add i64 %36, %35
%38 = tail call i8* @malloc(i64 %37)
%39 = tail call i32 @strcat(i8* %38, i8* %0)
%40 = tail call i32 @strcat(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%41 = tail call i32 @strcat(i8* %38, i8* %1)
%42 = call i32 @getline(i8** %3, i64* %4, i32* %31)
%43 = icmp sgt i32 %42, -1
br i1 %43, label %44, label %83
44: ; preds = %33, %79
%45 = load i8*, i8** %3
%46 = call i32* @strstr(i8* dereferenceable(1) %45, i8* dereferenceable(1) %38)
%47 = icmp eq i32* %46, null
br i1 %47, label %79, label %48
48: ; preds = %44
%49 = call i32* @strstr(i8* dereferenceable(1) %45, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%50 = icmp eq i32* %49, null
br i1 %50, label %79, label %51
51: ; preds = %48
%52 = call i8* @rindex(i8* %45, i8 signext 32)
%53 = icmp eq i8* %52, null
br i1 %53, label %79, label %54
54: ; preds = %51
%55 = load i8*, i8** %3
%56 = call i8* @rindex(i8* %55, i8 signext 65)
%57 = icmp eq i8* %56, null
br i1 %57, label %79, label %58
58: ; preds = %54
%59 = load i8*, i8** %3
%60 = call i32 (i32, i8*, ...) @DEBUG(i32 3, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.8, i64 0, i64 0), i8* %59)
%61 = call i64 @strlen(i8* %56)
%62 = call i8* @malloc(i64 %61)
%63 = getelementptr inbounds i8, i8* %56, i64 1
%64 = add nsw i64 %61, -2
%65 = call i32 @strncpy(i8* %62, i8* %63, i64 %64)
%66 = call i8* @scramble(i8* %62)
%67 = load i8, i8* %66
%68 = icmp eq i8 %67, 0
br i1 %68, label %77, label %69
69: ; preds = %58, %69
%70 = phi i64 [ %72, %69 ], [ 0, %58 ]
%71 = phi i8* [ %73, %69 ], [ %66, %58 ]
%72 = add nuw nsw i64 %70, 1
%73 = getelementptr inbounds i8, i8* %66, i64 %72
%74 = load i8, i8* %73
store i8 %74, i8* %71
%75 = load i8, i8* %73
%76 = icmp eq i8 %75, 0
br i1 %76, label %77, label %69
77: ; preds = %69, %58
%78 = call i32 @free(i8* %62)
br label %79
79: ; preds = %44, %48, %51, %54, %77
%80 = phi i8* [ %66, %77 ], [ null, %54 ], [ null, %51 ], [ null, %48 ], [ null, %44 ]
%81 = call i32 @getline(i8** %3, i64* %4, i32* %31)
%82 = icmp sgt i32 %81, -1
br i1 %82, label %44, label %83
83: ; preds = %79, %33
%84 = phi i8* [ undef, %33 ], [ %80, %79 ]
%85 = call i64 @fclose(i32* %31)
%86 = call i32 @free(i8* %23)
%87 = call i32 @free(i8* %27)
%88 = call i32 @free(i8* %38)
%89 = call i32 (i32, i8*, ...) @DEBUG(i32 3, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.9, i64 0, i64 0), i8* %84)
br label %90
90: ; preds = %22, %83, %20
%91 = phi i8* [ %84, %83 ], [ null, %20 ], [ null, %22 ]
ret i8* %91
}