#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*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int strlen(char *);
int main(void) {
  int a, b;
  int a_inv;
  int D;
  char clave[] = "ABCDEFGHIJKLMNnOPQRSTUVWXYZ*";
  char mensaje[1000];
  char decodificado[1000];
  int codif;
  int matriz[100][3];
  int i = 2;
  int cociente;
  int j, k;
  printf("Introduce los dos numeros del criptosistema afin: \n");
  scanf("%d", &a);
  scanf("%d", &b);
  printf("Introduce el mensaje a decodificar: \n");
  scanf("%s", mensaje);
  for (j = 0; j < 100; j++) {
    for (k = 0; k < 3; k++) {
      matriz[j][k] = 0;
    }
  }
  matriz[0][1] = 1;
  matriz[1][2] = 1;
  matriz[0][0] = a;
  matriz[1][0] = 28;
  while (1) {
    cociente = (matriz[i - 2][0] / matriz[i - 1][0]);
    matriz[i][0] = (matriz[i - 2][0] % matriz[i - 1][0]);
    matriz[i][1] = (matriz[i - 2][1] - (cociente * matriz[i - 1][1]));
    matriz[i][2] = (matriz[i - 2][2] - (cociente * matriz[i - 1][2]));
    if (matriz[i][0] == 0)
      break;
    i++;
  }
  printf("El inverso de %d modulo 28 es %d\n", a, matriz[i - 1][1]);
  printf("Comprobamos: %d * %d = %d\n", a, matriz[i - 1][1],
         matriz[i - 1][1] * a);
  a_inv = (matriz[i - 1][1] % 28);
  for (i = 0; i < strlen(mensaje); i++) {
    codif = 0;
    j = 0;
    while (codif == 0) {
      if (mensaje[i] == clave[j]) {
        decodificado[i] = clave[((a_inv * (j - b)) + 2800) % 28];
        codif = 1;
      }
      j++;
    }
  }
  decodificado[i] = '\0';
  printf("Mensaje decodificado: \n%s", decodificado);
  getchar();
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd00,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xea4(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xea1(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe9f(%rip),%eax
mov    %eax,-0x28(%rbp)
mov    0xe9a(%rip),%al
mov    %al,-0x24(%rbp)
movl   $0x2,-0xce4(%rbp)
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xead(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    0xe9b(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x430(%rbp),%rsi
lea    0xef1(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
movl   $0x0,-0xcec(%rbp)
cmpl   $0x64,-0xcec(%rbp)
jge    1262 <main+0x122>
movl   $0x0,-0xcf0(%rbp)
cmpl   $0x3,-0xcf0(%rbp)
jge    1249 <main+0x109>
movslq -0xcec(%rbp),%rcx
lea    -0xce0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0xcf0(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0xcf0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcf0(%rbp)
jmp    1205 <main+0xc5>
jmp    124e <main+0x10e>
mov    -0xcec(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcec(%rbp)
jmp    11ee <main+0xae>
movl   $0x1,-0xcdc(%rbp)
movl   $0x1,-0xccc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xce0(%rbp)
movl   $0x1c,-0xcd4(%rbp)
mov    -0xce4(%rbp),%eax
sub    $0x2,%eax
movslq %eax,%rcx
lea    -0xce0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%eax
mov    -0xce4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rdx
lea    -0xce0(%rbp),%rcx
imul   $0xc,%rdx,%rdx
add    %rdx,%rcx
cltd
idivl  (%rcx)
mov    %eax,-0xce8(%rbp)
mov    -0xce4(%rbp),%eax
sub    $0x2,%eax
movslq %eax,%rcx
lea    -0xce0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%eax
mov    -0xce4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rdx
lea    -0xce0(%rbp),%rcx
imul   $0xc,%rdx,%rdx
add    %rdx,%rcx
cltd
idivl  (%rcx)
movslq -0xce4(%rbp),%rcx
lea    -0xce0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    %edx,(%rax)
mov    -0xce4(%rbp),%eax
sub    $0x2,%eax
movslq %eax,%rcx
lea    -0xce0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%ecx
mov    -0xce8(%rbp),%eax
mov    -0xce4(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rsi
lea    -0xce0(%rbp),%rdx
imul   $0xc,%rsi,%rsi
add    %rsi,%rdx
imul   0x4(%rdx),%eax
sub    %eax,%ecx
movslq -0xce4(%rbp),%rdx
lea    -0xce0(%rbp),%rax
imul   $0xc,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x4(%rax)
mov    -0xce4(%rbp),%eax
sub    $0x2,%eax
movslq %eax,%rcx
lea    -0xce0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x8(%rax),%ecx
mov    -0xce8(%rbp),%eax
mov    -0xce4(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rsi
lea    -0xce0(%rbp),%rdx
imul   $0xc,%rsi,%rsi
add    %rsi,%rdx
imul   0x8(%rdx),%eax
sub    %eax,%ecx
movslq -0xce4(%rbp),%rdx
lea    -0xce0(%rbp),%rax
imul   $0xc,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x8(%rax)
movslq -0xce4(%rbp),%rcx
lea    -0xce0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
cmpl   $0x0,(%rax)
jne    13f1 <main+0x2b1>
jmp    1405 <main+0x2c5>
mov    -0xce4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xce4(%rbp)
jmp    1289 <main+0x149>
mov    -0x8(%rbp),%esi
mov    -0xce4(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0xce0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%edx
lea    0xc4e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xce4(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0xce0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%edx
mov    -0xce4(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0xce0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%ecx
imul   -0x8(%rbp),%ecx
lea    0xc21(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xce4(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0xce0(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%eax
mov    $0x1c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
movl   $0x0,-0xce4(%rbp)
mov    -0xce4(%rbp),%eax
mov    %eax,-0xcf4(%rbp)
lea    -0x430(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0xcf4(%rbp),%eax
cmp    %ecx,%eax
jge    1588 <main+0x448>
movl   $0x0,-0x824(%rbp)
movl   $0x0,-0xcec(%rbp)
cmpl   $0x0,-0x824(%rbp)
jne    156f <main+0x42f>
movslq -0xce4(%rbp),%rax
movsbl -0x430(%rbp,%rax,1),%eax
ff
movslq -0xcec(%rbp),%rcx
movsbl -0x40(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    155b <main+0x41b>
mov    -0x10(%rbp),%eax
mov    -0xcec(%rbp),%ecx
sub    -0xc(%rbp),%ecx
imul   %ecx,%eax
add    $0xaf0,%eax
mov    $0x1c,%ecx
cltd
idiv   %ecx
movslq %edx,%rax
mov    -0x40(%rbp,%rax,1),%cl
movslq -0xce4(%rbp),%rax
mov    %cl,-0x820(%rbp,%rax,1)
movl   $0x1,-0x824(%rbp)
mov    -0xcec(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcec(%rbp)
jmp    14f0 <main+0x3b0>
jmp    1574 <main+0x434>
mov    -0xce4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xce4(%rbp)
jmp    14b4 <main+0x374>
movslq -0xce4(%rbp),%rax
movb   $0x0,-0x820(%rbp,%rax,1)
lea    -0x820(%rbp),%rsi
lea    0xb12(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    -0x4(%rbp),%eax
add    $0xd00,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0xc98,%rsp
lea    0xf03(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9d(%rip),%rbx
xor    %r14d,%r14d
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <scanf@plt>
lea    0xf02(%rip),%rdi
call   1030 <puts@plt>
lea    0xec0(%rip),%rdi
lea    0x4c0(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
lea    0x10(%rsp),%rdi
mov    $0x4b0,%edx
xor    %esi,%esi
call   1060 <memset@plt>
movl   $0x1,0x14(%rsp)
movl   $0x1,0x24(%rsp)
mov    0x8(%rsp),%esi
mov    %esi,0x10(%rsp)
movl   $0x1c,0x1c(%rsp)
lea    0x30(%rsp),%rdi
mov    $0x1c,%edx
mov    $0x1,%r9d
xor    %ebp,%ebp
mov    $0x1,%ebx
mov    %esi,%eax
nopl   (%rax)
mov    %edx,%r8d
cltd
idiv   %r8d
mov    %eax,%ecx
mov    %ebp,%r10d
mov    %r9d,%r11d
mov    %r8d,%eax
mov    %edx,-0x8(%rdi)
imul   %ecx,%ebp
sub    %ebp,%ebx
mov    %ebx,-0x4(%rdi)
imul   %r9d,%ecx
sub    %ecx,%r14d
mov    %r14d,(%rdi)
add    $0xc,%rdi
mov    %r14d,%r9d
mov    %r11d,%r14d
mov    %ebx,%ebp
mov    %r10d,%ebx
test   %edx,%edx
jne    1210 <main+0xb0>
movslq -0x1c(%rdi),%rbx
lea    0xdcb(%rip),%rdi
xor    %ebp,%ebp
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%esi
mov    %esi,%ecx
imul   %ebx,%ecx
lea    0xdd2(%rip),%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x4c0(%rsp),%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1332 <main+0x1d2>
imul   $0xffffffff92492493,%rbx,%rax
shr    $0x20,%rax
add    %ebx,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x4,%eax
add    %ecx,%eax
lea    (%rax,%rax,8),%ecx
lea    (%rcx,%rcx,2),%ecx
add    %eax,%ecx
sub    %ecx,%ebx
xor    %ebp,%ebp
lea    0xd48(%rip),%r15
lea    0x4c0(%rsp),%r14
mov    0x4c0(%rsp,%rbp,1),%cl
mov    0xc(%rsp),%eax
not    %eax
imul   %ebx,%eax
add    $0xaf0,%eax
mov    %r15,%rdx
nopl   0x0(%rax,%rax,1)
add    %ebx,%eax
lea    0x1(%rdx),%rsi
cmp    (%rdx),%cl
mov    %rsi,%rdx
jne    12e0 <main+0x180>
cltq
imul   $0xffffffff92492493,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x4,%ecx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%edx
lea    (%rdx,%rdx,2),%edx
add    %ecx,%edx
sub    %edx,%eax
cltq
mov    (%rax,%r15,1),%al
mov    %al,0x8b0(%rsp,%rbp,1)
add    $0x1,%rbp
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbp
jl     12c0 <main+0x160>
mov    %ebp,%ebp
movb   $0x0,0x8b0(%rsp,%rbp,1)
lea    0xd1c(%rip),%rdi
lea    0x8b0(%rsp),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
xor    %eax,%eax
add    $0xc98,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.clave = [29 x i8] c"ABCDEFGHIJKLMNnOPQRSTUVWXYZ*\00"
@.str = [52 x i8] c"Introduce los dos numeros del criptosistema afin: \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [38 x i8] c"Introduce el mensaje a decodificar: \0A\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [34 x i8] c"El inverso de %d modulo 28 es %d\0A\00"
@.str.5 = [27 x i8] c"Comprobamos: %d * %d = %d\0A\00"
@.str.6 = [26 x i8] c"Mensaje decodificado: \0A%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [29 x i8]
%7 = alloca [1000 x i8]
%8 = alloca [1000 x i8]
%9 = alloca i32
%10 = alloca [100 x [3 x i32]]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %1
%15 = bitcast [29 x i8]* %6 to i8*
store i32 2, i32* %11
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%20 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %20)
store i32 0, i32* %13
br label %22
22: ; preds = %40, %0
%23 = load i32, i32* %13
%24 = icmp slt i32 %23, 100
br i1 %24, label %25, label %43
25: ; preds = %22
store i32 0, i32* %14
br label %26
26: ; preds = %36, %25
%27 = load i32, i32* %14
%28 = icmp slt i32 %27, 3
br i1 %28, label %29, label %39
29: ; preds = %26
%30 = load i32, i32* %13
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %10, i64 0, i64 %31
%33 = load i32, i32* %14
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [3 x i32], [3 x i32]* %32, i64 0, i64 %34
store i32 0, i32* %35
br label %36
36: ; preds = %29
%37 = load i32, i32* %14
%38 = add nsw i32 %37, 1
store i32 %38, i32* %14
br label %26
39: ; preds = %26
br label %40
40: ; preds = %39
%41 = load i32, i32* %13
%42 = add nsw i32 %41, 1
store i32 %42, i32* %13
br label %22
43: ; preds = %22
%44 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %10, i64 0, i64 0
%45 = getelementptr inbounds [3 x i32], [3 x i32]* %44, i64 0, i64 1
store i32 1, i32* %45
%46 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %10, i64 0, i64 1
%47 = getelementptr inbounds [3 x i32], [3 x i32]* %46, i64 0, i64 2
store i32 1, i32* %47
%48 = load i32, i32* %2
%49 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %10, i64 0, i64 0
%50 = getelementptr inbounds [3 x i32], [3 x i32]* %49, i64 0, i64 0
store i32 %48, i32* %50
%51 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %10, i64 0, i64 1
%52 = getelementptr inbounds [3 x i32], [3 x i32]* %51, i64 0, i64 0
store i32 28, i32* %52
br label %53
53: ; preds = %43, %129
%54 = load i32, i32* %11
%55 = sub nsw i32 %54, 2
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %10, i64 0, i64 %56
%58 = getelementptr inbounds [3 x i32], [3 x i32]* %57, i64 0, i64 0
%59 = load i32, i32* %58
%60 = load i32, i32* %11
%61 = sub nsw i32 %60, 1
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %10, i64 0, i64 %62
%64 = getelementptr inbounds [3 x i32], [3 x i32]* %63, i64 0, i64 0
%65 = load i32, i32* %64
%66 = sdiv i32 %59, %65
store i32 %66, i32* %12
%67 = load i32, i32* %11
%68 = sub nsw i32 %67, 2
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %10, i64 0, i64 %69
%71 = getelementptr inbounds [3 x i32], [3 x i32]* %70, i64 0, i64 0
%72 = load i32, i32* %71
%73 = load i32, i32* %11
%74 = sub nsw i32 %73, 1
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %10, i64 0, i64 %75
%77 = getelementptr inbounds [3 x i32], [3 x i32]* %76, i64 0, i64 0
%78 = load i32, i32* %77
%79 = srem i32 %72, %78
%80 = load i32, i32* %11
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %10, i64 0, i64 %81
%83 = getelementptr inbounds [3 x i32], [3 x i32]* %82, i64 0, i64 0
store i32 %79, i32* %83
%84 = load i32, i32* %11
%85 = sub nsw i32 %84, 2
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %10, i64 0, i64 %86
%88 = getelementptr inbounds [3 x i32], [3 x i32]* %87, i64 0, i64 1
%89 = load i32, i32* %88
%90 = load i32, i32* %12
%91 = load i32, i32* %11
%92 = sub nsw i32 %91, 1
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %10, i64 0, i64 %93
%95 = getelementptr inbounds [3 x i32], [3 x i32]* %94, i64 0, i64 1
%96 = load i32, i32* %95
%97 = mul nsw i32 %90, %96
%98 = sub nsw i32 %89, %97
%99 = load i32, i32* %11
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %10, i64 0, i64 %100
%102 = getelementptr inbounds [3 x i32], [3 x i32]* %101, i64 0, i64 1
store i32 %98, i32* %102
%103 = load i32, i32* %11
%104 = sub nsw i32 %103, 2
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %10, i64 0, i64 %105
%107 = getelementptr inbounds [3 x i32], [3 x i32]* %106, i64 0, i64 2
%108 = load i32, i32* %107
%109 = load i32, i32* %12
%110 = load i32, i32* %11
%111 = sub nsw i32 %110, 1
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %10, i64 0, i64 %112
%114 = getelementptr inbounds [3 x i32], [3 x i32]* %113, i64 0, i64 2
%115 = load i32, i32* %114
%116 = mul nsw i32 %109, %115
%117 = sub nsw i32 %108, %116
%118 = load i32, i32* %11
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %10, i64 0, i64 %119
%121 = getelementptr inbounds [3 x i32], [3 x i32]* %120, i64 0, i64 2
store i32 %117, i32* %121
%122 = load i32, i32* %11
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %10, i64 0, i64 %123
%125 = getelementptr inbounds [3 x i32], [3 x i32]* %124, i64 0, i64 0
%126 = load i32, i32* %125
%127 = icmp eq i32 %126, 0
br i1 %127, label %128, label %129
128: ; preds = %53
br label %132
129: ; preds = %53
%130 = load i32, i32* %11
%131 = add nsw i32 %130, 1
store i32 %131, i32* %11
br label %53
132: ; preds = %128
%133 = load i32, i32* %2
%134 = load i32, i32* %11
%135 = sub nsw i32 %134, 1
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %10, i64 0, i64 %136
%138 = getelementptr inbounds [3 x i32], [3 x i32]* %137, i64 0, i64 1
%139 = load i32, i32* %138
%140 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 %133, i32 %139)
%141 = load i32, i32* %2
%142 = load i32, i32* %11
%143 = sub nsw i32 %142, 1
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %10, i64 0, i64 %144
%146 = getelementptr inbounds [3 x i32], [3 x i32]* %145, i64 0, i64 1
%147 = load i32, i32* %146
%148 = load i32, i32* %11
%149 = sub nsw i32 %148, 1
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %10, i64 0, i64 %150
%152 = getelementptr inbounds [3 x i32], [3 x i32]* %151, i64 0, i64 1
%153 = load i32, i32* %152
%154 = load i32, i32* %2
%155 = mul nsw i32 %153, %154
%156 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i32 %141, i32 %147, i32 %155)
%157 = load i32, i32* %11
%158 = sub nsw i32 %157, 1
%159 = sext i32 %158 to i64
%160 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %10, i64 0, i64 %159
%161 = getelementptr inbounds [3 x i32], [3 x i32]* %160, i64 0, i64 1
%162 = load i32, i32* %161
%163 = srem i32 %162, 28
store i32 %163, i32* %4
store i32 0, i32* %11
br label %164
164: ; preds = %203, %132
%165 = load i32, i32* %11
%166 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
%167 = call i32 @strlen(i8* %166)
%168 = icmp slt i32 %165, %167
br i1 %168, label %169, label %206
169: ; preds = %164
store i32 0, i32* %9
store i32 0, i32* %13
br label %170
170: ; preds = %199, %169
%171 = load i32, i32* %9
%172 = icmp eq i32 %171, 0
br i1 %172, label %173, label %202
173: ; preds = %170
%174 = load i32, i32* %11
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 %175
%177 = load i8, i8* %176
%178 = sext i8 %177 to i32
%179 = load i32, i32* %13
%180 = sext i32 %179 to i64
%181 = getelementptr inbounds [29 x i8], [29 x i8]* %6, i64 0, i64 %180
%182 = load i8, i8* %181
%183 = sext i8 %182 to i32
%184 = icmp eq i32 %178, %183
br i1 %184, label %185, label %199
185: ; preds = %173
%186 = load i32, i32* %4
%187 = load i32, i32* %13
%188 = load i32, i32* %3
%189 = sub nsw i32 %187, %188
%190 = mul nsw i32 %186, %189
%191 = add nsw i32 %190, 2800
%192 = srem i32 %191, 28
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds [29 x i8], [29 x i8]* %6, i64 0, i64 %193
%195 = load i8, i8* %194
%196 = load i32, i32* %11
%197 = sext i32 %196 to i64
%198 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 %197
store i8 %195, i8* %198
store i32 1, i32* %9
br label %199
199: ; preds = %185, %173
%200 = load i32, i32* %13
%201 = add nsw i32 %200, 1
store i32 %201, i32* %13
br label %170
202: ; preds = %170
br label %203
203: ; preds = %202
%204 = load i32, i32* %11
%205 = add nsw i32 %204, 1
store i32 %205, i32* %11
br label %164
206: ; preds = %164
%207 = load i32, i32* %11
%208 = sext i32 %207 to i64
%209 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 %208
store i8 0, i8* %209
%210 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%211 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %210)
%212 = call i32 (...) @getchar()
%213 = call i32 (...) @getchar()
%214 = load i32, i32* %1
ret i32 %214
}

LLVM IR (-O2):
@__const.main.clave = [29 x i8] c"ABCDEFGHIJKLMNnOPQRSTUVWXYZ*\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [34 x i8] c"El inverso de %d modulo 28 es %d\0A\00"
@.str.5 = [27 x i8] c"Comprobamos: %d * %d = %d\0A\00"
@.str.6 = [26 x i8] c"Mensaje decodificado: \0A%s\00"
@str = [51 x i8] c"Introduce los dos numeros del criptosistema afin: \00"
@str.7 = [37 x i8] c"Introduce el mensaje a decodificar: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [1000 x i8]
%4 = alloca [1000 x i8]
%5 = alloca [100 x [3 x i32]]
%6 = bitcast [100 x [3 x i32]]* %5 to i8*
%7 = bitcast i32* %1 to i8*
%8 = bitcast i32* %2 to i8*
%9 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.7, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %9)
%16 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %5, i64 0, i64 0, i64 1
store i32 1, i32* %16
%17 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %5, i64 0, i64 1, i64 2
store i32 1, i32* %17
%18 = load i32, i32* %1
%19 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %5, i64 0, i64 0, i64 0
store i32 %18, i32* %19
%20 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %5, i64 0, i64 1, i64 0
store i32 28, i32* %20
br label %21
21: ; preds = %21, %0
%22 = phi i32 [ %36, %21 ], [ 1, %0 ]
%23 = phi i32 [ %22, %21 ], [ 0, %0 ]
%24 = phi i32 [ %33, %21 ], [ 0, %0 ]
%25 = phi i32 [ %24, %21 ], [ 1, %0 ]
%26 = phi i32 [ %30, %21 ], [ 28, %0 ]
%27 = phi i32 [ %26, %21 ], [ %18, %0 ]
%28 = phi i64 [ %39, %21 ], [ 2, %0 ]
%29 = sdiv i32 %27, %26
%30 = srem i32 %27, %26
%31 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %5, i64 0, i64 %28, i64 0
store i32 %30, i32* %31
%32 = mul nsw i32 %24, %29
%33 = sub nsw i32 %25, %32
%34 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %5, i64 0, i64 %28, i64 1
store i32 %33, i32* %34
%35 = mul nsw i32 %22, %29
%36 = sub nsw i32 %23, %35
%37 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %5, i64 0, i64 %28, i64 2
store i32 %36, i32* %37
%38 = icmp eq i32 %30, 0
%39 = add nuw i64 %28, 1
br i1 %38, label %40, label %21
40: ; preds = %21
%41 = add nsw i64 %28, -1
%42 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %5, i64 0, i64 %41, i64 1
%43 = load i32, i32* %42
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 %18, i32 %43)
%45 = load i32, i32* %1
%46 = mul nsw i32 %45, %43
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i32 %45, i32 %43, i32 %46)
%48 = srem i32 %43, 28
%49 = call i32 @strlen(i8* %9)
%50 = icmp sgt i32 %49, 0
br i1 %50, label %51, label %78
51: ; preds = %40, %63
%52 = phi i64 [ %72, %63 ], [ 0, %40 ]
%53 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %52
%54 = load i8, i8* %53
%55 = load i32, i32* %2
%56 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 %52
br label %57
57: ; preds = %57, %51
%58 = phi i64 [ 0, %51 ], [ %62, %57 ]
%59 = getelementptr inbounds [29 x i8], [29 x i8]* @__const.main.clave, i64 0, i64 %58
%60 = load i8, i8* %59
%61 = icmp eq i8 %54, %60
%62 = add nuw i64 %58, 1
br i1 %61, label %63, label %57
63: ; preds = %57
%64 = trunc i64 %58 to i32
%65 = sub nsw i32 %64, %55
%66 = mul nsw i32 %65, %48
%67 = add nsw i32 %66, 2800
%68 = srem i32 %67, 28
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [29 x i8], [29 x i8]* @__const.main.clave, i64 0, i64 %69
%71 = load i8, i8* %70
store i8 %71, i8* %56
%72 = add nuw nsw i64 %52, 1
%73 = call i32 @strlen(i8* %9)
%74 = sext i32 %73 to i64
%75 = icmp slt i64 %72, %74
br i1 %75, label %51, label %76
76: ; preds = %63
%77 = and i64 %72, 4294967295
br label %78
78: ; preds = %76, %40
%79 = phi i64 [ 0, %40 ], [ %77, %76 ]
%80 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 %79
store i8 0, i8* %80
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %10)
%82 = call i32 (...) @getchar()
%83 = call i32 (...) @getchar()
ret i32 0
}