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

/* Variables and functions */
char *doencrypt(char *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, ...);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ rename(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ *stderr;
char *strchr(char *, char);
char *strerror(int /*<<< orphan*/);
char *strtok(char *, char *);
int main(int argc, char *argv[]) {
  FILE *old, *new;
  char newpath[1024], line[1024];
  char *oldpass, *newpass, *ch;
  char *userhost, *nick, *flags;
  int ii;
  if (argc < 2) {
    fprintf(stderr, "Usage: %s <conf1> [conf2 conf3 ...]\n", argv[0]);
    return 0;
  }
  for (ii = 1; ii < argc; ii++) {
    sprintf(newpath, "%s.orig", argv[ii]);
    if (rename(argv[ii], newpath) < 0) {
      fprintf(stderr, "Unable to rename %s to %s.orig: %s\n", argv[ii],
              argv[ii], strerror(errno));
      return 0;
    }
    if (!(old = fopen(newpath, "r"))) {
      fprintf(stderr, "Unable to open %s: %s\n", newpath, strerror(errno));
      return 0;
    }
    if (!(new = fopen(argv[ii], "w"))) {
      fprintf(stderr, "Unable to open %s: %s\n", argv[ii], strerror(errno));
      return 0;
    }
    while (fgets(line, sizeof(line) - 1, old)) {
      if ((*line == 'o') || (*line == 'O')) {
        userhost = strtok(line + 2, ":");
        oldpass = strtok(NULL, ":");
        nick = strtok(NULL, ":");
        flags = strtok(NULL, ":");
        if (!userhost || !oldpass || !nick || !flags)
          continue;
        if ((ch = strchr(flags, '\n')))
          *ch = '\0';
        if ((ch = strchr(flags, '\r')))
          *ch = '\0';
        printf("oldpass = [%s]\n", oldpass);
        newpass = doencrypt(oldpass);
        fprintf(new, "O:%s:%s:%s:%s\n", userhost, newpass, nick, flags);
      } else {
        fprintf(new, "%s", line);
      }
    }
    fclose(old);
    fclose(new);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x890,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11fe <main+0x4e>
mov    0x2e06(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe15(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    15bd <main+0x40d>
movl   $0x1,-0x854(%rbp)
mov    -0x854(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    15b6 <main+0x406>
lea    -0x420(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x854(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xdf1(%rip),%rsi
call   10c0 <sprintf@plt>
mov    -0x10(%rbp),%rax
movslq -0x854(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x420(%rbp),%rsi
call   10b0 <rename@plt>
cmp    $0x0,%rax
jge    12db <main+0x12b>
mov    0x2d7b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x870(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x854(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x868(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x854(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x860(%rbp)
mov    0x2d36(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x870(%rbp),%rdi
mov    -0x868(%rbp),%rdx
mov    -0x860(%rbp),%rcx
mov    %rax,%r8
lea    0xd65(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    15bd <main+0x40d>
lea    -0x420(%rbp),%rdi
lea    0xd68(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1354 <main+0x1a4>
mov    0x2cdd(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x880(%rbp)
lea    -0x420(%rbp),%rax
mov    %rax,-0x878(%rbp)
mov    0x2cb6(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x880(%rbp),%rdi
mov    -0x878(%rbp),%rdx
mov    %rax,%rcx
lea    0xd12(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    15bd <main+0x40d>
mov    -0x10(%rbp),%rax
movslq -0x854(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd00(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    13dd <main+0x22d>
mov    0x2c5c(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x890(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x854(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x888(%rbp)
mov    0x2c2d(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x890(%rbp),%rdi
mov    -0x888(%rbp),%rdx
mov    %rax,%rcx
lea    0xc89(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    15bd <main+0x40d>
jmp    13e2 <main+0x232>
lea    -0x820(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x3ff,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     1590 <main+0x3e0>
movsbl -0x820(%rbp),%eax
cmp    $0x6f,%eax
je     1421 <main+0x271>
movsbl -0x820(%rbp),%eax
cmp    $0x4f,%eax
jne    1572 <main+0x3c2>
lea    -0x820(%rbp),%rdi
add    $0x2,%rdi
lea    0xc39(%rip),%rsi
call   10a0 <strtok@plt>
mov    %rax,-0x840(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xc22(%rip),%rsi
call   10a0 <strtok@plt>
mov    %rax,-0x828(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xc0b(%rip),%rsi
call   10a0 <strtok@plt>
mov    %rax,-0x848(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xbf4(%rip),%rsi
call   10a0 <strtok@plt>
mov    %rax,-0x850(%rbp)
cmpq   $0x0,-0x840(%rbp)
je     14bc <main+0x30c>
cmpq   $0x0,-0x828(%rbp)
je     14bc <main+0x30c>
cmpq   $0x0,-0x848(%rbp)
je     14bc <main+0x30c>
cmpq   $0x0,-0x850(%rbp)
jne    14c1 <main+0x311>
jmp    13e2 <main+0x232>
mov    -0x850(%rbp),%rdi
mov    $0xa,%esi
call   1050 <strchr@plt>
mov    %rax,-0x838(%rbp)
cmp    $0x0,%rax
je     14ed <main+0x33d>
mov    -0x838(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x850(%rbp),%rdi
mov    $0xd,%esi
call   1050 <strchr@plt>
mov    %rax,-0x838(%rbp)
cmp    $0x0,%rax
je     1519 <main+0x369>
mov    -0x838(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x828(%rbp),%rsi
lea    0xb47(%rip),%rdi
call   1060 <printf@plt>
mov    -0x828(%rbp),%rdi
call   1040 <doencrypt@plt>
mov    %rax,-0x830(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x840(%rbp),%rdx
mov    -0x830(%rbp),%rcx
mov    -0x848(%rbp),%r8
mov    -0x850(%rbp),%r9
lea    0xb18(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    158b <main+0x3db>
mov    -0x20(%rbp),%rdi
lea    -0x820(%rbp),%rdx
lea    0xb09(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    13e2 <main+0x232>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x854(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x854(%rbp)
jmp    1208 <main+0x58>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x890,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x828,%rsp
mov    %rsi,%r12
cmp    $0x2,%edi
jge    11fa <main+0x3a>
mov    0x2e00(%rip),%rax
mov    (%rax),%rdi
mov    (%r12),%rdx
lea    0xe12(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    144b <main+0x28b>
mov    %edi,%eax
mov    %rax,0x18(%rsp)
mov    $0x1,%ebx
lea    0x420(%rsp),%rbp
mov    %r12,0x8(%rsp)
jmp    1252 <main+0x92>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
call   1030 <fclose@plt>
mov    (%rsp),%rdi
call   1030 <fclose@plt>
mov    0x10(%rsp),%rbx
add    $0x1,%rbx
cmp    0x18(%rsp),%rbx
mov    0x8(%rsp),%r12
lea    0x420(%rsp),%rbp
je     144b <main+0x28b>
mov    (%r12,%rbx,8),%rdx
mov    %rbp,%rdi
lea    0xdc5(%rip),%rsi
call   10d0 <sprintf@plt>
mov    (%r12,%rbx,8),%rdi
mov    %rbp,%rsi
call   10c0 <rename@plt>
test   %rax,%rax
js     13aa <main+0x1ea>
mov    %rbp,%rdi
lea    0xdcd(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     13e2 <main+0x222>
mov    %rax,%r15
mov    %rbx,0x10(%rsp)
mov    (%r12,%rbx,8),%rdi
lea    0xdc5(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,(%rsp)
test   %rax,%rax
jne    12ce <main+0x10e>
jmp    140e <main+0x24e>
nopl   0x0(%rax,%rax,1)
lea    0x20(%rsp),%rdi
mov    (%rsp),%rsi
call   1070 <fputs@plt>
lea    0x20(%rsp),%rdi
mov    $0x3ff,%esi
mov    %r15,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     1220 <main+0x60>
movzbl 0x20(%rsp),%eax
and    $0xdf,%al
cmp    $0x4f,%al
jne    12c0 <main+0x100>
lea    0x22(%rsp),%rdi
lea    0xd6c(%rip),%rbx
mov    %rbx,%rsi
call   10b0 <strtok@plt>
mov    %rax,%r14
xor    %edi,%edi
mov    %rbx,%rsi
call   10b0 <strtok@plt>
mov    %rax,%rbp
xor    %edi,%edi
mov    %rbx,%rsi
call   10b0 <strtok@plt>
mov    %rax,%r12
xor    %edi,%edi
mov    %rbx,%rsi
call   10b0 <strtok@plt>
test   %r14,%r14
je     12ce <main+0x10e>
test   %rbp,%rbp
je     12ce <main+0x10e>
test   %r12,%r12
je     12ce <main+0x10e>
mov    %rax,%r13
test   %rax,%rax
je     12ce <main+0x10e>
mov    %r13,%rdi
mov    $0xa,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     135b <main+0x19b>
movb   $0x0,(%rax)
mov    %r13,%rdi
mov    $0xd,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     1370 <main+0x1b0>
movb   $0x0,(%rax)
lea    0xcf7(%rip),%rdi
mov    %rbp,%rsi
call   1060 <printf@plt>
mov    %rbp,%rdi
call   1040 <doencrypt@plt>
mov    (%rsp),%rdi
lea    0xcec(%rip),%rsi
mov    %r14,%rdx
mov    %rax,%rcx
mov    %r12,%r8
mov    %r13,%r9
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    12ce <main+0x10e>
mov    0x2c2f(%rip),%rax
mov    (%rax),%r14
mov    (%r12,%rbx,8),%rbp
mov    0x2c19(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xc60(%rip),%rsi
mov    %r14,%rdi
mov    %rbp,%rdx
mov    %rbp,%rcx
mov    %rax,%r8
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    144b <main+0x28b>
mov    0x2bf7(%rip),%rax
mov    (%rax),%rbx
mov    0x2be5(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xc52(%rip),%rsi
lea    0x420(%rsp),%rdx
mov    %rbx,%rdi
jmp    1441 <main+0x281>
mov    0x2bcb(%rip),%rax
mov    (%rax),%rbx
mov    0x8(%rsp),%rax
mov    0x10(%rsp),%rcx
mov    (%rax,%rcx,8),%rbp
mov    0x2bab(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xc18(%rip),%rsi
mov    %rbx,%rdi
mov    %rbp,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
xor    %eax,%eax
add    $0x828,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32* null
@.str = [37 x i8] c"Usage: %s <conf1> [conf2 conf3 ...]\0A\00"
@.str.1 = [8 x i8] c"%s.orig\00"
@.str.2 = [36 x i8] c"Unable to rename %s to %s.orig: %s\0A\00"
@errno = global i32 0
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [23 x i8] c"Unable to open %s: %s\0A\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [2 x i8] c":\00"
@.str.7 = [16 x i8] c"oldpass = [%s]\0A\00"
@.str.8 = [15 x i8] c"O:%s:%s:%s:%s\0A\00"
@.str.9 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca [1024 x i8]
%9 = alloca [1024 x i8]
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 2
br i1 %18, label %19, label %25
19: ; preds = %2
%20 = load i32*, i32** @stderr
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %20, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %23)
store i32 0, i32* %3
br label %161
25: ; preds = %2
store i32 1, i32* %16
br label %26
26: ; preds = %157, %25
%27 = load i32, i32* %16
%28 = load i32, i32* %4
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %160
30: ; preds = %26
%31 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%32 = load i8**, i8*** %5
%33 = load i32, i32* %16
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %32, i64 %34
%36 = load i8*, i8** %35
%37 = call i32 @sprintf(i8* %31, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %36)
%38 = load i8**, i8*** %5
%39 = load i32, i32* %16
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8*, i8** %38, i64 %40
%42 = load i8*, i8** %41
%43 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%44 = call i64 @rename(i8* %42, i8* %43)
%45 = icmp slt i64 %44, 0
br i1 %45, label %46, label %61
46: ; preds = %30
%47 = load i32*, i32** @stderr
%48 = load i8**, i8*** %5
%49 = load i32, i32* %16
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8*, i8** %48, i64 %50
%52 = load i8*, i8** %51
%53 = load i8**, i8*** %5
%54 = load i32, i32* %16
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8*, i8** %53, i64 %55
%57 = load i8*, i8** %56
%58 = load i32, i32* @errno
%59 = call i8* @strerror(i32 %58)
%60 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* %52, i8* %57, i8* %59)
store i32 0, i32* %3
br label %161
61: ; preds = %30
%62 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%63 = call i32* @fopen(i8* %62, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %63, i32** %6
%64 = icmp ne i32* %63, null
br i1 %64, label %71, label %65
65: ; preds = %61
%66 = load i32*, i32** @stderr
%67 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%68 = load i32, i32* @errno
%69 = call i8* @strerror(i32 %68)
%70 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %66, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %67, i8* %69)
store i32 0, i32* %3
br label %161
71: ; preds = %61
%72 = load i8**, i8*** %5
%73 = load i32, i32* %16
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i8*, i8** %72, i64 %74
%76 = load i8*, i8** %75
%77 = call i32* @fopen(i8* %76, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %77, i32** %7
%78 = icmp ne i32* %77, null
br i1 %78, label %89, label %79
79: ; preds = %71
%80 = load i32*, i32** @stderr
%81 = load i8**, i8*** %5
%82 = load i32, i32* %16
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i8*, i8** %81, i64 %83
%85 = load i8*, i8** %84
%86 = load i32, i32* @errno
%87 = call i8* @strerror(i32 %86)
%88 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %80, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %85, i8* %87)
store i32 0, i32* %3
br label %161
89: ; preds = %71
br label %90
90: ; preds = %151, %123, %89
%91 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%92 = load i32*, i32** %6
%93 = call i64 @fgets(i8* %91, i32 1023, i32* %92)
%94 = icmp ne i64 %93, 0
br i1 %94, label %95, label %152
95: ; preds = %90
%96 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%97 = load i8, i8* %96
%98 = sext i8 %97 to i32
%99 = icmp eq i32 %98, 111
br i1 %99, label %105, label %100
100: ; preds = %95
%101 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%102 = load i8, i8* %101
%103 = sext i8 %102 to i32
%104 = icmp eq i32 %103, 79
br i1 %104, label %105, label %147
105: ; preds = %100, %95
%106 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%107 = getelementptr inbounds i8, i8* %106, i64 2
%108 = call i8* @strtok(i8* %107, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i8* %108, i8** %13
%109 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i8* %109, i8** %10
%110 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i8* %110, i8** %14
%111 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i8* %111, i8** %15
%112 = load i8*, i8** %13
%113 = icmp ne i8* %112, null
br i1 %113, label %114, label %123
114: ; preds = %105
%115 = load i8*, i8** %10
%116 = icmp ne i8* %115, null
br i1 %116, label %117, label %123
117: ; preds = %114
%118 = load i8*, i8** %14
%119 = icmp ne i8* %118, null
br i1 %119, label %120, label %123
120: ; preds = %117
%121 = load i8*, i8** %15
%122 = icmp ne i8* %121, null
br i1 %122, label %124, label %123
123: ; preds = %120, %117, %114, %105
br label %90
124: ; preds = %120
%125 = load i8*, i8** %15
%126 = call i8* @strchr(i8* %125, i8 signext 10)
store i8* %126, i8** %12
%127 = icmp ne i8* %126, null
br i1 %127, label %128, label %130
128: ; preds = %124
%129 = load i8*, i8** %12
store i8 0, i8* %129
br label %130
130: ; preds = %128, %124
%131 = load i8*, i8** %15
%132 = call i8* @strchr(i8* %131, i8 signext 13)
store i8* %132, i8** %12
%133 = icmp ne i8* %132, null
br i1 %133, label %134, label %136
134: ; preds = %130
%135 = load i8*, i8** %12
store i8 0, i8* %135
br label %136
136: ; preds = %134, %130
%137 = load i8*, i8** %10
%138 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i8* %137)
%139 = load i8*, i8** %10
%140 = call i8* @doencrypt(i8* %139)
store i8* %140, i8** %11
%141 = load i32*, i32** %7
%142 = load i8*, i8** %13
%143 = load i8*, i8** %11
%144 = load i8*, i8** %14
%145 = load i8*, i8** %15
%146 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %141, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i8* %142, i8* %143, i8* %144, i8* %145)
br label %151
147: ; preds = %100
%148 = load i32*, i32** %7
%149 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%150 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %148, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %149)
br label %151
151: ; preds = %147, %136
br label %90
152: ; preds = %90
%153 = load i32*, i32** %6
%154 = call i32 @fclose(i32* %153)
%155 = load i32*, i32** %7
%156 = call i32 @fclose(i32* %155)
br label %157
157: ; preds = %152
%158 = load i32, i32* %16
%159 = add nsw i32 %158, 1
store i32 %159, i32* %16
br label %26
160: ; preds = %26
store i32 0, i32* %3
br label %161
161: ; preds = %160, %79, %65, %46, %19
%162 = load i32, i32* %3
ret i32 %162
}

LLVM IR (-O2):
@stderr = global i32* null
@.str = [37 x i8] c"Usage: %s <conf1> [conf2 conf3 ...]\0A\00"
@.str.1 = [8 x i8] c"%s.orig\00"
@.str.2 = [36 x i8] c"Unable to rename %s to %s.orig: %s\0A\00"
@errno = global i32 0
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [23 x i8] c"Unable to open %s: %s\0A\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [2 x i8] c":\00"
@.str.7 = [16 x i8] c"oldpass = [%s]\0A\00"
@.str.8 = [15 x i8] c"O:%s:%s:%s:%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%7 = icmp slt i32 %0, 2
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 2
%10 = zext i32 %0 to i64
br label %15
11: ; preds = %2
%12 = load i32*, i32** @stderr
%13 = load i8*, i8** %1
%14 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %13)
br label %88
15: ; preds = %8, %83
%16 = phi i64 [ 1, %8 ], [ %86, %83 ]
%17 = getelementptr inbounds i8*, i8** %1, i64 %16
%18 = load i8*, i8** %17
%19 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%20 = load i8*, i8** %17
%21 = call i64 @rename(i8* %20, i8* %5)
%22 = icmp slt i64 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %15
%24 = load i32*, i32** @stderr
%25 = load i8*, i8** %17
%26 = load i32, i32* @errno
%27 = call i8* @strerror(i32 %26)
%28 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* %25, i8* %25, i8* %27)
br label %88
29: ; preds = %15
%30 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%31 = icmp eq i32* %30, null
br i1 %31, label %32, label %37
32: ; preds = %29
%33 = load i32*, i32** @stderr
%34 = load i32, i32* @errno
%35 = call i8* @strerror(i32 %34)
%36 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %5, i8* %35)
br label %88
37: ; preds = %29
%38 = load i8*, i8** %17
%39 = call i32* @fopen(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%40 = icmp eq i32* %39, null
br i1 %40, label %44, label %41
41: ; preds = %37
%42 = call i64 @fgets(i8* %6, i32 1023, i32* %30)
%43 = icmp eq i64 %42, 0
br i1 %43, label %83, label %50
44: ; preds = %37
%45 = load i32*, i32** @stderr
%46 = load i8*, i8** %17
%47 = load i32, i32* @errno
%48 = call i8* @strerror(i32 %47)
%49 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %45, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %46, i8* %48)
br label %88
50: ; preds = %41, %80
%51 = load i8, i8* %6
%52 = and i8 %51, -33
%53 = icmp eq i8 %52, 79
br i1 %53, label %54, label %78
54: ; preds = %50
%55 = call i8* @strtok(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%56 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%57 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%58 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%59 = icmp ne i8* %55, null
%60 = icmp ne i8* %56, null
%61 = select i1 %59, i1 %60, i1 false
%62 = icmp ne i8* %57, null
%63 = select i1 %61, i1 %62, i1 false
%64 = icmp ne i8* %58, null
%65 = select i1 %63, i1 %64, i1 false
br i1 %65, label %66, label %80
66: ; preds = %54
%67 = call i8* @strchr(i8* %58, i8 signext 10)
%68 = icmp eq i8* %67, null
br i1 %68, label %70, label %69
69: ; preds = %66
store i8 0, i8* %67
br label %70
70: ; preds = %69, %66
%71 = call i8* @strchr(i8* %58, i8 signext 13)
%72 = icmp eq i8* %71, null
br i1 %72, label %74, label %73
73: ; preds = %70
store i8 0, i8* %71
br label %74
74: ; preds = %73, %70
%75 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i8* %56)
%76 = call i8* @doencrypt(i8* %56)
%77 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %39, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i8* %55, i8* %76, i8* %57, i8* %58)
br label %80
78: ; preds = %50
%79 = call i32 @fputs(i8* %6, i32* %39)
br label %80
80: ; preds = %74, %78, %54
%81 = call i64 @fgets(i8* %6, i32 1023, i32* %30)
%82 = icmp eq i64 %81, 0
br i1 %82, label %83, label %50
83: ; preds = %80, %41
%84 = call i32 @fclose(i32* %30)
%85 = call i32 @fclose(i32* %39)
%86 = add nuw nsw i64 %16, 1
%87 = icmp eq i64 %86, %10
br i1 %87, label %88, label %15
88: ; preds = %83, %44, %32, %23, %11
ret i32 0
}