#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*/ affichePhrase(char *, int);
int /*<<< orphan*/ crypte(char *, int, char *);
int /*<<< orphan*/ decrypte(char *, int, char *);
int lirePhrase(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  printf("Cle de chiffrage: \n");
  char key[255];
  scanf("%s", key);
  printf("Phrase a chiffrer (entre \"):\n");
  char phrase[255];
  int count = lirePhrase(phrase);
  crypte(phrase, count, key);
  affichePhrase(phrase, count);
  printf("\n");
  decrypte(phrase, count, key);
  affichePhrase(phrase, count);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe87(%rip),%rdi
call   1040 <printf@plt>
lea    -0x110(%rbp),%rsi
lea    0xe88(%rip),%rdi
call   1060 <scanf@plt>
lea    0xe7f(%rip),%rdi
call   1040 <printf@plt>
lea    -0x210(%rbp),%rdi
call   1030 <lirePhrase@plt>
mov    %eax,-0x214(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x214(%rbp),%esi
lea    -0x110(%rbp),%rdx
call   1070 <crypte@plt>
lea    -0x210(%rbp),%rdi
mov    -0x214(%rbp),%esi
call   1050 <affichePhrase@plt>
lea    0xe31(%rip),%rdi
call   1040 <printf@plt>
lea    -0x210(%rbp),%rdi
mov    -0x214(%rbp),%esi
lea    -0x110(%rbp),%rdx
call   1080 <decrypte@plt>
lea    -0x210(%rbp),%rdi
mov    -0x214(%rbp),%esi
call   1050 <affichePhrase@plt>
lea    0xdfa(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x200,%rsp
lea    0xe81(%rip),%rdi
call   1050 <puts@plt>
lea    0xe72(%rip),%rdi
lea    0x100(%rsp),%r14
mov    %r14,%rsi
call   1070 <scanf@plt>
lea    0xe71(%rip),%rdi
call   1050 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <lirePhrase@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r14,%rdx
call   1080 <crypte@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1060 <affichePhrase@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
call   1090 <decrypte@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1060 <affichePhrase@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Cle de chiffrage: \0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [30 x i8] c"Phrase a chiffrer (entre \22):\0A\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [255 x i8]
%3 = alloca [255 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%9 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%10 = call i32 @lirePhrase(i8* %9)
store i32 %10, i32* %4
%11 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%12 = load i32, i32* %4
%13 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%14 = call i32 @crypte(i8* %11, i32 %12, i8* %13)
%15 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%16 = load i32, i32* %4
%17 = call i32 @affichePhrase(i8* %15, i32 %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%19 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%20 = load i32, i32* %4
%21 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%22 = call i32 @decrypte(i8* %19, i32 %20, i8* %21)
%23 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%24 = load i32, i32* %4
%25 = call i32 @affichePhrase(i8* %23, i32 %24)
%26 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@str = [19 x i8] c"Cle de chiffrage: \00"
@str.4 = [29 x i8] c"Phrase a chiffrer (entre \22):\00"
define i32 @main() {
%1 = alloca [255 x i8]
%2 = alloca [255 x i8]
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%4 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.4, i64 0, i64 0))
%7 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%8 = call i32 @lirePhrase(i8* %7)
%9 = call i32 @crypte(i8* %7, i32 %8, i8* %4)
%10 = call i32 @affichePhrase(i8* %7, i32 %8)
%11 = call i32 @putchar(i32 10)
%12 = call i32 @decrypte(i8* %7, i32 %8, i8* %4)
%13 = call i32 @affichePhrase(i8* %7, i32 %8)
%14 = call i32 @putchar(i32 10)
ret i32 0
}