#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 */
int errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ getenv(char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
int strlen(char *);
void lireChemins(char *cheminApicrypt, char *cheminApitemp) {
  char home[300];
  strcpy(home, getenv("HOME"));
  FILE *fichier1 = NULL;
  fichier1 = fopen("apiKmail.ini", "r+");
  if (fichier1 != NULL) {
    fgets(cheminApicrypt, 300, fichier1);
    cheminApicrypt[strlen(cheminApicrypt) - 1] = '\0';
    fgets(cheminApitemp, 300, fichier1);
    cheminApitemp[strlen(cheminApitemp) - 1] = '\0';
    fclose(fichier1);
  } else {
    FILE *fichier1 = NULL;
    fichier1 = fopen("apiKmail.ini", "w+");
    if (fichier1 != NULL) {
      sprintf(cheminApitemp, "%s/MedinTux/Programmes/apitux/bin/apitemp/",
              home);
      sprintf(cheminApicrypt, "%s/apicrypt/", home);
      fprintf(fichier1, "%s\n", cheminApicrypt);
      fprintf(fichier1, "%s\n", cheminApitemp);
      fclose(fichier1);
    } else {
      perror("Impossible d'ouvrir ou de créer le fichier apiKmail.ini ");
      printf("errno = %d.\n", errno);
      exit(1);
    }
  }
}


x86 assembly (clang, -O0):
<lireChemins>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x140(%rbp),%rax
mov    %rax,-0x158(%rbp)
lea    0xe28(%rip),%rdi
call   1030 <getenv@plt>
mov    -0x158(%rbp),%rdi
mov    %eax,%esi
call   1040 <strcpy@plt>
movq   $0x0,-0x148(%rbp)
lea    0xe08(%rip),%rdi
lea    0xe0e(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x148(%rbp)
cmpq   $0x0,-0x148(%rbp)
je     12a7 <lireChemins+0xf7>
mov    -0x8(%rbp),%rdi
mov    -0x148(%rbp),%rdx
mov    $0x12c,%esi
call   1080 <fgets@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x168(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x168(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rdi
mov    -0x148(%rbp),%rdx
mov    $0x12c,%esi
call   1080 <fgets@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x160(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x160(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x148(%rbp),%rdi
call   1050 <fclose@plt>
jmp    1377 <lireChemins+0x1c7>
movq   $0x0,-0x150(%rbp)
lea    0xd4c(%rip),%rdi
lea    0xd55(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x150(%rbp)
cmpq   $0x0,-0x150(%rbp)
je     1347 <lireChemins+0x197>
mov    -0x10(%rbp),%rdi
lea    -0x140(%rbp),%rdx
lea    0xd2c(%rip),%rsi
call   10c0 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x140(%rbp),%rdx
lea    0xd40(%rip),%rsi
call   10c0 <sprintf@plt>
mov    -0x150(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xd36(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x150(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xd1f(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x150(%rbp),%rdi
call   1050 <fclose@plt>
jmp    1372 <lireChemins+0x1c2>
lea    0xd06(%rip),%rdi
call   10b0 <perror@plt>
mov    0x2c86(%rip),%rax
mov    (%rax),%esi
lea    0xd2b(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    1377 <lireChemins+0x1c7>
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lireChemins>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x138,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xe35(%rip),%rdi
call   1030 <getenv@plt>
mov    %rsp,%rdi
mov    %eax,%esi
call   1040 <strcpy@plt>
lea    0xe24(%rip),%rdi
lea    0xe2a(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1237 <lireChemins+0x87>
mov    %rax,%rbx
mov    %r15,%rdi
mov    $0x12c,%esi
mov    %rax,%rdx
call   1080 <fgets@plt>
mov    %r15,%rdi
call   1060 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%r15,1)
mov    %r14,%rdi
mov    $0x12c,%esi
mov    %rbx,%rdx
call   1080 <fgets@plt>
mov    %r14,%rdi
call   1060 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%r14,1)
jmp    129c <lireChemins+0xec>
lea    0xdc7(%rip),%rdi
lea    0xdd0(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     12b3 <lireChemins+0x103>
mov    %rax,%rbx
lea    0xdbf(%rip),%rsi
mov    %rsp,%r12
mov    %r14,%rdi
mov    %r12,%rdx
call   10c0 <sprintf@plt>
lea    0xdd5(%rip),%rsi
mov    %r15,%rdi
mov    %r12,%rdx
call   10c0 <sprintf@plt>
lea    0xdd0(%rip),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
call   1090 <fprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
call   1090 <fprintf@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
add    $0x138,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xd9a(%rip),%rdi
call   10b0 <perror@plt>
mov    0x2d1a(%rip),%rax
mov    (%rax),%esi
lea    0xdbf(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"HOME\00"
@.str.1 = [13 x i8] c"apiKmail.ini\00"
@.str.2 = [3 x i8] c"r+\00"
@.str.3 = [3 x i8] c"w+\00"
@.str.4 = [43 x i8] c"%s/MedinTux/Programmes/apitux/bin/apitemp/\00"
@.str.5 = [13 x i8] c"%s/apicrypt/\00"
@.str.6 = [4 x i8] c"%s\0A\00"
@.str.7 = [58 x i8] c"Impossible d'ouvrir ou de cr\C3\A9er le fichier apiKmail.ini \00"
@.str.8 = [13 x i8] c"errno = %d.\0A\00"
@errno = global i32 0
define void @lireChemins(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [300 x i8]
%6 = alloca i32*
%7 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = getelementptr inbounds [300 x i8], [300 x i8]* %5, i64 0, i64 0
%9 = call i32 @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @strcpy(i8* %8, i32 %9)
store i32* null, i32** %6
%11 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %11, i32** %6
%12 = load i32*, i32** %6
%13 = icmp ne i32* %12, null
br i1 %13, label %14, label %35
14: ; preds = %2
%15 = load i8*, i8** %3
%16 = load i32*, i32** %6
%17 = call i32 @fgets(i8* %15, i32 300, i32* %16)
%18 = load i8*, i8** %3
%19 = load i8*, i8** %3
%20 = call i32 @strlen(i8* %19)
%21 = sub nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %18, i64 %22
store i8 0, i8* %23
%24 = load i8*, i8** %4
%25 = load i32*, i32** %6
%26 = call i32 @fgets(i8* %24, i32 300, i32* %25)
%27 = load i8*, i8** %4
%28 = load i8*, i8** %4
%29 = call i32 @strlen(i8* %28)
%30 = sub nsw i32 %29, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %27, i64 %31
store i8 0, i8* %32
%33 = load i32*, i32** %6
%34 = call i32 @fclose(i32* %33)
br label %60
35: ; preds = %2
store i32* null, i32** %7
%36 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %36, i32** %7
%37 = load i32*, i32** %7
%38 = icmp ne i32* %37, null
br i1 %38, label %39, label %54
39: ; preds = %35
%40 = load i8*, i8** %4
%41 = getelementptr inbounds [300 x i8], [300 x i8]* %5, i64 0, i64 0
%42 = call i32 @sprintf(i8* %40, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* %41)
%43 = load i8*, i8** %3
%44 = getelementptr inbounds [300 x i8], [300 x i8]* %5, i64 0, i64 0
%45 = call i32 @sprintf(i8* %43, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %44)
%46 = load i32*, i32** %7
%47 = load i8*, i8** %3
%48 = call i32 @fprintf(i32* %46, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %47)
%49 = load i32*, i32** %7
%50 = load i8*, i8** %4
%51 = call i32 @fprintf(i32* %49, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %50)
%52 = load i32*, i32** %7
%53 = call i32 @fclose(i32* %52)
br label %59
54: ; preds = %35
%55 = call i32 @perror(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.7, i64 0, i64 0))
%56 = load i32, i32* @errno
%57 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i32 %56)
%58 = call i32 @exit(i32 1)
unreachable
59: ; preds = %39
br label %60
60: ; preds = %59, %14
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"HOME\00"
@.str.1 = [13 x i8] c"apiKmail.ini\00"
@.str.2 = [3 x i8] c"r+\00"
@.str.3 = [3 x i8] c"w+\00"
@.str.4 = [43 x i8] c"%s/MedinTux/Programmes/apitux/bin/apitemp/\00"
@.str.5 = [13 x i8] c"%s/apicrypt/\00"
@.str.6 = [4 x i8] c"%s\0A\00"
@.str.7 = [58 x i8] c"Impossible d'ouvrir ou de cr\C3\A9er le fichier apiKmail.ini \00"
@.str.8 = [13 x i8] c"errno = %d.\0A\00"
@errno = global i32 0
define void @lireChemins(i8* %0, i8* %1) {
%3 = alloca [300 x i8]
%4 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @strcpy(i8* %4, i32 %5)
%7 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %20, label %9
9: ; preds = %2
%10 = call i32 @fgets(i8* %0, i32 300, i32* %7)
%11 = call i32 @strlen(i8* %0)
%12 = add nsw i32 %11, -1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %0, i64 %13
store i8 0, i8* %14
%15 = call i32 @fgets(i8* %1, i32 300, i32* %7)
%16 = call i32 @strlen(i8* %1)
%17 = add nsw i32 %16, -1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %1, i64 %18
store i8 0, i8* %19
br label %33
20: ; preds = %2
%21 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %28, label %23
23: ; preds = %20
%24 = call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%25 = call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%26 = call i32 @fprintf(i32* %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %0)
%27 = call i32 @fprintf(i32* %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %1)
br label %33
28: ; preds = %20
%29 = call i32 @perror(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.7, i64 0, i64 0))
%30 = load i32, i32* @errno
%31 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i32 %30)
%32 = call i32 @exit(i32 1)
unreachable
33: ; preds = %23, %9
%34 = phi i32* [ %21, %23 ], [ %7, %9 ]
%35 = call i32 @fclose(i32* %34)
ret void
}