#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*/ fprintf(int /*<<< orphan*/, char *, char, unsigned char,
                           unsigned int);
int /*<<< orphan*/ stderr;
int denormalize_malbolge(char *normalized_code, int normalized_code_offset,
                         int code_len, int no_error_printing) {
  unsigned int c = normalized_code_offset;
  int i = 0;
  for (i = 0; i < code_len; i++) {
    unsigned char in = (unsigned char)(*normalized_code);
    unsigned int instruction = 0;
    switch (in) {
    case 'o':
      instruction = 68;
      break;
    case 'j':
      instruction = 40;
      break;
    case 'p':
      instruction = 62;
      break;
    case '*':
      instruction = 39;
      break;
    case 'i':
      instruction = 4;
      break;
    case '<':
      instruction = 5;
      break;
    case '/':
      instruction = 23;
      break;
    case 'v':
      instruction = 81;
      break;
    }
    if (instruction != 0) {
      unsigned int code = ((instruction + 94 - (c % 94)) % 94);
      if (code < 33)
        code += 94;
      *normalized_code = (char)code;
      c++;
    } else {
      if (!no_error_printing) {
        fprintf(stderr,
                "Internal error: Found character: '%c' (%d) at %d during code "
                "denormalization.\n",
                *normalized_code, in, c);
      }
      return 0;
    }
    normalized_code++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<denormalize_malbolge>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    128e <denormalize_malbolge+0x17e>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x25(%rbp)
movl   $0x0,-0x2c(%rbp)
movzbl -0x25(%rbp),%eax
add    $0xffffffd6,%eax
mov    %eax,%ecx
mov    %rcx,-0x38(%rbp)
sub    $0x4c,%eax
ja     11da <denormalize_malbolge+0xca>
mov    -0x38(%rbp),%rax
lea    0xe8a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x44,-0x2c(%rbp)
jmp    11da <denormalize_malbolge+0xca>
movl   $0x28,-0x2c(%rbp)
jmp    11da <denormalize_malbolge+0xca>
movl   $0x3e,-0x2c(%rbp)
jmp    11da <denormalize_malbolge+0xca>
movl   $0x27,-0x2c(%rbp)
jmp    11da <denormalize_malbolge+0xca>
movl   $0x4,-0x2c(%rbp)
jmp    11da <denormalize_malbolge+0xca>
movl   $0x5,-0x2c(%rbp)
jmp    11da <denormalize_malbolge+0xca>
movl   $0x17,-0x2c(%rbp)
jmp    11da <denormalize_malbolge+0xca>
movl   $0x51,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     1236 <denormalize_malbolge+0x126>
mov    -0x2c(%rbp),%eax
add    $0x5e,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x20(%rbp),%eax
mov    $0x5e,%ecx
xor    %edx,%edx
div    %ecx
mov    -0x3c(%rbp),%eax
sub    %edx,%eax
mov    $0x5e,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0x30(%rbp)
cmpl   $0x21,-0x30(%rbp)
jae    121d <denormalize_malbolge+0x10d>
mov    -0x30(%rbp),%eax
add    $0x5e,%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1274 <denormalize_malbolge+0x164>
cmpl   $0x0,-0x1c(%rbp)
jne    1268 <denormalize_malbolge+0x158>
mov    0x2d99(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x25(%rbp),%al
mov    -0x20(%rbp),%r8d
lea    0xed7(%rip),%rsi
movsbl %cl,%edx
movzbl %al,%ecx
call   1030 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1295 <denormalize_malbolge+0x185>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1139 <denormalize_malbolge+0x29>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<denormalize_malbolge>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%r14d
test   %edx,%edx
jle    1216 <denormalize_malbolge+0x106>
mov    %edx,%r9d
mov    %esi,%r11d
neg    %r11b
xor    %eax,%eax
mov    $0xae4c415d,%r8d
lea    0xec3(%rip),%r10
mov    %esi,%r15d
jmp    119e <denormalize_malbolge+0x8e>
mov    $0x86,%ebp
nopw   0x0(%rax,%rax,1)
mov    %r15d,%edx
imul   %r8,%rdx
shr    $0x26,%rdx
imul   $0x5e,%edx,%edx
add    %r11b,%dl
lea    (%rdx,%rbp,1),%ebx
movzbl %bl,%ebx
imul   $0xaf,%ebx,%ebx
shr    $0xe,%ebx
imul   $0x5e,%ebx,%ebx
sub    %bl,%bpl
add    %dl,%bpl
lea    0x5e(%rbp),%edx
cmp    $0x21,%bpl
movzbl %bpl,%ebx
movzbl %dl,%edx
cmovae %ebx,%edx
mov    %dl,(%rdi,%rax,1)
add    $0x1,%r15d
add    $0x1,%rax
add    $0xff,%r11b
cmp    %eax,%r9d
je     1216 <denormalize_malbolge+0x106>
movzbl (%rdi,%rax,1),%ebx
lea    -0x2a(%rbx),%edx
cmp    $0x4c,%dl
ja     11ee <denormalize_malbolge+0xde>
mov    $0xa2,%ebp
movzbl %dl,%edx
movslq (%r10,%rdx,4),%rdx
add    %r10,%rdx
jmp    *%rdx
mov    $0x85,%ebp
jmp    1150 <denormalize_malbolge+0x40>
mov    $0x75,%ebp
jmp    1150 <denormalize_malbolge+0x40>
mov    $0x63,%ebp
jmp    1150 <denormalize_malbolge+0x40>
mov    $0x62,%ebp
jmp    1150 <denormalize_malbolge+0x40>
mov    $0x9c,%ebp
jmp    1150 <denormalize_malbolge+0x40>
mov    $0xaf,%ebp
jmp    1150 <denormalize_malbolge+0x40>
xor    %r14d,%r14d
test   %ecx,%ecx
jne    1216 <denormalize_malbolge+0x106>
mov    %esi,%r8d
add    %rax,%r8
mov    0x2dde(%rip),%rax
mov    (%rax),%edi
movsbl %bl,%edx
movzbl %bl,%ecx
lea    0xf23(%rip),%rsi
call   1030 <fprintf@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [79 x i8] c"Internal error: Found character: '%c' (%d) at %d during code denormalization.\0A\00"
define i32 @denormalize_malbolge(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8
%13 = alloca i32
%14 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%15 = load i32, i32* %7
store i32 %15, i32* %10
store i32 0, i32* %11
store i32 0, i32* %11
br label %16
16: ; preds = %68, %4
%17 = load i32, i32* %11
%18 = load i32, i32* %8
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %71
20: ; preds = %16
%21 = load i8*, i8** %6
%22 = load i8, i8* %21
store i8 %22, i8* %12
store i32 0, i32* %13
%23 = load i8, i8* %12
%24 = zext i8 %23 to i32
switch i32 %24, label %33 [
i32 111, label %25
i32 106, label %26
i32 112, label %27
i32 42, label %28
i32 105, label %29
i32 60, label %30
i32 47, label %31
i32 118, label %32
]
25: ; preds = %20
store i32 68, i32* %13
br label %33
26: ; preds = %20
store i32 40, i32* %13
br label %33
27: ; preds = %20
store i32 62, i32* %13
br label %33
28: ; preds = %20
store i32 39, i32* %13
br label %33
29: ; preds = %20
store i32 4, i32* %13
br label %33
30: ; preds = %20
store i32 5, i32* %13
br label %33
31: ; preds = %20
store i32 23, i32* %13
br label %33
32: ; preds = %20
store i32 81, i32* %13
br label %33
33: ; preds = %20, %32, %31, %30, %29, %28, %27, %26, %25
%34 = load i32, i32* %13
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %54
36: ; preds = %33
%37 = load i32, i32* %13
%38 = add i32 %37, 94
%39 = load i32, i32* %10
%40 = urem i32 %39, 94
%41 = sub i32 %38, %40
%42 = urem i32 %41, 94
store i32 %42, i32* %14
%43 = load i32, i32* %14
%44 = icmp ult i32 %43, 33
br i1 %44, label %45, label %48
45: ; preds = %36
%46 = load i32, i32* %14
%47 = add i32 %46, 94
store i32 %47, i32* %14
br label %48
48: ; preds = %45, %36
%49 = load i32, i32* %14
%50 = trunc i32 %49 to i8
%51 = load i8*, i8** %6
store i8 %50, i8* %51
%52 = load i32, i32* %10
%53 = add i32 %52, 1
store i32 %53, i32* %10
br label %65
54: ; preds = %33
%55 = load i32, i32* %9
%56 = icmp ne i32 %55, 0
br i1 %56, label %64, label %57
57: ; preds = %54
%58 = load i32, i32* @stderr
%59 = load i8*, i8** %6
%60 = load i8, i8* %59
%61 = load i8, i8* %12
%62 = load i32, i32* %10
%63 = call i32 @fprintf(i32 %58, i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0), i8 signext %60, i8 zeroext %61, i32 %62)
br label %64
64: ; preds = %57, %54
store i32 0, i32* %5
br label %72
65: ; preds = %48
%66 = load i8*, i8** %6
%67 = getelementptr inbounds i8, i8* %66, i32 1
store i8* %67, i8** %6
br label %68
68: ; preds = %65
%69 = load i32, i32* %11
%70 = add nsw i32 %69, 1
store i32 %70, i32* %11
br label %16
71: ; preds = %16
store i32 1, i32* %5
br label %72
72: ; preds = %71, %64
%73 = load i32, i32* %5
ret i32 %73
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [79 x i8] c"Internal error: Found character: '%c' (%d) at %d during code denormalization.\0A\00"
define i32 @denormalize_malbolge(i8* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %36
6: ; preds = %4, %23
%7 = phi i32 [ %34, %23 ], [ 0, %4 ]
%8 = phi i32 [ %32, %23 ], [ %1, %4 ]
%9 = phi i8* [ %33, %23 ], [ %0, %4 ]
%10 = load i8, i8* %9
switch i8 %10, label %18 [
i8 111, label %23
i8 106, label %11
i8 112, label %12
i8 42, label %13
i8 105, label %14
i8 60, label %15
i8 47, label %16
i8 118, label %17
]
11: ; preds = %6
br label %23
12: ; preds = %6
br label %23
13: ; preds = %6
br label %23
14: ; preds = %6
br label %23
15: ; preds = %6
br label %23
16: ; preds = %6
br label %23
17: ; preds = %6
br label %23
18: ; preds = %6
%19 = icmp eq i32 %3, 0
br i1 %19, label %20, label %36
20: ; preds = %18
%21 = load i32, i32* @stderr
%22 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0), i8 signext %10, i8 zeroext %10, i32 %8)
br label %36
23: ; preds = %6, %17, %16, %15, %14, %13, %12, %11
%24 = phi i32 [ 134, %11 ], [ 156, %12 ], [ 133, %13 ], [ 98, %14 ], [ 99, %15 ], [ 117, %16 ], [ 175, %17 ], [ 162, %6 ]
%25 = urem i32 %8, 94
%26 = sub nuw nsw i32 %24, %25
%27 = trunc i32 %26 to i8
%28 = urem i8 %27, 94
%29 = icmp ult i8 %28, 33
%30 = add nuw i8 %28, 94
%31 = select i1 %29, i8 %30, i8 %28
store i8 %31, i8* %9
%32 = add i32 %8, 1
%33 = getelementptr inbounds i8, i8* %9, i64 1
%34 = add nuw nsw i32 %7, 1
%35 = icmp eq i32 %34, %2
br i1 %35, label %36, label %6
36: ; preds = %23, %4, %18, %20
%37 = phi i32 [ 0, %20 ], [ 0, %18 ], [ 1, %4 ], [ 1, %23 ]
ret i32 %37
}