#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int rand();
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strlwr(char *);
int /*<<< orphan*/ strrep(char *, char, char);
pick_setup(char *s, char side, char *file) {
  FILE *f;
  char b[512];
  int i, count, r;
  s[0] = '\0';
  count = 0;
  f = fopen(file, "r");
  if (f == NULL) {
    return (0);
  }
  while (fgets(b, 511, f) != NULL) {
    b[511] = '\0';
    for (i = 0; b[i] != '\0'; i++) {
      if (b[i] == '\n') {
        b[i] = '\0';
      }
    }
    if (strlen(b) >= 63) {
      if ((b[0] >= 'A') && (b[0] <= 'Z')) {
        count += 1;
      }
    }
    b[0] = '\0';
  }
  fclose(f);
  if (count == 0) {
    return (0);
  }
  r = rand() % count;
  count = 0;
  f = fopen(file, "r");
  while (fgets(b, 511, f) != NULL) {
    b[511] = '\0';
    for (i = 0; b[i] != '\0'; i++) {
      if (b[i] == '\n') {
        b[i] = '\0';
      }
    }
    if (strlen(b) >= 63) {
      if ((b[0] >= 'A') && (b[0] <= 'Z')) {
        if (r == count) {
          b[63] = '\0';
          strcpy(s, b);
        }
        count += 1;
      }
    }
    b[0] = '\0';
  }
  fclose(f);
  if (side == 'b') {
    strrep(s, '1', '8');
    strrep(s, '2', '7');
    strrep(s, 'a', 'H');
    strrep(s, 'b', 'G');
    strrep(s, 'c', 'F');
    strrep(s, 'd', 'E');
    strrep(s, 'e', 'D');
    strrep(s, 'f', 'C');
    strrep(s, 'g', 'B');
    strrep(s, 'h', 'A');
    strlwr(s);
  }
}


