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

/* Variables and functions */
int /*<<< orphan*/ setup(char *, char *, char *, char *, char *, char *,
                         long *);
int /*<<< orphan*/ shuffle(char *, char *, long *);
int /*<<< orphan*/ strcpy(char *, char *);
void fix_string(char *strof, int strl) {
  char t1[256];
  char t2[256];
  char t3[256];
  char deck[256];
  char buf[13], buf1[14];
  long seed;
  register int i, n1, n2, nr1, nr2;
  int secureflg = 1;
  for (i = 0; i < 256; i++) {
    t1[i] = t2[i] = t3[i] = deck[i] = 0;
  }
  strcpy(buf1, "*@d^_~#d%^7*a");
  setup(buf1, t1, t2, t3, buf, deck, &seed);
  n1 = 0;
  n2 = 0;
  nr2 = 0;
  for (i = 0; i < strl; i++) {
    if (secureflg) {
      nr1 = deck[n1] & 0377;
      nr2 = deck[nr1] & 0377;
    } else {
      nr1 = n1;
    }
    strof[i] =
        t2[(t3[(t1[(strof[i] + nr1) & 0377] + nr2) & 0377] - nr2) & 0377] - nr1;
    n1++;
    if (n1 == 256) {
      n1 = 0;
      n2++;
      if (n2 == 256)
        n2 = 0;
      if (secureflg) {
        shuffle(deck, buf, &seed);
      } else {
        nr2 = n2;
      }
    }
  }
}


