#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*/ isspace(char);
int /*<<< orphan*/ printf(char *, char *);
int strlen(char const *);
int /*<<< orphan*/ strncpy(char *, char const *, int);
int pdecrypt(const char *cipher, int alpha, int beta) {
  int length = strlen(cipher);
  char plain[length];
  strncpy(plain, cipher, length + 1);
  int i, j;
  for (i = j = 0; i < length; i++, j++) {
    if (!isspace(plain[i]))
      plain[j] = ((plain[i] - 65 - beta) / alpha) % 26 + 65;
    else
      j--;
  }
  printf("%s\n", plain);
  return 0;
}


x86 assembly (clang, -O0):
<pdecrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x38(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
add    $0x1,%edx
call   1030 <strncpy@plt>
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    121d <pdecrypt+0xdd>
mov    -0x38(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1060 <isspace@plt>
cmp    $0x0,%eax
jne    11f8 <pdecrypt+0xb8>
mov    -0x38(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x41,%eax
sub    -0x10(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    $0x1a,%ecx
cltd
idiv   %ecx
mov    -0x38(%rbp),%rax
add    $0x41,%edx
movslq -0x30(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1201 <pdecrypt+0xc1>
mov    -0x30(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x30(%rbp)
jmp    1206 <pdecrypt+0xc6>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11a1 <pdecrypt+0x61>
mov    -0x38(%rbp),%rsi
lea    0xdd8(%rip),%rdi
call   1050 <printf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pdecrypt>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,-0x2c(%rbp)
mov    %rdi,%r12
call   1040 <strlen@plt>
mov    %eax,%r13d
mov    %eax,%r15d
mov    %rsp,%r14
lea    0xf(%r15),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
lea    0x1(%r13),%edx
mov    %r14,%rdi
mov    %r12,%rsi
call   1030 <strncpy@plt>
test   %r13d,%r13d
jle    11f6 <pdecrypt+0xb6>
mov    $0xffffffbf,%r12d
sub    %ebx,%r12d
xor    %ebx,%ebx
xor    %r13d,%r13d
jmp    11b1 <pdecrypt+0x71>
cs nopw 0x0(%rax,%rax,1)
add    $0xffffffff,%r13d
add    $0x1,%rbx
add    $0x1,%r13d
cmp    %rbx,%r15
je     11f6 <pdecrypt+0xb6>
movsbl (%r14,%rbx,1),%edi
call   1060 <isspace@plt>
test   %eax,%eax
jne    11a0 <pdecrypt+0x60>
movsbl (%r14,%rbx,1),%eax
add    %r12d,%eax
cltd
idivl  -0x2c(%rbp)
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x41,%al
movslq %r13d,%rcx
mov    %al,(%r14,%rcx,1)
jmp    11a4 <pdecrypt+0x64>
lea    0xe03(%rip),%rdi
mov    %r14,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @pdecrypt(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%12 = load i8*, i8** %4
%13 = call i32 @strlen(i8* %12)
store i32 %13, i32* %7
%14 = load i32, i32* %7
%15 = zext i32 %14 to i64
%16 = call i8* @llvm.stacksave()
store i8* %16, i8** %8
%17 = alloca i8, i64 %15
store i64 %15, i64* %9
%18 = load i8*, i8** %4
%19 = load i32, i32* %7
%20 = add nsw i32 %19, 1
%21 = call i32 @strncpy(i8* %17, i8* %18, i32 %20)
store i32 0, i32* %11
store i32 0, i32* %10
br label %22
22: ; preds = %54, %3
%23 = load i32, i32* %10
%24 = load i32, i32* %7
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %59
26: ; preds = %22
%27 = load i32, i32* %10
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %17, i64 %28
%30 = load i8, i8* %29
%31 = call i32 @isspace(i8 signext %30)
%32 = icmp ne i32 %31, 0
br i1 %32, label %50, label %33
33: ; preds = %26
%34 = load i32, i32* %10
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %17, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = sub nsw i32 %38, 65
%40 = load i32, i32* %6
%41 = sub nsw i32 %39, %40
%42 = load i32, i32* %5
%43 = sdiv i32 %41, %42
%44 = srem i32 %43, 26
%45 = add nsw i32 %44, 65
%46 = trunc i32 %45 to i8
%47 = load i32, i32* %11
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %17, i64 %48
store i8 %46, i8* %49
br label %53
50: ; preds = %26
%51 = load i32, i32* %11
%52 = add nsw i32 %51, -1
store i32 %52, i32* %11
br label %53
53: ; preds = %50, %33
br label %54
54: ; preds = %53
%55 = load i32, i32* %10
%56 = add nsw i32 %55, 1
store i32 %56, i32* %10
%57 = load i32, i32* %11
%58 = add nsw i32 %57, 1
store i32 %58, i32* %11
br label %22
59: ; preds = %22
%60 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %17)
%61 = load i8*, i8** %8
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @pdecrypt(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = zext i32 %4 to i64
%6 = alloca i8, i64 %5
%7 = add nsw i32 %4, 1
%8 = call i32 @strncpy(i8* %6, i8* %0, i32 %7)
%9 = icmp sgt i32 %4, 0
br i1 %9, label %10, label %36
10: ; preds = %3
%11 = sub i32 -65, %2
br label %12
12: ; preds = %10, %31
%13 = phi i64 [ 0, %10 ], [ %33, %31 ]
%14 = phi i32 [ 0, %10 ], [ %34, %31 ]
%15 = getelementptr inbounds i8, i8* %6, i64 %13
%16 = load i8, i8* %15
%17 = call i32 @isspace(i8 signext %16)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %29
19: ; preds = %12
%20 = load i8, i8* %15
%21 = sext i8 %20 to i32
%22 = add i32 %11, %21
%23 = sdiv i32 %22, %1
%24 = srem i32 %23, 26
%25 = trunc i32 %24 to i8
%26 = add nsw i8 %25, 65
%27 = sext i32 %14 to i64
%28 = getelementptr inbounds i8, i8* %6, i64 %27
store i8 %26, i8* %28
br label %31
29: ; preds = %12
%30 = add nsw i32 %14, -1
br label %31
31: ; preds = %19, %29
%32 = phi i32 [ %30, %29 ], [ %14, %19 ]
%33 = add nuw nsw i64 %13, 1
%34 = add nsw i32 %32, 1
%35 = icmp eq i64 %33, %5
br i1 %35, label %36, label %12
36: ; preds = %31, %3
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %6)
ret i32 0
}