#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char EOF;
int /*<<< orphan*/ afficheFichier(char *);
int /*<<< orphan*/ corpsMessage(char *, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ filenstr(char *, int /*<<< orphan*/ *, int, char *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
char getchar();
int /*<<< orphan*/ lireChemins(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ remove(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ trouveIdentite(char *, char *);
int main(int argc, char *argv[]) {
  char c;
  char nomFichierSource[150];
  char nomFichierCorps[150];
  char nomFichierCrypte[150];
  char crypter[600];
  char ligne[300];
  char cheminApicrypt[300];
  char cheminApitemp[300];
  char utilisateur[] = "Laurent.MASSON";
  char destinataires[300];
  lireChemins(cheminApicrypt, cheminApitemp);
  sprintf(nomFichierSource, "%smail", cheminApicrypt);
  sprintf(nomFichierCorps, "%smailcorps", cheminApicrypt);
  sprintf(nomFichierCrypte, "%smail.txt", cheminApicrypt);
  FILE *fichier2 = NULL;
  fichier2 = fopen(nomFichierSource, "w+");
  if (fichier2 != NULL) {
    while ((c = getchar()) != EOF) {
      fputc(c, fichier2);
    }
    filenstr("Date:", fichier2, 1, ligne);
    filenstr("Subject:", fichier2, 1, ligne);
    filenstr("To:", fichier2, 1, ligne);
    trouveIdentite(ligne, destinataires);
    filenstr("From:", fichier2, 1, ligne);
    printf("Content-Type: text/plain; charset=ISO-8859-1; "
           "format=flowed\nContent-Transfer-Encoding: 7bit\n\n");
    fclose(fichier2);
    corpsMessage(nomFichierSource, nomFichierCorps);
    sprintf(crypter, "%sapicrypt -s %s -o %s -u %s -k %s -d %s", cheminApicrypt,
            nomFichierCorps, nomFichierCrypte, utilisateur, cheminApicrypt,
            destinataires);
    system(crypter);
    remove(nomFichierSource);
    remove(nomFichierCorps);
    afficheFichier(nomFichierCrypte);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x940,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xe10(%rip),%rax
mov    %rax,-0x7ef(%rbp)
mov    0xe0b(%rip),%eax
mov    %eax,-0x7e7(%rbp)
mov    0xe02(%rip),%ax
mov    %ax,-0x7e3(%rbp)
mov    0xdf7(%rip),%al
mov    %al,-0x7e1(%rbp)
lea    -0x6b0(%rbp),%rdi
lea    -0x7e0(%rbp),%rsi
call   10c0 <lireChemins@plt>
lea    -0xb0(%rbp),%rdi
lea    -0x6b0(%rbp),%rdx
lea    0xdca(%rip),%rsi
mov    $0x0,%al
call   10f0 <sprintf@plt>
lea    -0x150(%rbp),%rdi
lea    -0x6b0(%rbp),%rdx
lea    0xdb5(%rip),%rsi
mov    $0x0,%al
call   10f0 <sprintf@plt>
lea    -0x1f0(%rbp),%rdi
lea    -0x6b0(%rbp),%rdx
lea    0xda5(%rip),%rsi
mov    $0x0,%al
call   10f0 <sprintf@plt>
movq   $0x0,-0x928(%rbp)
lea    -0xb0(%rbp),%rdi
lea    0xd90(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x928(%rbp)
cmpq   $0x0,-0x928(%rbp)
je     1424 <main+0x254>
jmp    12bc <main+0xec>
mov    $0x0,%al
call   1090 <getchar@plt>
mov    %al,-0x11(%rbp)
movsbl %al,%eax
mov    0x2d18(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     12f2 <main+0x122>
mov    -0x11(%rbp),%al
mov    -0x928(%rbp),%rsi
movsbl %al,%edi
call   1080 <fputc@plt>
jmp    12bc <main+0xec>
mov    -0x928(%rbp),%rsi
lea    -0x580(%rbp),%rcx
lea    0xd29(%rip),%rdi
mov    $0x1,%edx
call   10e0 <filenstr@plt>
mov    -0x928(%rbp),%rsi
lea    -0x580(%rbp),%rcx
lea    0xd10(%rip),%rdi
mov    $0x1,%edx
call   10e0 <filenstr@plt>
mov    -0x928(%rbp),%rsi
lea    -0x580(%rbp),%rcx
lea    0xcfa(%rip),%rdi
mov    $0x1,%edx
call   10e0 <filenstr@plt>
lea    -0x580(%rbp),%rdi
lea    -0x920(%rbp),%rsi
call   10a0 <trouveIdentite@plt>
mov    -0x928(%rbp),%rsi
lea    -0x580(%rbp),%rcx
lea    0xccc(%rip),%rdi
mov    $0x1,%edx
call   10e0 <filenstr@plt>
lea    0xcc1(%rip),%rdi
call   1060 <printf@plt>
mov    -0x928(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0xb0(%rbp),%rdi
lea    -0x150(%rbp),%rsi
call   10b0 <corpsMessage@plt>
lea    -0x450(%rbp),%rdi
lea    -0x6b0(%rbp),%rdx
lea    -0x150(%rbp),%rcx
lea    -0x1f0(%rbp),%r8
lea    -0x7ef(%rbp),%r9
lea    -0x6b0(%rbp),%r10
lea    -0x920(%rbp),%rax
lea    0xcc3(%rip),%rsi
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   10f0 <sprintf@plt>
lea    -0x450(%rbp),%rdi
call   1050 <system@plt>
lea    -0xb0(%rbp),%rdi
call   1030 <remove@plt>
lea    -0x150(%rbp),%rdi
call   1030 <remove@plt>
lea    -0x1f0(%rbp),%rdi
call   1070 <afficheFichier@plt>
xor    %eax,%eax
add    $0x940,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x908,%rsp
movabs $0x4e4f5353414d2e,%rax
mov    %rax,0x7(%rsp)
movabs $0x2e746e657275614c,%rax
6e 74 2e
mov    %rax,(%rsp)
lea    0x450(%rsp),%r14
lea    0x320(%rsp),%rsi
mov    %r14,%rdi
call   10c0 <lireChemins@plt>
lea    0xdf2(%rip),%rsi
lea    0x150(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   10f0 <sprintf@plt>
lea    0xddd(%rip),%rsi
lea    0xb0(%rsp),%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   10f0 <sprintf@plt>
lea    0xdd0(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   10f0 <sprintf@plt>
lea    0xdc5(%rip),%rsi
mov    %rbx,%rdi
call   10d0 <fopen@plt>
test   %rax,%rax
je     139f <main+0x1cf>
mov    %rax,%rbx
xor    %eax,%eax
call   1090 <getchar@plt>
mov    0x2d5e(%rip),%rbp
cmp    0x0(%rbp),%al
je     12a7 <main+0xd7>
nop
movsbl %al,%edi
mov    %rbx,%rsi
call   1080 <fputc@plt>
xor    %eax,%eax
call   1090 <getchar@plt>
cmp    0x0(%rbp),%al
jne    1290 <main+0xc0>
lea    0xd82(%rip),%rdi
lea    0x580(%rsp),%r12
mov    %rbx,%rsi
mov    $0x1,%edx
mov    %r12,%rcx
call   10e0 <filenstr@plt>
lea    0xd69(%rip),%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
mov    %r12,%rcx
call   10e0 <filenstr@plt>
lea    0xd5b(%rip),%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
mov    %r12,%rcx
call   10e0 <filenstr@plt>
lea    0x1f0(%rsp),%r15
mov    %r12,%rdi
mov    %r15,%rsi
call   10a0 <trouveIdentite@plt>
lea    0xd35(%rip),%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
mov    %r12,%rcx
call   10e0 <filenstr@plt>
lea    0xd4d(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
lea    0x150(%rsp),%r12
lea    0xb0(%rsp),%r13
mov    %r12,%rdi
mov    %r13,%rsi
call   10b0 <corpsMessage@plt>
lea    0xcf5(%rip),%rsi
lea    0x6b0(%rsp),%rbx
lea    0x10(%rsp),%rbp
mov    %rsp,%r9
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %r13,%rcx
mov    %rbp,%r8
xor    %eax,%eax
push   %r15
push   %r14
call   10f0 <sprintf@plt>
add    $0x10,%rsp
mov    %rbx,%rdi
call   1060 <system@plt>
mov    %r12,%rdi
call   1030 <remove@plt>
mov    %r13,%rdi
call   1030 <remove@plt>
mov    %rbp,%rdi
call   1070 <afficheFichier@plt>
xor    %eax,%eax
add    $0x908,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.utilisateur = [15 x i8] c"Laurent.MASSON\00"
@.str = [7 x i8] c"%smail\00"
@.str.1 = [12 x i8] c"%smailcorps\00"
@.str.2 = [11 x i8] c"%smail.txt\00"
@.str.3 = [3 x i8] c"w+\00"
@EOF = global i8 0
@.str.4 = [6 x i8] c"Date:\00"
@.str.5 = [9 x i8] c"Subject:\00"
@.str.6 = [4 x i8] c"To:\00"
@.str.7 = [6 x i8] c"From:\00"
@.str.8 = [94 x i8] c"Content-Type: text/plain; charset=ISO-8859-1; format=flowed\0AContent-Transfer-Encoding: 7bit\0A\0A\00"
@.str.9 = [41 x i8] c"%sapicrypt -s %s -o %s -u %s -k %s -d %s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca [150 x i8]
%8 = alloca [150 x i8]
%9 = alloca [150 x i8]
%10 = alloca [600 x i8]
%11 = alloca [300 x i8]
%12 = alloca [300 x i8]
%13 = alloca [300 x i8]
%14 = alloca [15 x i8]
%15 = alloca [300 x i8]
%16 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = bitcast [15 x i8]* %14 to i8*
%18 = getelementptr inbounds [300 x i8], [300 x i8]* %12, i64 0, i64 0
%19 = getelementptr inbounds [300 x i8], [300 x i8]* %13, i64 0, i64 0
%20 = call i32 @lireChemins(i8* %18, i8* %19)
%21 = getelementptr inbounds [150 x i8], [150 x i8]* %7, i64 0, i64 0
%22 = getelementptr inbounds [300 x i8], [300 x i8]* %12, i64 0, i64 0
%23 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %21, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds [150 x i8], [150 x i8]* %8, i64 0, i64 0
%25 = getelementptr inbounds [300 x i8], [300 x i8]* %12, i64 0, i64 0
%26 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %24, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %25)
%27 = getelementptr inbounds [150 x i8], [150 x i8]* %9, i64 0, i64 0
%28 = getelementptr inbounds [300 x i8], [300 x i8]* %12, i64 0, i64 0
%29 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %27, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %28)
store i32* null, i32** %16
%30 = getelementptr inbounds [150 x i8], [150 x i8]* %7, i64 0, i64 0
%31 = call i32* @fopen(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %31, i32** %16
%32 = load i32*, i32** %16
%33 = icmp ne i32* %32, null
br i1 %33, label %34, label %83
34: ; preds = %2
br label %35
35: ; preds = %41, %34
%36 = call signext i8 (...) @getchar()
store i8 %36, i8* %6
%37 = sext i8 %36 to i32
%38 = load i8, i8* @EOF
%39 = sext i8 %38 to i32
%40 = icmp ne i32 %37, %39
br i1 %40, label %41, label %45
41: ; preds = %35
%42 = load i8, i8* %6
%43 = load i32*, i32** %16
%44 = call i32 @fputc(i8 signext %42, i32* %43)
br label %35
45: ; preds = %35
%46 = load i32*, i32** %16
%47 = getelementptr inbounds [300 x i8], [300 x i8]* %11, i64 0, i64 0
%48 = call i32 @filenstr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32* %46, i32 1, i8* %47)
%49 = load i32*, i32** %16
%50 = getelementptr inbounds [300 x i8], [300 x i8]* %11, i64 0, i64 0
%51 = call i32 @filenstr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32* %49, i32 1, i8* %50)
%52 = load i32*, i32** %16
%53 = getelementptr inbounds [300 x i8], [300 x i8]* %11, i64 0, i64 0
%54 = call i32 @filenstr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32* %52, i32 1, i8* %53)
%55 = getelementptr inbounds [300 x i8], [300 x i8]* %11, i64 0, i64 0
%56 = getelementptr inbounds [300 x i8], [300 x i8]* %15, i64 0, i64 0
%57 = call i32 @trouveIdentite(i8* %55, i8* %56)
%58 = load i32*, i32** %16
%59 = getelementptr inbounds [300 x i8], [300 x i8]* %11, i64 0, i64 0
%60 = call i32 @filenstr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32* %58, i32 1, i8* %59)
%61 = call i32 @printf(i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.8, i64 0, i64 0))
%62 = load i32*, i32** %16
%63 = call i32 @fclose(i32* %62)
%64 = getelementptr inbounds [150 x i8], [150 x i8]* %7, i64 0, i64 0
%65 = getelementptr inbounds [150 x i8], [150 x i8]* %8, i64 0, i64 0
%66 = call i32 @corpsMessage(i8* %64, i8* %65)
%67 = getelementptr inbounds [600 x i8], [600 x i8]* %10, i64 0, i64 0
%68 = getelementptr inbounds [300 x i8], [300 x i8]* %12, i64 0, i64 0
%69 = getelementptr inbounds [150 x i8], [150 x i8]* %8, i64 0, i64 0
%70 = getelementptr inbounds [150 x i8], [150 x i8]* %9, i64 0, i64 0
%71 = getelementptr inbounds [15 x i8], [15 x i8]* %14, i64 0, i64 0
%72 = getelementptr inbounds [300 x i8], [300 x i8]* %12, i64 0, i64 0
%73 = getelementptr inbounds [300 x i8], [300 x i8]* %15, i64 0, i64 0
%74 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %67, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.9, i64 0, i64 0), i8* %68, i8* %69, i8* %70, i8* %71, i8* %72, i8* %73)
%75 = getelementptr inbounds [600 x i8], [600 x i8]* %10, i64 0, i64 0
%76 = call i32 @system(i8* %75)
%77 = getelementptr inbounds [150 x i8], [150 x i8]* %7, i64 0, i64 0
%78 = call i32 @remove(i8* %77)
%79 = getelementptr inbounds [150 x i8], [150 x i8]* %8, i64 0, i64 0
%80 = call i32 @remove(i8* %79)
%81 = getelementptr inbounds [150 x i8], [150 x i8]* %9, i64 0, i64 0
%82 = call i32 @afficheFichier(i8* %81)
br label %83
83: ; preds = %45, %2
ret i32 0
}

LLVM IR (-O2):
@__const.main.utilisateur = [15 x i8] c"Laurent.MASSON\00"
@.str = [7 x i8] c"%smail\00"
@.str.1 = [12 x i8] c"%smailcorps\00"
@.str.2 = [11 x i8] c"%smail.txt\00"
@.str.3 = [3 x i8] c"w+\00"
@EOF = global i8 0
@.str.4 = [6 x i8] c"Date:\00"
@.str.5 = [9 x i8] c"Subject:\00"
@.str.6 = [4 x i8] c"To:\00"
@.str.7 = [6 x i8] c"From:\00"
@.str.9 = [41 x i8] c"%sapicrypt -s %s -o %s -u %s -k %s -d %s\00"
@str = [93 x i8] c"Content-Type: text/plain; charset=ISO-8859-1; format=flowed\0AContent-Transfer-Encoding: 7bit\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [150 x i8]
%4 = alloca [150 x i8]
%5 = alloca [150 x i8]
%6 = alloca [600 x i8]
%7 = alloca [300 x i8]
%8 = alloca [300 x i8]
%9 = alloca [300 x i8]
%10 = alloca [15 x i8]
%11 = alloca [300 x i8]
%12 = getelementptr inbounds [150 x i8], [150 x i8]* %3, i64 0, i64 0
%13 = getelementptr inbounds [150 x i8], [150 x i8]* %4, i64 0, i64 0
%14 = getelementptr inbounds [150 x i8], [150 x i8]* %5, i64 0, i64 0
%15 = getelementptr inbounds [600 x i8], [600 x i8]* %6, i64 0, i64 0
%16 = getelementptr inbounds [300 x i8], [300 x i8]* %7, i64 0, i64 0
%17 = getelementptr inbounds [300 x i8], [300 x i8]* %8, i64 0, i64 0
%18 = getelementptr inbounds [300 x i8], [300 x i8]* %9, i64 0, i64 0
%19 = getelementptr inbounds [15 x i8], [15 x i8]* %10, i64 0, i64 0
%20 = getelementptr inbounds [300 x i8], [300 x i8]* %11, i64 0, i64 0
%21 = call i32 @lireChemins(i8* %17, i8* %18)
%22 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %12, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %17)
%23 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %13, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%24 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %14, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %17)
%25 = call i32* @fopen(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%26 = icmp eq i32* %25, null
br i1 %26, label %51, label %27
27: ; preds = %2
%28 = call signext i8 (...) @getchar()
%29 = load i8, i8* @EOF
%30 = icmp eq i8 %28, %29
br i1 %30, label %37, label %31
31: ; preds = %27, %31
%32 = phi i8 [ %34, %31 ], [ %28, %27 ]
%33 = call i32 @fputc(i8 signext %32, i32* %25)
%34 = call signext i8 (...) @getchar()
%35 = load i8, i8* @EOF
%36 = icmp eq i8 %34, %35
br i1 %36, label %37, label %31
37: ; preds = %31, %27
%38 = call i32 @filenstr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32* %25, i32 1, i8* %16)
%39 = call i32 @filenstr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32* %25, i32 1, i8* %16)
%40 = call i32 @filenstr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32* %25, i32 1, i8* %16)
%41 = call i32 @trouveIdentite(i8* %16, i8* %20)
%42 = call i32 @filenstr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32* %25, i32 1, i8* %16)
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([93 x i8], [93 x i8]* @str, i64 0, i64 0))
%44 = call i32 @fclose(i32* %25)
%45 = call i32 @corpsMessage(i8* %12, i8* %13)
%46 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %15, i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.9, i64 0, i64 0), i8* %17, i8* %13, i8* %14, i8* %19, i8* %17, i8* %20)
%47 = call i32 @system(i8* %15)
%48 = call i32 @remove(i8* %12)
%49 = call i32 @remove(i8* %13)
%50 = call i32 @afficheFichier(i8* %14)
br label %51
51: ; preds = %37, %2
ret i32 0
}