#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 *get_pass();
char getkey();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ restaure_term(struct termios *);
int /*<<< orphan*/ setsilent(struct termios *);
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 = get_pass();
  pwd = crypt(s, key);
  printf("Mot 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   1070 <getkey@plt>
mov    %al,-0x62(%rbp)
mov    $0x0,%al
call   1070 <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   1060 <setsilent@plt>
mov    $0x0,%al
call   1080 <get_pass@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    0xe43(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x68(%rbp),%rdi
call   1030 <restaure_term@plt>
mov    0x2de6(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   1070 <getkey@plt>
mov    %al,0xe(%rsp)
xor    %eax,%eax
call   1070 <getkey@plt>
mov    %al,0xf(%rsp)
lea    0xe6c(%rip),%rdi
lea    0xe(%rsp),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe60(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <setsilent@plt>
xor    %eax,%eax
call   1080 <get_pass@plt>
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <crypt@plt>
lea    0xe4f(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <restaure_term@plt>
mov    0x2df0(%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"
@.str.2 = [27 x i8] c"Mot 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 = call i8* (...) @get_pass()
store i8* %16, i8** %4
%17 = load i8*, i8** %4
%18 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%19 = call i8* @crypt(i8* %17, i8* %18)
store i8* %19, i8** %5
%20 = load i8*, i8** %5
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %20)
%22 = call i32 @restaure_term(%struct.termios* %7)
%23 = load i32, i32* @EXIT_SUCCESS
%24 = call i32 @exit(i32 %23)
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"
@.str.2 = [27 x i8] c"Mot de passe chiffre : %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [2 x i8]
%2 = alloca %struct.termios
%3 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
%4 = bitcast %struct.termios* %2 to i8*
%5 = tail call signext i8 (...) @getkey()
store i8 %5, i8* %3
%6 = tail call signext i8 (...) @getkey()
%7 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 1
store i8 %6, i8* %7
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %3)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @setsilent(%struct.termios* %2)
%11 = call i8* (...) @get_pass()
%12 = call i8* @crypt(i8* %11, i8* %3)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %12)
%14 = call i32 @restaure_term(%struct.termios* %2)
%15 = load i32, i32* @EXIT_SUCCESS
%16 = call i32 @exit(i32 %15)
unreachable
}