#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*/ enc_type_2(unsigned int *, unsigned int);
unsigned int seed_step(unsigned int);
unsigned int fst_cipher_mangle_enc_type(unsigned int seed,
                                        unsigned int enc_type) {
  unsigned int key_80[20];
  int i;
  for (i = 0; i < 20; i++) {
    seed = seed_step(seed);
    key_80[i] = seed;
  }
  seed = seed_step(seed);
  enc_type_2(key_80, seed);
  return enc_type ^ key_80[7];
}


x86 assembly (clang, -O0):
<fst_cipher_mangle_enc_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0x64(%rbp)
cmpl   $0x14,-0x64(%rbp)
jge    1163 <fst_cipher_mangle_enc_type+0x43>
mov    -0x4(%rbp),%edi
call   1040 <seed_step@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
movslq -0x64(%rbp),%rax
mov    %ecx,-0x60(%rbp,%rax,4)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1135 <fst_cipher_mangle_enc_type+0x15>
mov    -0x4(%rbp),%edi
call   1040 <seed_step@plt>
mov    %eax,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1030 <enc_type_2@plt>
mov    -0x8(%rbp),%eax
xor    -0x44(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fst_cipher_mangle_enc_type>:
push   %rbx
sub    $0x50,%rsp
mov    %esi,%ebx
call   1040 <seed_step@plt>
mov    %eax,(%rsp)
mov    %eax,%edi
call   1040 <seed_step@plt>
mov    %eax,0x4(%rsp)
mov    %eax,%edi
call   1040 <seed_step@plt>
mov    %eax,0x8(%rsp)
mov    %eax,%edi
call   1040 <seed_step@plt>
mov    %eax,0xc(%rsp)
mov    %eax,%edi
call   1040 <seed_step@plt>
mov    %eax,0x10(%rsp)
mov    %eax,%edi
call   1040 <seed_step@plt>
mov    %eax,0x14(%rsp)
mov    %eax,%edi
call   1040 <seed_step@plt>
mov    %eax,0x18(%rsp)
mov    %eax,%edi
call   1040 <seed_step@plt>
mov    %eax,0x1c(%rsp)
mov    %eax,%edi
call   1040 <seed_step@plt>
mov    %eax,0x20(%rsp)
mov    %eax,%edi
call   1040 <seed_step@plt>
mov    %eax,0x24(%rsp)
mov    %eax,%edi
call   1040 <seed_step@plt>
mov    %eax,0x28(%rsp)
mov    %eax,%edi
call   1040 <seed_step@plt>
mov    %eax,0x2c(%rsp)
mov    %eax,%edi
call   1040 <seed_step@plt>
mov    %eax,0x30(%rsp)
mov    %eax,%edi
call   1040 <seed_step@plt>
mov    %eax,0x34(%rsp)
mov    %eax,%edi
call   1040 <seed_step@plt>
mov    %eax,0x38(%rsp)
mov    %eax,%edi
call   1040 <seed_step@plt>
mov    %eax,0x3c(%rsp)
mov    %eax,%edi
call   1040 <seed_step@plt>
mov    %eax,0x40(%rsp)
mov    %eax,%edi
call   1040 <seed_step@plt>
mov    %eax,0x44(%rsp)
mov    %eax,%edi
call   1040 <seed_step@plt>
mov    %eax,0x48(%rsp)
mov    %eax,%edi
call   1040 <seed_step@plt>
mov    %eax,0x4c(%rsp)
mov    %eax,%edi
call   1040 <seed_step@plt>
mov    %rsp,%rdi
mov    %eax,%esi
call   1030 <enc_type_2@plt>
xor    0x1c(%rsp),%ebx
mov    %ebx,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @fst_cipher_mangle_enc_type(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [20 x i32]
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %6
br label %7
7: ; preds = %17, %2
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 20
br i1 %9, label %10, label %20
10: ; preds = %7
%11 = load i32, i32* %3
%12 = call i32 @seed_step(i32 %11)
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [20 x i32], [20 x i32]* %5, i64 0, i64 %15
store i32 %13, i32* %16
br label %17
17: ; preds = %10
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
br label %7
20: ; preds = %7
%21 = load i32, i32* %3
%22 = call i32 @seed_step(i32 %21)
store i32 %22, i32* %3
%23 = getelementptr inbounds [20 x i32], [20 x i32]* %5, i64 0, i64 0
%24 = load i32, i32* %3
%25 = call i32 @enc_type_2(i32* %23, i32 %24)
%26 = load i32, i32* %4
%27 = getelementptr inbounds [20 x i32], [20 x i32]* %5, i64 0, i64 7
%28 = load i32, i32* %27
%29 = xor i32 %26, %28
ret i32 %29
}

LLVM IR (-O2):
define i32 @fst_cipher_mangle_enc_type(i32 %0, i32 %1) {
%3 = alloca [20 x i32]
%4 = bitcast [20 x i32]* %3 to i8*
%5 = tail call i32 @seed_step(i32 %0)
%6 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 0
store i32 %5, i32* %6
%7 = tail call i32 @seed_step(i32 %5)
%8 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 1
store i32 %7, i32* %8
%9 = tail call i32 @seed_step(i32 %7)
%10 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 2
store i32 %9, i32* %10
%11 = tail call i32 @seed_step(i32 %9)
%12 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 3
store i32 %11, i32* %12
%13 = tail call i32 @seed_step(i32 %11)
%14 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 4
store i32 %13, i32* %14
%15 = tail call i32 @seed_step(i32 %13)
%16 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 5
store i32 %15, i32* %16
%17 = tail call i32 @seed_step(i32 %15)
%18 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 6
store i32 %17, i32* %18
%19 = tail call i32 @seed_step(i32 %17)
%20 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 7
store i32 %19, i32* %20
%21 = tail call i32 @seed_step(i32 %19)
%22 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 8
store i32 %21, i32* %22
%23 = tail call i32 @seed_step(i32 %21)
%24 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 9
store i32 %23, i32* %24
%25 = tail call i32 @seed_step(i32 %23)
%26 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 10
store i32 %25, i32* %26
%27 = tail call i32 @seed_step(i32 %25)
%28 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 11
store i32 %27, i32* %28
%29 = tail call i32 @seed_step(i32 %27)
%30 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 12
store i32 %29, i32* %30
%31 = tail call i32 @seed_step(i32 %29)
%32 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 13
store i32 %31, i32* %32
%33 = tail call i32 @seed_step(i32 %31)
%34 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 14
store i32 %33, i32* %34
%35 = tail call i32 @seed_step(i32 %33)
%36 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 15
store i32 %35, i32* %36
%37 = tail call i32 @seed_step(i32 %35)
%38 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 16
store i32 %37, i32* %38
%39 = tail call i32 @seed_step(i32 %37)
%40 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 17
store i32 %39, i32* %40
%41 = tail call i32 @seed_step(i32 %39)
%42 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 18
store i32 %41, i32* %42
%43 = tail call i32 @seed_step(i32 %41)
%44 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 19
store i32 %43, i32* %44
%45 = tail call i32 @seed_step(i32 %43)
%46 = call i32 @enc_type_2(i32* %6, i32 %45)
%47 = load i32, i32* %20
%48 = xor i32 %47, %1
ret i32 %48
}