#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 *crypt_messageA(char *, long, long);
long *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
long *genere_aleatoireA(char *c, long e2, long n2, char *texte) {
  int i;
  long *message = malloc(sizeof(long));
  long *decimal = CharToDecimalA(texte);
  if (c[0] == 'A' && c[1] == 'B' && c[2] == 'O' && c[3] == 'K') {
    printf("\n-----------------CONFIRMATION DANS A----------------\n");
    printf("Genere 4 caracteres aleatoire\n");
    for (i = 0; i < 4; ++i) {
      printf("%c = %ld", texte[i], decimal[i]);
      if (i < 3) {
        printf(", ");
      }
    }
    printf("\n");
    message = crypt_messageA(texte, e2, n2);
  } else {
    message[0] = '0';
  }
  return message;
}


x86 assembly (clang, -O0):
<genere_aleatoireA>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <CharToDecimalA@plt>
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jne    125c <genere_aleatoireA+0x11c>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x42,%eax
jne    125c <genere_aleatoireA+0x11c>
mov    -0x8(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x4f,%eax
jne    125c <genere_aleatoireA+0x11c>
mov    -0x8(%rbp),%rax
movsbl 0x3(%rax),%eax
cmp    $0x4b,%eax
jne    125c <genere_aleatoireA+0x11c>
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x4,-0x24(%rbp)
jge    1234 <genere_aleatoireA+0xf4>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
mov    -0x38(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x3,-0x24(%rbp)
jge    1221 <genere_aleatoireA+0xe1>
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1226 <genere_aleatoireA+0xe6>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11d9 <genere_aleatoireA+0x99>
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <crypt_messageA@plt>
mov    %rax,-0x30(%rbp)
jmp    1267 <genere_aleatoireA+0x127>
mov    -0x30(%rbp),%rax
movq   $0x30,(%rax)
mov    -0x30(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<genere_aleatoireA>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r13
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
mov    $0x8,%edi
call   1070 <malloc@plt>
mov    %rax,%rbp
mov    %r13,%rdi
call   1080 <CharToDecimalA@plt>
cmpb   $0x41,(%rbx)
jne    126f <genere_aleatoireA+0x10f>
cmpb   $0x42,0x1(%rbx)
jne    126f <genere_aleatoireA+0x10f>
cmpb   $0x4f,0x2(%rbx)
jne    126f <genere_aleatoireA+0x10f>
cmpb   $0x4b,0x3(%rbx)
jne    126f <genere_aleatoireA+0x10f>
mov    %rax,%r12
lea    0xe4f(%rip),%rdi
call   1040 <puts@plt>
lea    0xe79(%rip),%rdi
call   1040 <puts@plt>
movsbl 0x0(%r13),%esi
mov    (%r12),%rdx
lea    0xe22(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe1a(%rip),%rbp
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0x1(%r13),%esi
mov    0x8(%r12),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0x2(%r13),%esi
mov    0x10(%r12),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0x3(%r13),%esi
mov    0x18(%r12),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r13,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <crypt_messageA@plt>
movq   $0x30,0x0(%rbp)
mov    %rbp,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [55 x i8] c"\0A-----------------CONFIRMATION DANS A----------------\0A\00"
@.str.1 = [31 x i8] c"Genere 4 caracteres aleatoire\0A\00"
@.str.2 = [9 x i8] c"%c = %ld\00"
@.str.3 = [3 x i8] c", \00"
@.str.4 = [2 x i8] c"\0A\00"
define i64* @genere_aleatoireA(i8* %0, i64 %1, i64 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i64*
%11 = alloca i64*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i8* %3, i8** %8
%12 = call i64* @malloc(i32 8)
store i64* %12, i64** %10
%13 = load i8*, i8** %8
%14 = call i64* @CharToDecimalA(i8* %13)
store i64* %14, i64** %11
%15 = load i8*, i8** %5
%16 = getelementptr inbounds i8, i8* %15, i64 0
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 65
br i1 %19, label %20, label %71
20: ; preds = %4
%21 = load i8*, i8** %5
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 66
br i1 %25, label %26, label %71
26: ; preds = %20
%27 = load i8*, i8** %5
%28 = getelementptr inbounds i8, i8* %27, i64 2
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 79
br i1 %31, label %32, label %71
32: ; preds = %26
%33 = load i8*, i8** %5
%34 = getelementptr inbounds i8, i8* %33, i64 3
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 75
br i1 %37, label %38, label %71
38: ; preds = %32
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %9
br label %41
41: ; preds = %62, %38
%42 = load i32, i32* %9
%43 = icmp slt i32 %42, 4
br i1 %43, label %44, label %65
44: ; preds = %41
%45 = load i8*, i8** %8
%46 = load i32, i32* %9
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %45, i64 %47
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = load i64*, i64** %11
%52 = load i32, i32* %9
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i64, i64* %51, i64 %53
%55 = load i64, i64* %54
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %50, i64 %55)
%57 = load i32, i32* %9
%58 = icmp slt i32 %57, 3
br i1 %58, label %59, label %61
59: ; preds = %44
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %61
61: ; preds = %59, %44
br label %62
62: ; preds = %61
%63 = load i32, i32* %9
%64 = add nsw i32 %63, 1
store i32 %64, i32* %9
br label %41
65: ; preds = %41
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%67 = load i8*, i8** %8
%68 = load i64, i64* %6
%69 = load i64, i64* %7
%70 = call i64* @crypt_messageA(i8* %67, i64 %68, i64 %69)
store i64* %70, i64** %10
br label %74
71: ; preds = %32, %26, %20, %4
%72 = load i64*, i64** %10
%73 = getelementptr inbounds i64, i64* %72, i64 0
store i64 48, i64* %73
br label %74
74: ; preds = %71, %65
%75 = load i64*, i64** %10
ret i64* %75
}

LLVM IR (-O2):
@.str.2 = [9 x i8] c"%c = %ld\00"
@.str.3 = [3 x i8] c", \00"
@str = [54 x i8] c"\0A-----------------CONFIRMATION DANS A----------------\00"
@str.5 = [30 x i8] c"Genere 4 caracteres aleatoire\00"
define i64* @genere_aleatoireA(i8* nocapture %0, i64 %1, i64 %2, i8* %3) {
%5 = tail call i64* @malloc(i32 8)
%6 = tail call i64* @CharToDecimalA(i8* %3)
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 65
br i1 %8, label %9, label %51
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %0, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 66
br i1 %12, label %13, label %51
13: ; preds = %9
%14 = getelementptr inbounds i8, i8* %0, i64 2
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 79
br i1 %16, label %17, label %51
17: ; preds = %13
%18 = getelementptr inbounds i8, i8* %0, i64 3
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 75
br i1 %20, label %21, label %51
21: ; preds = %17
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.5, i64 0, i64 0))
%24 = load i8, i8* %3
%25 = sext i8 %24 to i32
%26 = load i64, i64* %6
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %25, i64 %26)
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%29 = getelementptr inbounds i8, i8* %3, i64 1
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = getelementptr inbounds i64, i64* %6, i64 1
%33 = load i64, i64* %32
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %31, i64 %33)
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%36 = getelementptr inbounds i8, i8* %3, i64 2
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = getelementptr inbounds i64, i64* %6, i64 2
%40 = load i64, i64* %39
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %38, i64 %40)
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%43 = getelementptr inbounds i8, i8* %3, i64 3
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = getelementptr inbounds i64, i64* %6, i64 3
%47 = load i64, i64* %46
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %45, i64 %47)
%49 = tail call i32 @putchar(i32 10)
%50 = tail call i64* @crypt_messageA(i8* %3, i64 %1, i64 %2)
br label %52
51: ; preds = %17, %13, %9, %4
store i64 48, i64* %5
br label %52
52: ; preds = %51, %21
%53 = phi i64* [ %50, %21 ], [ %5, %51 ]
ret i64* %53
}