#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 */
double addition(float, float);
int /*<<< orphan*/ getchar();
double multi(float, float);
int /*<<< orphan*/ printf(char *, ...);
double puissance(float, float);
double racine(float);
int /*<<< orphan*/ scanf(char *, ...);
double soustraction(float, float);
scalar_t__ system(char *);
int main(void) {
  float a = 0.0, b = 0.0;
  while (1) {
    if (system("cls"))
      system("clear");
    printf("===============================================\n\n");
    printf("GitProject EXIA A1 Aix en provence\n");
    printf("Program - Calculator\n");
    printf("Credit : Hugo, Batiste, Mandel\n");
    printf("Licence MIT\n");
    printf("===============================================\n\n");
    printf("Saisissez vos nombres \n");
    printf("nombre 1 : ");
    scanf("%f", &a);
    printf("nombre 2 : ");
    scanf("%f", &b);
    int choix;
    printf("Type d'operation :\n");
    printf("1. Addition\n");
    printf("2. Multiplication\n");
    printf("3. Soustraction\n");
    printf("4. Racine\n");
    printf("5. Puissance (a^b)\n");
    scanf("%d", &choix);
    switch (choix) {
    case 1:
      printf("resultat : %g\n", addition(a, b));
      break;
    case 2:
      printf("resultat : %g\n", multi(a, b));
      break;
    case 3:
      printf("resultat : %g\n", soustraction(a, b));
      break;
    case 4:
      printf("resultat de a : %g\n", racine(a));
      break;
    case 5:
      printf("resultat : %g\n", puissance(a, b));
      break;
    }
    getchar();
    getchar();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
lea    0xe5e(%rip),%rdi
call   1040 <system@plt>
cmp    $0x0,%rax
je     11d1 <main+0x41>
lea    0xe4c(%rip),%rdi
call   1040 <system@plt>
lea    0xe46(%rip),%rdi
mov    %rdi,-0x30(%rbp)
xor    %eax,%eax
mov    %al,-0x19(%rbp)
call   1050 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe60(%rip),%rdi
call   1050 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe75(%rip),%rdi
call   1050 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe7c(%rip),%rdi
call   1050 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe8d(%rip),%rdi
call   1050 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x19(%rbp),%al
call   1050 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe7f(%rip),%rdi
call   1050 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe88(%rip),%rdi
call   1050 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe85(%rip),%rdi
mov    %rdi,-0x28(%rbp)
lea    -0x8(%rbp),%rsi
call   10b0 <scanf@plt>
mov    -0x19(%rbp),%al
lea    0xe71(%rip),%rdi
call   1050 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x19(%rbp),%al
lea    -0xc(%rbp),%rsi
call   10b0 <scanf@plt>
mov    -0x19(%rbp),%al
lea    0xe5e(%rip),%rdi
call   1050 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe63(%rip),%rdi
call   1050 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe61(%rip),%rdi
call   1050 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe65(%rip),%rdi
call   1050 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe67(%rip),%rdi
call   1050 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe63(%rip),%rdi
call   1050 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xe68(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   10b0 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x4,%eax
ja     13b8 <main+0x228>
mov    -0x18(%rbp),%rax
lea    0xcf1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1030 <addition@plt>
lea    0xe23(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    13b8 <main+0x228>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1060 <multi@plt>
lea    0xe01(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    13b8 <main+0x228>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   10a0 <soustraction@plt>
lea    0xddf(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    13b8 <main+0x228>
movss  -0x8(%rbp),%xmm0
call   1080 <racine@plt>
lea    0xdd1(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    13b8 <main+0x228>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1090 <puissance@plt>
lea    0xda0(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
jmp    11af <main+0x1f>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x10(%rsp)
lea    0xefd(%rip),%rbx
lea    0xe5e(%rip),%r12
lea    0xf82(%rip),%r13
lea    0xe5f(%rip),%rbp
lea    0x14(%rsp),%r14
lea    0xe1a(%rip),%r15
jmp    1215 <main+0x75>
movss  0xc(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
call   10a0 <puissance@plt>
lea    0xe3c(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
xor    %eax,%eax
call   1080 <getchar@plt>
xor    %eax,%eax
call   1080 <getchar@plt>
lea    0xdf8(%rip),%rdi
call   1050 <system@plt>
test   %rax,%rax
je     1232 <main+0x92>
lea    0xdeb(%rip),%rdi
call   1050 <system@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xe1e(%rip),%rdi
call   1040 <puts@plt>
lea    0xe35(%rip),%rdi
call   1040 <puts@plt>
lea    0xe3e(%rip),%rdi
call   1040 <puts@plt>
lea    0xe51(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xe7a(%rip),%rdi
call   1040 <puts@plt>
lea    0xd99(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12,%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   10c0 <scanf@plt>
lea    0xd8b(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12,%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   10c0 <scanf@plt>
lea    0xe4b(%rip),%rdi
call   1040 <puts@plt>
lea    0xe52(%rip),%rdi
call   1040 <puts@plt>
lea    0xe52(%rip),%rdi
call   1040 <puts@plt>
lea    0xe58(%rip),%rdi
call   1040 <puts@plt>
lea    0xe5c(%rip),%rdi
call   1040 <puts@plt>
mov    %r13,%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   10c0 <scanf@plt>
mov    0x14(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x4,%eax
ja     1207 <main+0x67>
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
movss  0xc(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
call   1030 <addition@plt>
jmp    11f9 <main+0x59>
movss  0xc(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
call   1070 <multi@plt>
jmp    11f9 <main+0x59>
movss  0xc(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
call   10b0 <soustraction@plt>
jmp    11f9 <main+0x59>
movss  0xc(%rsp),%xmm0
call   1090 <racine@plt>
lea    0xcd5(%rip),%rdi
jmp    1200 <main+0x60>

LLVM IR (-O0):
@.str = [4 x i8] c"cls\00"
@.str.1 = [6 x i8] c"clear\00"
@.str.2 = [50 x i8] c"===============================================\0A\0A\00"
@.str.3 = [36 x i8] c"GitProject EXIA A1 Aix en provence\0A\00"
@.str.4 = [22 x i8] c"Program - Calculator\0A\00"
@.str.5 = [32 x i8] c"Credit : Hugo, Batiste, Mandel\0A\00"
@.str.6 = [13 x i8] c"Licence MIT\0A\00"
@.str.7 = [24 x i8] c"Saisissez vos nombres \0A\00"
@.str.8 = [12 x i8] c"nombre 1 : \00"
@.str.9 = [3 x i8] c"%f\00"
@.str.10 = [12 x i8] c"nombre 2 : \00"
@.str.11 = [20 x i8] c"Type d'operation :\0A\00"
@.str.12 = [13 x i8] c"1. Addition\0A\00"
@.str.13 = [19 x i8] c"2. Multiplication\0A\00"
@.str.14 = [17 x i8] c"3. Soustraction\0A\00"
@.str.15 = [11 x i8] c"4. Racine\0A\00"
@.str.16 = [20 x i8] c"5. Puissance (a^b)\0A\00"
@.str.17 = [3 x i8] c"%d\00"
@.str.18 = [15 x i8] c"resultat : %g\0A\00"
@.str.19 = [20 x i8] c"resultat de a : %g\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca i32
store i32 0, i32* %1
store float 0.000000e+00, float* %2
store float 0.000000e+00, float* %3
br label %5
5: ; preds = %0, %54
%6 = call i64 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = call i64 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %5
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), float* %2)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), float* %3)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0))
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0))
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.16, i64 0, i64 0))
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0), i32* %4)
%29 = load i32, i32* %4
switch i32 %29, label %54 [
i32 1, label %30
i32 2, label %35
i32 3, label %40
i32 4, label %45
i32 5, label %49
]
30: ; preds = %10
%31 = load float, float* %2
%32 = load float, float* %3
%33 = call double @addition(float %31, float %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.18, i64 0, i64 0), double %33)
br label %54
35: ; preds = %10
%36 = load float, float* %2
%37 = load float, float* %3
%38 = call double @multi(float %36, float %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.18, i64 0, i64 0), double %38)
br label %54
40: ; preds = %10
%41 = load float, float* %2
%42 = load float, float* %3
%43 = call double @soustraction(float %41, float %42)
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.18, i64 0, i64 0), double %43)
br label %54
45: ; preds = %10
%46 = load float, float* %2
%47 = call double @racine(float %46)
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.19, i64 0, i64 0), double %47)
br label %54
49: ; preds = %10
%50 = load float, float* %2
%51 = load float, float* %3
%52 = call double @puissance(float %50, float %51)
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.18, i64 0, i64 0), double %52)
br label %54
54: ; preds = %10, %49, %45, %40, %35, %30
%55 = call i32 (...) @getchar()
%56 = call i32 (...) @getchar()
br label %5
}

