#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 */
long *CharToDecimalA(char *);
long *powmodA(long *, long, long);
int /*<<< orphan*/ printf(char *, ...);
long *crypt_messageA(char *M, long e, long n) {
  printf("Message a envoyer : ");
  int i;
  for (i = 0; i < 4; ++i) {
    printf("%c", M[i]);
    if (i < 3) {
      printf(", ");
    }
  }
  printf("\n");
  printf("--------------------Crypter--------------------\n");
  long *m = CharToDecimalA(M);
  long *C = powmodA(m, e, n);
  int j;
  printf("Message crypte : ");
  for (j = 0; j < 4; ++j) {
    printf("%ld", C[j]);
    if (j < 3) {
      printf(", ");
    }
  }
  printf("\n");
  return C;
}


x86 assembly (clang, -O0):
<crypt_messageA>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jge    11a8 <crypt_messageA+0x78>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x3,-0x1c(%rbp)
jge    1195 <crypt_messageA+0x65>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119a <crypt_messageA+0x6a>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1159 <crypt_messageA+0x29>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <CharToDecimalA@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <powmodA@plt>
mov    %rax,-0x30(%rbp)
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x4,-0x34(%rbp)
jge    124a <crypt_messageA+0x11a>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x3,-0x34(%rbp)
jge    1237 <crypt_messageA+0x107>
lea    0xde8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123c <crypt_messageA+0x10c>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11fb <crypt_messageA+0xcb>
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crypt_messageA>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xe98(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl (%rbx),%edi
call   1030 <putchar@plt>
lea    0xe97(%rip),%r12
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x1(%rbx),%edi
call   1030 <putchar@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x2(%rbx),%edi
call   1030 <putchar@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x3(%rbx),%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe66(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1060 <CharToDecimalA@plt>
mov    %rax,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1070 <powmodA@plt>
mov    %rax,%rbx
lea    0xe2b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rbx),%rsi
lea    0xe2c(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rbx),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rbx),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%rbx),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [21 x i8] c"Message a envoyer : \00"
@.str.2 = [3 x i8] c", \00"
@.str.5 = [18 x i8] c"Message crypte : \00"
@.str.6 = [4 x i8] c"%ld\00"
@str = [48 x i8] c"--------------------Crypter--------------------\00"
define i64* @crypt_messageA(i8* %0, i64 %1, i64 %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%5 = load i8, i8* %0
%6 = sext i8 %5 to i32
%7 = tail call i32 @putchar(i32 %6)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%9 = getelementptr inbounds i8, i8* %0, i64 1
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = tail call i32 @putchar(i32 %11)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%14 = getelementptr inbounds i8, i8* %0, i64 2
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = tail call i32 @putchar(i32 %16)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%19 = getelementptr inbounds i8, i8* %0, i64 3
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = tail call i32 @putchar(i32 %21)
%23 = tail call i32 @putchar(i32 10)
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%25 = tail call i64* @CharToDecimalA(i8* %0)
%26 = tail call i64* @powmodA(i64* %25, i64 %1, i64 %2)
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%28 = load i64, i64* %26
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i64 %28)
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%31 = getelementptr inbounds i64, i64* %26, i64 1
%32 = load i64, i64* %31
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i64 %32)
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%35 = getelementptr inbounds i64, i64* %26, i64 2
%36 = load i64, i64* %35
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i64 %36)
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%39 = getelementptr inbounds i64, i64* %26, i64 3
%40 = load i64, i64* %39
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i64 %40)
%42 = tail call i32 @putchar(i32 10)
ret i64* %26
}