x86 assembly (clang, -O0):
<pick_setup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x240,%rsp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x0,-0x238(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe4b(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11d5 <pick_setup+0x55>
movl   $0x0,-0x4(%rbp)
jmp    14e8 <pick_setup+0x368>
jmp    11da <pick_setup+0x5a>
lea    -0x230(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x1ff,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     12b4 <pick_setup+0x134>
movb   $0x0,-0x31(%rbp)
movl   $0x0,-0x234(%rbp)
movslq -0x234(%rbp),%rax
movsbl -0x230(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     125f <pick_setup+0xdf>
movslq -0x234(%rbp),%rax
movsbl -0x230(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    1246 <pick_setup+0xc6>
movslq -0x234(%rbp),%rax
movb   $0x0,-0x230(%rbp,%rax,1)
jmp    124b <pick_setup+0xcb>
mov    -0x234(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x234(%rbp)
jmp    1207 <pick_setup+0x87>
lea    -0x230(%rbp),%rdi
call   1060 <strlen@plt>
cmp    $0x3f,%eax
jl     12a8 <pick_setup+0x128>
movsbl -0x230(%rbp),%eax
cmp    $0x41,%eax
jl     12a3 <pick_setup+0x123>
movsbl -0x230(%rbp),%eax
cmp    $0x5a,%eax
jg     12a3 <pick_setup+0x123>
mov    -0x238(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x238(%rbp)
jmp    12a8 <pick_setup+0x128>
movb   $0x0,-0x230(%rbp)
jmp    11da <pick_setup+0x5a>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
cmpl   $0x0,-0x238(%rbp)
jne    12d6 <pick_setup+0x156>
movl   $0x0,-0x4(%rbp)
jmp    14e8 <pick_setup+0x368>
mov    $0x0,%al
call   10a0 <rand@plt>
cltd
idivl  -0x238(%rbp)
mov    %edx,-0x23c(%rbp)
movl   $0x0,-0x238(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xd01(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x28(%rbp)
lea    -0x230(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x1ff,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     140b <pick_setup+0x28b>
movb   $0x0,-0x31(%rbp)
movl   $0x0,-0x234(%rbp)
movslq -0x234(%rbp),%rax
movsbl -0x230(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     138d <pick_setup+0x20d>
movslq -0x234(%rbp),%rax
movsbl -0x230(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    1374 <pick_setup+0x1f4>
movslq -0x234(%rbp),%rax
movb   $0x0,-0x230(%rbp,%rax,1)
jmp    1379 <pick_setup+0x1f9>
mov    -0x234(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x234(%rbp)
jmp    1335 <pick_setup+0x1b5>
lea    -0x230(%rbp),%rdi
call   1060 <strlen@plt>
cmp    $0x3f,%eax
jl     13ff <pick_setup+0x27f>
movsbl -0x230(%rbp),%eax
cmp    $0x41,%eax
jl     13fa <pick_setup+0x27a>
movsbl -0x230(%rbp),%eax
cmp    $0x5a,%eax
jg     13fa <pick_setup+0x27a>
mov    -0x23c(%rbp),%eax
cmp    -0x238(%rbp),%eax
jne    13eb <pick_setup+0x26b>
movb   $0x0,-0x1f1(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x230(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x238(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x238(%rbp)
jmp    13ff <pick_setup+0x27f>
movb   $0x0,-0x230(%rbp)
jmp    1308 <pick_setup+0x188>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
movsbl -0x11(%rbp),%eax
cmp    $0x62,%eax
jne    14e8 <pick_setup+0x368>
mov    -0x10(%rbp),%rdi
mov    $0x31,%esi
mov    $0x38,%edx
call   1080 <strrep@plt>
mov    -0x10(%rbp),%rdi
mov    $0x32,%esi
mov    $0x37,%edx
call   1080 <strrep@plt>
mov    -0x10(%rbp),%rdi
mov    $0x61,%esi
mov    $0x48,%edx
call   1080 <strrep@plt>
mov    -0x10(%rbp),%rdi
mov    $0x62,%esi
mov    $0x47,%edx
call   1080 <strrep@plt>
mov    -0x10(%rbp),%rdi
mov    $0x63,%esi
mov    $0x46,%edx
call   1080 <strrep@plt>
mov    -0x10(%rbp),%rdi
mov    $0x64,%esi
mov    $0x45,%edx
call   1080 <strrep@plt>
mov    -0x10(%rbp),%rdi
mov    $0x65,%esi
mov    $0x44,%edx
call   1080 <strrep@plt>
mov    -0x10(%rbp),%rdi
mov    $0x66,%esi
mov    $0x43,%edx
call   1080 <strrep@plt>
mov    -0x10(%rbp),%rdi
mov    $0x67,%esi
mov    $0x42,%edx
call   1080 <strrep@plt>
mov    -0x10(%rbp),%rdi
mov    $0x68,%esi
mov    $0x41,%edx
call   1080 <strrep@plt>
mov    -0x10(%rbp),%rdi
call   1030 <strlwr@plt>
mov    -0x4(%rbp),%eax
add    $0x240,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pick_setup>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x218,%rsp
mov    %rdx,%r13
mov    %esi,%r14d
mov    %rdi,%r15
movb   $0x0,(%rdi)
lea    0xe5c(%rip),%rsi
mov    %rdx,%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     13dd <pick_setup+0x25d>
mov    %rax,%rbx
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x1ff,%esi
mov    %rax,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     1301 <pick_setup+0x181>
xor    %r12d,%r12d
jmp    11fa <pick_setup+0x7a>
nopl   0x0(%rax,%rax,1)
movb   $0x0,0x10(%rsp)
mov    %rbp,%rdi
mov    $0x1ff,%esi
mov    %rbx,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     123e <pick_setup+0xbe>
movb   $0x0,0x20f(%rsp)
mov    %rbp,%rax
jmp    1217 <pick_setup+0x97>
nopw   0x0(%rax,%rax,1)
movb   $0x0,(%rax)
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0xa,%cl
je     1210 <pick_setup+0x90>
test   %cl,%cl
jne    1213 <pick_setup+0x93>
mov    %rbp,%rdi
call   1060 <strlen@plt>
cmp    $0x3f,%eax
jl     11e0 <pick_setup+0x60>
mov    0x10(%rsp),%al
add    $0xbf,%al
cmp    $0x1a,%al
adc    $0x0,%r12d
jmp    11e0 <pick_setup+0x60>
mov    %rbx,%rdi
call   1050 <fclose@plt>
test   %r12d,%r12d
je     13dd <pick_setup+0x25d>
mov    %r14d,0xc(%rsp)
xor    %r14d,%r14d
xor    %eax,%eax
call   10a0 <rand@plt>
cltd
idiv   %r12d
mov    %edx,%r12d
lea    0xd94(%rip),%rsi
mov    %r13,%rdi
call   1090 <fopen@plt>
mov    %rax,%rbp
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1ff,%esi
mov    %rax,%rdx
jmp    12a4 <pick_setup+0x124>
nopl   0x0(%rax)
add    $0x1,%r14d
movb   $0x0,0x10(%rsp)
mov    %rbx,%rdi
mov    $0x1ff,%esi
mov    %rbp,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     130e <pick_setup+0x18e>
movb   $0x0,0x20f(%rsp)
mov    %rbx,%rax
jmp    12c7 <pick_setup+0x147>
nopl   0x0(%rax,%rax,1)
movb   $0x0,(%rax)
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0xa,%cl
je     12c0 <pick_setup+0x140>
test   %cl,%cl
jne    12c3 <pick_setup+0x143>
mov    %rbx,%rdi
call   1060 <strlen@plt>
cmp    $0x3f,%eax
jl     1294 <pick_setup+0x114>
mov    0x10(%rsp),%al
add    $0xbf,%al
cmp    $0x19,%al
ja     1294 <pick_setup+0x114>
cmp    %r14d,%r12d
jne    1290 <pick_setup+0x110>
movb   $0x0,0x4f(%rsp)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
jmp    1290 <pick_setup+0x110>
mov    %rbx,%rdi
call   1050 <fclose@plt>
jmp    13dd <pick_setup+0x25d>
mov    %rbp,%rdi
call   1050 <fclose@plt>
cmpb   $0x62,0xc(%rsp)
jne    13dd <pick_setup+0x25d>
mov    %r15,%rdi
mov    $0x31,%esi
mov    $0x38,%edx
call   1080 <strrep@plt>
mov    %r15,%rdi
mov    $0x32,%esi
mov    $0x37,%edx
call   1080 <strrep@plt>
mov    %r15,%rdi
mov    $0x61,%esi
mov    $0x48,%edx
call   1080 <strrep@plt>
mov    %r15,%rdi
mov    $0x62,%esi
mov    $0x47,%edx
call   1080 <strrep@plt>
mov    %r15,%rdi
mov    $0x63,%esi
mov    $0x46,%edx
call   1080 <strrep@plt>
mov    %r15,%rdi
mov    $0x64,%esi
mov    $0x45,%edx
call   1080 <strrep@plt>
mov    %r15,%rdi
mov    $0x65,%esi
mov    $0x44,%edx
call   1080 <strrep@plt>
mov    %r15,%rdi
mov    $0x66,%esi
mov    $0x43,%edx
call   1080 <strrep@plt>
mov    %r15,%rdi
mov    $0x67,%esi
mov    $0x42,%edx
call   1080 <strrep@plt>
mov    %r15,%rdi
mov    $0x68,%esi
mov    $0x41,%edx
call   1080 <strrep@plt>
mov    %r15,%rdi
call   1030 <strlwr@plt>
xor    %eax,%eax
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32 @pick_setup(i8* %0, i8 signext %1, i8* nocapture %2) {
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
store i8 0, i8* %0
%6 = tail call i32* @fopen(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %90, label %8
8: ; preds = %3
%9 = call i32* @fgets(i8* %5, i32 511, i32* %6)
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 @fclose(i32* %6)
br label %90
13: ; preds = %8
%14 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 511
br label %15
15: ; preds = %13, %33
%16 = phi i32 [ 0, %13 ], [ %34, %33 ]
store i8 0, i8* %14
br label %17
17: ; preds = %22, %15
%18 = phi i64 [ %23, %22 ], [ 0, %15 ]
%19 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 %18
%20 = load i8, i8* %19
switch i8 %20, label %22 [
i8 0, label %24
i8 10, label %21
]
21: ; preds = %17
store i8 0, i8* %19
br label %22
22: ; preds = %17, %21
%23 = add nuw i64 %18, 1
br label %17
24: ; preds = %17
%25 = call i32 @strlen(i8* %5)
%26 = icmp sgt i32 %25, 62
br i1 %26, label %27, label %33
27: ; preds = %24
%28 = load i8, i8* %5
%29 = add i8 %28, -65
%30 = icmp ult i8 %29, 26
%31 = zext i1 %30 to i32
%32 = add nsw i32 %16, %31
br label %33
33: ; preds = %27, %24
%34 = phi i32 [ %16, %24 ], [ %32, %27 ]
store i8 0, i8* %5
%35 = call i32* @fgets(i8* %5, i32 511, i32* %6)
%36 = icmp eq i32* %35, null
br i1 %36, label %37, label %15
37: ; preds = %33
%38 = call i32 @fclose(i32* %6)
%39 = icmp eq i32 %34, 0
br i1 %39, label %90, label %40
40: ; preds = %37
%41 = call i32 (...) @rand()
%42 = srem i32 %41, %34
%43 = call i32* @fopen(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%44 = call i32* @fgets(i8* %5, i32 511, i32* %43)
%45 = icmp eq i32* %44, null
br i1 %45, label %75, label %46
46: ; preds = %40
%47 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 511
%48 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 63
br label %49
49: ; preds = %46, %71
%50 = phi i32 [ 0, %46 ], [ %72, %71 ]
store i8 0, i8* %47
br label %51
51: ; preds = %56, %49
%52 = phi i64 [ %57, %56 ], [ 0, %49 ]
%53 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 %52
%54 = load i8, i8* %53
switch i8 %54, label %56 [
i8 0, label %58
i8 10, label %55
]
55: ; preds = %51
store i8 0, i8* %53
br label %56
56: ; preds = %51, %55
%57 = add nuw i64 %52, 1
br label %51
58: ; preds = %51
%59 = call i32 @strlen(i8* %5)
%60 = icmp sgt i32 %59, 62
br i1 %60, label %61, label %71
61: ; preds = %58
%62 = load i8, i8* %5
%63 = add i8 %62, -65
%64 = icmp ult i8 %63, 26
br i1 %64, label %65, label %71
65: ; preds = %61
%66 = icmp eq i32 %42, %50
br i1 %66, label %67, label %69
67: ; preds = %65
store i8 0, i8* %48
%68 = call i32 @strcpy(i8* %0, i8* %5)
br label %69
69: ; preds = %67, %65
%70 = add nsw i32 %50, 1
br label %71
71: ; preds = %61, %69, %58
%72 = phi i32 [ %70, %69 ], [ %50, %61 ], [ %50, %58 ]
store i8 0, i8* %5
%73 = call i32* @fgets(i8* %5, i32 511, i32* %43)
%74 = icmp eq i32* %73, null
br i1 %74, label %75, label %49
75: ; preds = %71, %40
%76 = call i32 @fclose(i32* %43)
%77 = icmp eq i8 %1, 98
br i1 %77, label %78, label %90
78: ; preds = %75
%79 = call i32 @strrep(i8* %0, i8 signext 49, i8 signext 56)
%80 = call i32 @strrep(i8* %0, i8 signext 50, i8 signext 55)
%81 = call i32 @strrep(i8* %0, i8 signext 97, i8 signext 72)
%82 = call i32 @strrep(i8* %0, i8 signext 98, i8 signext 71)
%83 = call i32 @strrep(i8* %0, i8 signext 99, i8 signext 70)
%84 = call i32 @strrep(i8* %0, i8 signext 100, i8 signext 69)
%85 = call i32 @strrep(i8* %0, i8 signext 101, i8 signext 68)
%86 = call i32 @strrep(i8* %0, i8 signext 102, i8 signext 67)
%87 = call i32 @strrep(i8* %0, i8 signext 103, i8 signext 66)
%88 = call i32 @strrep(i8* %0, i8 signext 104, i8 signext 65)
%89 = call i32 @strlwr(i8* %0)
br label %90
90: ; preds = %11, %75, %78, %37, %3
ret i32 0
}