LLVM IR (-O2):
@.str = [4 x i8] c"cls\00"
@.str.1 = [6 x i8] c"clear\00"
@.str.8 = [12 x i8] c"nombre 1 : \00"
@.str.9 = [3 x i8] c"%f\00"
@.str.10 = [12 x i8] c"nombre 2 : \00"
@.str.17 = [3 x i8] c"%d\00"
@.str.18 = [15 x i8] c"resultat : %g\0A\00"
@.str.19 = [20 x i8] c"resultat de a : %g\0A\00"
@str.20 = [35 x i8] c"GitProject EXIA A1 Aix en provence\00"
@str.21 = [21 x i8] c"Program - Calculator\00"
@str.22 = [31 x i8] c"Credit : Hugo, Batiste, Mandel\00"
@str.23 = [12 x i8] c"Licence MIT\00"
@str.24 = [49 x i8] c"===============================================\0A\00"
@str.25 = [23 x i8] c"Saisissez vos nombres \00"
@str.26 = [19 x i8] c"Type d'operation :\00"
@str.27 = [12 x i8] c"1. Addition\00"
@str.28 = [18 x i8] c"2. Multiplication\00"
@str.29 = [16 x i8] c"3. Soustraction\00"
@str.30 = [10 x i8] c"4. Racine\00"
@str.31 = [19 x i8] c"5. Puissance (a^b)\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca i32
%4 = bitcast float* %1 to i8*
store float 0.000000e+00, float* %1
%5 = bitcast float* %2 to i8*
store float 0.000000e+00, float* %2
%6 = bitcast i32* %3 to i8*
br label %7
7: ; preds = %56, %0
%8 = call i64 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = call i64 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %7
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.24, i64 0, i64 0))
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.20, i64 0, i64 0))
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.21, i64 0, i64 0))
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.22, i64 0, i64 0))
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.23, i64 0, i64 0))
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.24, i64 0, i64 0))
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.25, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), float* %1)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), float* %2)
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.26, i64 0, i64 0))
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.27, i64 0, i64 0))
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.28, i64 0, i64 0))
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.29, i64 0, i64 0))
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.30, i64 0, i64 0))
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.31, i64 0, i64 0))
%30 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0), i32* %3)
%31 = load i32, i32* %3
switch i32 %31, label %56 [
i32 1, label %32
i32 2, label %37
i32 3, label %42
i32 4, label %47
i32 5, label %51
]
32: ; preds = %12
%33 = load float, float* %1
%34 = load float, float* %2
%35 = call double @addition(float %33, float %34)
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.18, i64 0, i64 0), double %35)
br label %56
37: ; preds = %12
%38 = load float, float* %1
%39 = load float, float* %2
%40 = call double @multi(float %38, float %39)
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.18, i64 0, i64 0), double %40)
br label %56
42: ; preds = %12
%43 = load float, float* %1
%44 = load float, float* %2
%45 = call double @soustraction(float %43, float %44)
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.18, i64 0, i64 0), double %45)
br label %56
47: ; preds = %12
%48 = load float, float* %1
%49 = call double @racine(float %48)
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.19, i64 0, i64 0), double %49)
br label %56
51: ; preds = %12
%52 = load float, float* %1
%53 = load float, float* %2
%54 = call double @puissance(float %52, float %53)
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.18, i64 0, i64 0), double %54)
br label %56
56: ; preds = %12, %51, %47, %42, %37, %32
%57 = call i32 (...) @getchar()
%58 = call i32 (...) @getchar()
br label %7
}