x86 assembly (clang, -O0):
<fix_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x460,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x1,-0x450(%rbp)
movl   $0x0,-0x43c(%rbp)
cmpl   $0x100,-0x43c(%rbp)
jge    11b6 <fix_string+0x86>
movslq -0x43c(%rbp),%rax
movb   $0x0,-0x410(%rbp,%rax,1)
movslq -0x43c(%rbp),%rax
movb   $0x0,-0x310(%rbp,%rax,1)
movslq -0x43c(%rbp),%rax
movb   $0x0,-0x210(%rbp,%rax,1)
movslq -0x43c(%rbp),%rax
movb   $0x0,-0x110(%rbp,%rax,1)
mov    -0x43c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x43c(%rbp)
jmp    1156 <fix_string+0x26>
lea    -0x42b(%rbp),%rdi
lea    0xe3c(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x42b(%rbp),%rdi
lea    -0x110(%rbp),%rsi
lea    -0x210(%rbp),%rdx
lea    -0x310(%rbp),%rcx
lea    -0x41d(%rbp),%r8
lea    -0x410(%rbp),%r9
lea    -0x438(%rbp),%rax
mov    %rax,(%rsp)
call   1050 <setup@plt>
movl   $0x0,-0x440(%rbp)
movl   $0x0,-0x444(%rbp)
movl   $0x0,-0x44c(%rbp)
movl   $0x0,-0x43c(%rbp)
mov    -0x43c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1398 <fix_string+0x268>
cmpl   $0x0,-0x450(%rbp)
je     1280 <fix_string+0x150>
movslq -0x440(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%eax
ff
and    $0xff,%eax
mov    %eax,-0x448(%rbp)
movslq -0x448(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%eax
ff
and    $0xff,%eax
mov    %eax,-0x44c(%rbp)
jmp    128c <fix_string+0x15c>
mov    -0x440(%rbp),%eax
mov    %eax,-0x448(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x43c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
add    -0x448(%rbp),%eax
and    $0xff,%eax
cltq
movsbl -0x110(%rbp,%rax,1),%eax
ff
add    -0x44c(%rbp),%eax
and    $0xff,%eax
cltq
movsbl -0x310(%rbp,%rax,1),%eax
ff
sub    -0x44c(%rbp),%eax
and    $0xff,%eax
cltq
movsbl -0x210(%rbp,%rax,1),%eax
ff
sub    -0x448(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0x43c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x440(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x440(%rbp)
cmpl   $0x100,-0x440(%rbp)
jne    137f <fix_string+0x24f>
movl   $0x0,-0x440(%rbp)
mov    -0x444(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x444(%rbp)
cmpl   $0x100,-0x444(%rbp)
jne    1342 <fix_string+0x212>
movl   $0x0,-0x444(%rbp)
cmpl   $0x0,-0x450(%rbp)
je     136e <fix_string+0x23e>
lea    -0x410(%rbp),%rdi
lea    -0x41d(%rbp),%rsi
lea    -0x438(%rbp),%rdx
call   1040 <shuffle@plt>
jmp    137a <fix_string+0x24a>
mov    -0x444(%rbp),%eax
mov    %eax,-0x44c(%rbp)
jmp    137f <fix_string+0x24f>
jmp    1384 <fix_string+0x254>
mov    -0x43c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x43c(%rbp)
jmp    122b <fix_string+0xfb>
add    $0x460,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fix_string>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x438,%rsp
mov    %esi,%r14d
mov    %rdi,%r13
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0x110(%rsp)
movaps %xmm0,0x220(%rsp)
movaps %xmm0,0x210(%rsp)
movaps %xmm0,0x200(%rsp)
movaps %xmm0,0x1f0(%rsp)
movaps %xmm0,0x1e0(%rsp)
movaps %xmm0,0x1d0(%rsp)
movaps %xmm0,0x1c0(%rsp)
movaps %xmm0,0x1b0(%rsp)
movaps %xmm0,0x1a0(%rsp)
movaps %xmm0,0x190(%rsp)
movaps %xmm0,0x180(%rsp)
movaps %xmm0,0x170(%rsp)
movaps %xmm0,0x160(%rsp)
movaps %xmm0,0x150(%rsp)
movaps %xmm0,0x140(%rsp)
movaps %xmm0,0x130(%rsp)
movaps %xmm0,0x230(%rsp)
movaps %xmm0,0x240(%rsp)
movaps %xmm0,0x250(%rsp)
movaps %xmm0,0x260(%rsp)
movaps %xmm0,0x270(%rsp)
movaps %xmm0,0x280(%rsp)
movaps %xmm0,0x290(%rsp)
movaps %xmm0,0x2a0(%rsp)
movaps %xmm0,0x2b0(%rsp)
movaps %xmm0,0x2c0(%rsp)
movaps %xmm0,0x2d0(%rsp)
movaps %xmm0,0x2e0(%rsp)
movaps %xmm0,0x2f0(%rsp)
movaps %xmm0,0x300(%rsp)
movaps %xmm0,0x310(%rsp)
movaps %xmm0,0x320(%rsp)
movaps %xmm0,0x420(%rsp)
movaps %xmm0,0x410(%rsp)
movaps %xmm0,0x400(%rsp)
movaps %xmm0,0x3f0(%rsp)
movaps %xmm0,0x3e0(%rsp)
movaps %xmm0,0x3d0(%rsp)
movaps %xmm0,0x3c0(%rsp)
movaps %xmm0,0x3b0(%rsp)
movaps %xmm0,0x3a0(%rsp)
movaps %xmm0,0x390(%rsp)
movaps %xmm0,0x380(%rsp)
movaps %xmm0,0x370(%rsp)
movaps %xmm0,0x360(%rsp)
movaps %xmm0,0x350(%rsp)
movaps %xmm0,0x340(%rsp)
movaps %xmm0,0x330(%rsp)
lea    0xcc1(%rip),%rsi
lea    0x122(%rsp),%rbp
mov    %rbp,%rdi
call   1030 <strcpy@plt>
lea    0x8(%rsp),%rax
mov    %rax,(%rsp)
lea    0x330(%rsp),%rsi
lea    0x230(%rsp),%rdx
lea    0x130(%rsp),%rcx
lea    0x13(%rsp),%r8
lea    0x20(%rsp),%r9
mov    %rbp,%rdi
call   1050 <setup@plt>
test   %r14d,%r14d
jle    1418 <fix_string+0x2e8>
mov    %r14d,%ebp
xor    %ebx,%ebx
lea    0x20(%rsp),%r14
lea    0x13(%rsp),%r15
lea    0x8(%rsp),%r12
xor    %eax,%eax
jmp    13b9 <fix_string+0x289>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbx
cmp    %rbx,%rbp
je     1418 <fix_string+0x2e8>
cltq
movzbl 0x20(%rsp,%rax,1),%ecx
movzbl 0x20(%rsp,%rcx,1),%edx
movzbl 0x0(%r13,%rbx,1),%esi
add    %ecx,%esi
movzbl %sil,%esi
movzbl 0x330(%rsp,%rsi,1),%esi
add    %edx,%esi
movzbl %sil,%esi
movzbl 0x130(%rsp,%rsi,1),%esi
sub    %edx,%esi
movzbl %sil,%edx
movzbl 0x230(%rsp,%rdx,1),%edx
sub    %cl,%dl
mov    %dl,0x0(%r13,%rbx,1)
add    $0x1,%eax
cmp    $0x100,%eax
jne    13b0 <fix_string+0x280>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1040 <shuffle@plt>
xor    %eax,%eax
jmp    13b0 <fix_string+0x280>
add    $0x438,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"*@d^_~#d%^7*a\00"
define void @fix_string(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [256 x i8]
%6 = alloca [256 x i8]
%7 = alloca [256 x i8]
%8 = alloca [256 x i8]
%9 = alloca [13 x i8]
%10 = alloca [14 x i8]
%11 = alloca i64
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 1, i32* %17
store i32 0, i32* %12
br label %18
18: ; preds = %34, %2
%19 = load i32, i32* %12
%20 = icmp slt i32 %19, 256
br i1 %20, label %21, label %37
21: ; preds = %18
%22 = load i32, i32* %12
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 %23
store i8 0, i8* %24
%25 = load i32, i32* %12
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 %26
store i8 0, i8* %27
%28 = load i32, i32* %12
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %29
store i8 0, i8* %30
%31 = load i32, i32* %12
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 %32
store i8 0, i8* %33
br label %34
34: ; preds = %21
%35 = load i32, i32* %12
%36 = add nsw i32 %35, 1
store i32 %36, i32* %12
br label %18
37: ; preds = %18
%38 = getelementptr inbounds [14 x i8], [14 x i8]* %10, i64 0, i64 0
%39 = call i32 @strcpy(i8* %38, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%40 = getelementptr inbounds [14 x i8], [14 x i8]* %10, i64 0, i64 0
%41 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%42 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%43 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%44 = getelementptr inbounds [13 x i8], [13 x i8]* %9, i64 0, i64 0
%45 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%46 = call i32 @setup(i8* %40, i8* %41, i8* %42, i8* %43, i8* %44, i8* %45, i64* %11)
store i32 0, i32* %13
store i32 0, i32* %14
store i32 0, i32* %16
store i32 0, i32* %12
br label %47
47: ; preds = %125, %37
%48 = load i32, i32* %12
%49 = load i32, i32* %4
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %128
51: ; preds = %47
%52 = load i32, i32* %17
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %67
54: ; preds = %51
%55 = load i32, i32* %13
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 %56
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = and i32 %59, 255
store i32 %60, i32* %15
%61 = load i32, i32* %15
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 %62
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = and i32 %65, 255
store i32 %66, i32* %16
br label %69
67: ; preds = %51
%68 = load i32, i32* %13
store i32 %68, i32* %15
br label %69
69: ; preds = %67, %54
%70 = load i8*, i8** %3
%71 = load i32, i32* %12
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8, i8* %70, i64 %72
%74 = load i8, i8* %73
%75 = sext i8 %74 to i32
%76 = load i32, i32* %15
%77 = add nsw i32 %75, %76
%78 = and i32 %77, 255
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 %79
%81 = load i8, i8* %80
%82 = sext i8 %81 to i32
%83 = load i32, i32* %16
%84 = add nsw i32 %82, %83
%85 = and i32 %84, 255
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 %86
%88 = load i8, i8* %87
%89 = sext i8 %88 to i32
%90 = load i32, i32* %16
%91 = sub nsw i32 %89, %90
%92 = and i32 %91, 255
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %93
%95 = load i8, i8* %94
%96 = sext i8 %95 to i32
%97 = load i32, i32* %15
%98 = sub nsw i32 %96, %97
%99 = trunc i32 %98 to i8
%100 = load i8*, i8** %3
%101 = load i32, i32* %12
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds i8, i8* %100, i64 %102
store i8 %99, i8* %103
%104 = load i32, i32* %13
%105 = add nsw i32 %104, 1
store i32 %105, i32* %13
%106 = load i32, i32* %13
%107 = icmp eq i32 %106, 256
br i1 %107, label %108, label %124
108: ; preds = %69
store i32 0, i32* %13
%109 = load i32, i32* %14
%110 = add nsw i32 %109, 1
store i32 %110, i32* %14
%111 = load i32, i32* %14
%112 = icmp eq i32 %111, 256
br i1 %112, label %113, label %114
113: ; preds = %108
store i32 0, i32* %14
br label %114
114: ; preds = %113, %108
%115 = load i32, i32* %17
%116 = icmp ne i32 %115, 0
br i1 %116, label %117, label %121
117: ; preds = %114
%118 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%119 = getelementptr inbounds [13 x i8], [13 x i8]* %9, i64 0, i64 0
%120 = call i32 @shuffle(i8* %118, i8* %119, i64* %11)
br label %123
121: ; preds = %114
%122 = load i32, i32* %14
store i32 %122, i32* %16
br label %123
123: ; preds = %121, %117
br label %124
124: ; preds = %123, %69
br label %125
125: ; preds = %124
%126 = load i32, i32* %12
%127 = add nsw i32 %126, 1
store i32 %127, i32* %12
br label %47
128: ; preds = %47
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"*@d^_~#d%^7*a\00"
define void @fix_string(i8* nocapture %0, i32 %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = alloca [256 x i8]
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%7 = alloca [256 x i8]
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%9 = alloca [256 x i8]
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%11 = alloca [13 x i8]
%12 = alloca [14 x i8]
%13 = alloca i64
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%18 = getelementptr inbounds [13 x i8], [13 x i8]* %11, i64 0, i64 0
%19 = getelementptr inbounds [14 x i8], [14 x i8]* %12, i64 0, i64 0
%20 = bitcast i64* %13 to i8*
%21 = call i32 @strcpy(i8* %19, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%22 = call i32 @setup(i8* %19, i8* %14, i8* %15, i8* %16, i8* %18, i8* %17, i64* %13)
%23 = icmp sgt i32 %1, 0
br i1 %23, label %24, label %64
24: ; preds = %2
%25 = zext i32 %1 to i64
br label %26
26: ; preds = %24, %60
%27 = phi i64 [ 0, %24 ], [ %62, %60 ]
%28 = phi i32 [ 0, %24 ], [ %61, %60 ]
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = zext i8 %31 to i64
%33 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = zext i8 %34 to i32
%36 = getelementptr inbounds i8, i8* %0, i64 %27
%37 = load i8, i8* %36
%38 = zext i8 %37 to i64
%39 = add nuw nsw i64 %38, %32
%40 = and i64 %39, 255
%41 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %40
%42 = load i8, i8* %41
%43 = zext i8 %42 to i32
%44 = add nuw nsw i32 %43, %35
%45 = and i32 %44, 255
%46 = zext i32 %45 to i64
%47 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 %46
%48 = load i8, i8* %47
%49 = zext i8 %48 to i32
%50 = sub nsw i32 %49, %35
%51 = and i32 %50, 255
%52 = zext i32 %51 to i64
%53 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 %52
%54 = load i8, i8* %53
%55 = sub i8 %54, %31
store i8 %55, i8* %36
%56 = add nsw i32 %28, 1
%57 = icmp eq i32 %56, 256
br i1 %57, label %58, label %60
58: ; preds = %26
%59 = call i32 @shuffle(i8* %17, i8* %18, i64* %13)
br label %60
60: ; preds = %26, %58
%61 = phi i32 [ 0, %58 ], [ %56, %26 ]
%62 = add nuw nsw i64 %27, 1
%63 = icmp eq i64 %62, %25
br i1 %63, label %64, label %26
64: ; preds = %60, %2
ret void
}