#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 */
struct termios {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
char *crypt(char *, char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
char *fgets(char *, int, int /*<<< orphan*/);
char getkey();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ restaure_term(struct termios *);
int /*<<< orphan*/ setsilent(struct termios *);
int /*<<< orphan*/ stdin;
int main() {
  int r;
  char buf[64], *s, *pwd, key[2];
  struct termios initial_term;
  key[0] = getkey();
  key[1] = getkey();
  printf("key = %s\n", key);
  printf("Tapez votre mot de passe : ");
  setsilent(&initial_term);
  s = fgets(buf, 64, stdin);
  pwd = crypt(s, key);
  printf("\nMot de passe chiffre : %s\n", pwd);
  restaure_term(&initial_term);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1080 <getkey@plt>
mov    %al,-0x62(%rbp)
mov    $0x0,%al
call   1080 <getkey@plt>
mov    %al,-0x61(%rbp)
lea    -0x62(%rbp),%rsi
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x68(%rbp),%rdi
call   1070 <setsilent@plt>
lea    -0x50(%rbp),%rdi
mov    0x2e21(%rip),%rax
mov    (%rax),%edx
mov    $0x40,%esi
call   1060 <fgets@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
lea    -0x62(%rbp),%rsi
call   1040 <crypt@plt>
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rsi
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x68(%rbp),%rdi
call   1030 <restaure_term@plt>
mov    0x2dce(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x58,%rsp
xor    %eax,%eax
call   1080 <getkey@plt>
mov    %al,0x6(%rsp)
xor    %eax,%eax
call   1080 <getkey@plt>
mov    %al,0x7(%rsp)
lea    0xe6c(%rip),%rdi
lea    0x6(%rsp),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe60(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <setsilent@plt>
mov    0x2e23(%rip),%rax
mov    (%rax),%edx
lea    0x10(%rsp),%rdi
mov    $0x40,%esi
call   1060 <fgets@plt>
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <crypt@plt>
lea    0xe3e(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <restaure_term@plt>
mov    0x2dd7(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

LLVM IR (-O0):
%struct.termios = type { i32 }
@.str = [10 x i8] c"key = %s\0A\00"
@.str.1 = [28 x i8] c"Tapez votre mot de passe : \00"
@stdin = global i32 0
@.str.2 = [28 x i8] c"\0AMot de passe chiffre : %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [64 x i8]
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [2 x i8]
%7 = alloca %struct.termios
store i32 0, i32* %1
%8 = call signext i8 (...) @getkey()
%9 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
store i8 %8, i8* %9
%10 = call signext i8 (...) @getkey()
%11 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 1
store i8 %10, i8* %11
%12 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @setsilent(%struct.termios* %7)
%16 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%17 = load i32, i32* @stdin
%18 = call i8* @fgets(i8* %16, i32 64, i32 %17)
store i8* %18, i8** %4
%19 = load i8*, i8** %4
%20 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%21 = call i8* @crypt(i8* %19, i8* %20)
store i8* %21, i8** %5
%22 = load i8*, i8** %5
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %22)
%24 = call i32 @restaure_term(%struct.termios* %7)
%25 = load i32, i32* @EXIT_SUCCESS
%26 = call i32 @exit(i32 %25)
unreachable
}

LLVM IR (-O2):
%struct.termios = type { i32 }
@.str = [10 x i8] c"key = %s\0A\00"
@.str.1 = [28 x i8] c"Tapez votre mot de passe : \00"
@stdin = global i32 0
@.str.2 = [28 x i8] c"\0AMot de passe chiffre : %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [64 x i8]
%2 = alloca [2 x i8]
%3 = alloca %struct.termios
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%6 = bitcast %struct.termios* %3 to i8*
%7 = tail call signext i8 (...) @getkey()
store i8 %7, i8* %5
%8 = tail call signext i8 (...) @getkey()
%9 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 1
store i8 %8, i8* %9
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %5)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @setsilent(%struct.termios* %3)
%13 = load i32, i32* @stdin
%14 = call i8* @fgets(i8* %4, i32 64, i32 %13)
%15 = call i8* @crypt(i8* %14, i8* %5)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %15)
%17 = call i32 @restaure_term(%struct.termios* %3)
%18 = load i32, i32* @EXIT_SUCCESS
%19 = call i32 @exit(i32 %18)
unreachable
}