#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 offset) {
  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 - offset) % 26 + 65;
    else
      j--;
  }
  printf("%s\n", plain);
  return 0;
}


x86 assembly (clang, -O0):
<pdecrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x30(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%edx
add    $0x1,%edx
call   1030 <strncpy@plt>
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1216 <pdecrypt+0xd6>
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1060 <isspace@plt>
cmp    $0x0,%eax
jne    11f1 <pdecrypt+0xb1>
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x41,%eax
sub    -0xc(%rbp),%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
mov    -0x30(%rbp),%rax
add    $0x41,%edx
movslq -0x28(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    11fa <pdecrypt+0xba>
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    11ff <pdecrypt+0xbf>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    119e <pdecrypt+0x5e>
mov    -0x30(%rbp),%rsi
lea    0xddf(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%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    %esi,%ebx
mov    %rdi,%r15
call   1040 <strlen@plt>
mov    %eax,%r12d
mov    %eax,%r13d
mov    %rsp,%r14
lea    0xf(%r13),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
lea    0x1(%r12),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <strncpy@plt>
test   %r12d,%r12d
jle    11f2 <pdecrypt+0xb2>
mov    $0xffffffbf,%r15d
sub    %ebx,%r15d
xor    %ebx,%ebx
xor    %r12d,%r12d
jmp    11b1 <pdecrypt+0x71>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0xffffffff,%r12d
add    $0x1,%rbx
add    $0x1,%r12d
cmp    %rbx,%r13
je     11f2 <pdecrypt+0xb2>
movsbl (%r14,%rbx,1),%edi
call   1060 <isspace@plt>
test   %eax,%eax
jne    11a0 <pdecrypt+0x60>
movsbl (%r14,%rbx,1),%eax
add    %r15d,%eax
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 %r12d,%rcx
mov    %al,(%r14,%rcx,1)
jmp    11a4 <pdecrypt+0x64>
lea    0xe07(%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) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%10 = load i8*, i8** %3
%11 = call i32 @strlen(i8* %10)
store i32 %11, i32* %5
%12 = load i32, i32* %5
%13 = zext i32 %12 to i64
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %6
%15 = alloca i8, i64 %13
store i64 %13, i64* %7
%16 = load i8*, i8** %3
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
%19 = call i32 @strncpy(i8* %15, i8* %16, i32 %18)
store i32 0, i32* %9
store i32 0, i32* %8
br label %20
20: ; preds = %50, %2
%21 = load i32, i32* %8
%22 = load i32, i32* %5
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %55
24: ; preds = %20
%25 = load i32, i32* %8
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %15, i64 %26
%28 = load i8, i8* %27
%29 = call i32 @isspace(i8 signext %28)
%30 = icmp ne i32 %29, 0
br i1 %30, label %46, label %31
31: ; preds = %24
%32 = load i32, i32* %8
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %15, i64 %33
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = sub nsw i32 %36, 65
%38 = load i32, i32* %4
%39 = sub nsw i32 %37, %38
%40 = srem i32 %39, 26
%41 = add nsw i32 %40, 65
%42 = trunc i32 %41 to i8
%43 = load i32, i32* %9
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %15, i64 %44
store i8 %42, i8* %45
br label %49
46: ; preds = %24
%47 = load i32, i32* %9
%48 = add nsw i32 %47, -1
store i32 %48, i32* %9
br label %49
49: ; preds = %46, %31
br label %50
50: ; preds = %49
%51 = load i32, i32* %8
%52 = add nsw i32 %51, 1
store i32 %52, i32* %8
%53 = load i32, i32* %9
%54 = add nsw i32 %53, 1
store i32 %54, i32* %9
br label %20
55: ; preds = %20
%56 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %15)
%57 = load i8*, i8** %6
ret i32 0
}

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