int main(void) {
  char key[] = {"MaStErSuPeRhYpErKeY"};
  char pass[32] = {0};
  char hash[32] = {"X?'r+zW8PFUs"};
  int idx, ckey;
  for (idx = strlen(hash) - 1; idx >= 0;
       ckey = strlen(key) - (idx % strlen(key)) - 1,
      pass[idx] = ((key[ckey] - '0') ^ (hash[idx] + 100)) - '1', idx--)
    ;
  printf("Password: %s\n", pass);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb4(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb2(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1050 <memset@plt>
mov    0xea8(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xea5(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xea2(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xe9f(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    -0x60(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%rax
mov    %eax,-0x64(%rbp)
cmpl   $0x0,-0x64(%rbp)
jl     1229 <main+0xf9>
jmp    11bc <main+0x8c>
lea    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x70(%rbp)
movslq -0x64(%rbp),%rax
mov    %rax,-0x78(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x78(%rbp),%rax
xor    %edx,%edx
div    %rcx
mov    -0x70(%rbp),%rax
sub    %rdx,%rax
sub    $0x1,%rax
mov    %eax,-0x68(%rbp)
movslq -0x68(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
sub    $0x30,%eax
movslq -0x64(%rbp),%rcx
movsbl -0x60(%rbp,%rcx,1),%ecx
add    $0x64,%ecx
xor    %ecx,%eax
sub    $0x31,%eax
mov    %al,%cl
movslq -0x64(%rbp),%rax
mov    %cl,-0x40(%rbp,%rax,1)
mov    -0x64(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x64(%rbp)
jmp    11ad <main+0x7d>
lea    -0x40(%rbp),%rsi
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x61686e65,0x8(%rsp)
61
movabs $0x73616d69635f6564,%rax
6d 61 73
mov    %rax,(%rsp)
lea    0xec3(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.key = [20 x i8] c"MaStErSuPeRhYpErKeY\00"
@__const.main.hash = [32 x i8] c"X?'r+zW8PFUs\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [14 x i8] c"Password: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca [32 x i8]
%4 = alloca [32 x i8]
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [20 x i8]* %2 to i8*
%8 = bitcast [32 x i8]* %3 to i8*
%9 = bitcast [32 x i8]* %4 to i8*
%10 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%11 = call i64 @strlen(i8* %10)
%12 = sub i64 %11, 1
%13 = trunc i64 %12 to i32
store i32 %13, i32* %5
br label %14
14: ; preds = %18, %0
%15 = load i32, i32* %5
%16 = icmp sge i32 %15, 0
br i1 %16, label %17, label %49
17: ; preds = %14
br label %18
18: ; preds = %17
%19 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%20 = call i64 @strlen(i8* %19)
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%24 = call i64 @strlen(i8* %23)
%25 = urem i64 %22, %24
%26 = sub i64 %20, %25
%27 = sub i64 %26, 1
%28 = trunc i64 %27 to i32
store i32 %28, i32* %6
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = sub nsw i32 %33, 48
%35 = load i32, i32* %5
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = add nsw i32 %39, 100
%41 = xor i32 %34, %40
%42 = sub nsw i32 %41, 49
%43 = trunc i32 %42 to i8
%44 = load i32, i32* %5
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 %45
store i8 %43, i8* %46
%47 = load i32, i32* %5
%48 = add nsw i32 %47, -1
store i32 %48, i32* %5
br label %14
49: ; preds = %14
%50 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %50)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Password: %s\0A\00"
define i32 @main() {
%1 = alloca [32 x i8]
%2 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 11
store i8 97, i8* %3
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 10
store i8 104, i8* %4
%5 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 9
store i8 110, i8* %5
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 8
store i8 101, i8* %6
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 7
store i8 115, i8* %7
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 6
store i8 97, i8* %8
%9 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 5
store i8 109, i8* %9
%10 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 4
store i8 105, i8* %10
%11 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 3
store i8 99, i8* %11
%12 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 2
store i8 95, i8* %12
%13 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 1
store i8 101, i8* %13
store i8 100, i8* %2
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}