#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*/ printf(char *, char);
void decrypt_text_print(char *encrypted_text, char keyword[], int text_length,
                        int keyword_length) {
  int i, stage;
  stage = 0;
  for (i = 0; i < text_length; i++, stage = ((stage + 1) % keyword_length)) {
    int difference;
    char new_letter;
    difference = keyword[stage] - 'a';
    new_letter = (*encrypted_text - 'a') - difference;
    new_letter = (new_letter + 26) % 26;
    new_letter = new_letter + 'a';
    printf("%c", new_letter);
    encrypted_text++;
  }
}


x86 assembly (clang, -O0):
<decrypt_text_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11b7 <decrypt_text_print+0xa7>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x61,%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
sub    $0x61,%eax
sub    -0x24(%rbp),%eax
mov    %al,-0x25(%rbp)
movsbl -0x25(%rbp),%eax
add    $0x1a,%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0x25(%rbp)
movsbl -0x25(%rbp),%eax
add    $0x61,%eax
mov    %al,-0x25(%rbp)
lea    0xe79(%rip),%rdi
movsbl -0x25(%rbp),%esi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
cltd
idivl  -0x18(%rbp)
mov    %edx,-0x20(%rbp)
jmp    1134 <decrypt_text_print+0x24>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decrypt_text_print>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edx,%edx
jle    1180 <decrypt_text_print+0x70>
mov    %ecx,%r14d
mov    %rsi,%r12
mov    %rdi,%r13
mov    %edx,%ebp
xor    %r15d,%r15d
xor    %edx,%edx
nop
movslq %edx,%rbx
movzbl 0x0(%r13,%r15,1),%eax
sub    (%r12,%rbx,1),%al
movsbl %al,%eax
add    $0x1a,%eax
imul   $0x4ec5,%eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
shr    $0x13,%ecx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x61,%al
movsbl %al,%esi
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
add    $0x1,%ebx
mov    %ebx,%eax
cltd
idiv   %r14d
add    $0x1,%r15
cmp    %r15d,%ebp
jne    1130 <decrypt_text_print+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @decrypt_text_print(i8* nocapture %0, i8* nocapture %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %26
6: ; preds = %4, %6
%7 = phi i8* [ %21, %6 ], [ %0, %4 ]
%8 = phi i32 [ %22, %6 ], [ 0, %4 ]
%9 = phi i32 [ %24, %6 ], [ 0, %4 ]
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %1, i64 %10
%12 = load i8, i8* %11
%13 = load i8, i8* %7
%14 = sub i8 %13, %12
%15 = sext i8 %14 to i16
%16 = add nsw i16 %15, 26
%17 = srem i16 %16, 26
%18 = trunc i16 %17 to i8
%19 = add nsw i8 %18, 97
%20 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %19)
%21 = getelementptr inbounds i8, i8* %7, i64 1
%22 = add nuw nsw i32 %8, 1
%23 = add nsw i32 %9, 1
%24 = srem i32 %23, %3
%25 = icmp eq i32 %22, %2
br i1 %25, label %26, label %6
26: ; preds = %6, %4
ret void
}