#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 */
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ inscriptionScore(char *, int);
int lectureScore(char **, int *);
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
char toupper(char);
int /*<<< orphan*/ triScore(char **, int *, int);
void fscore(int scorePlayer) {
  int score[100] = {0}, maxi, i;
  char name[12];
  char pseudo[100][4];
  printf("Votre Pseudo (3 caracteres): ");
  do {
    gets(name);
  } while (strlen(name) != 3);
  for (i = 0; i < 4; i++) {
    name[i] = toupper(name[i]);
  }
  printf("\n\nVotre score est: %d\n\n", scorePlayer);
  inscriptionScore(name, scorePlayer);
  maxi = lectureScore(pseudo, score);
  triScore(pseudo, score, maxi);
}


x86 assembly (clang, -O0):
<fscore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x350,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x1a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x190,%edx
call   1090 <memset@plt>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x1b4(%rbp),%rdi
call   10a0 <gets@plt>
lea    -0x1b4(%rbp),%rdi
call   1060 <strlen@plt>
cmp    $0x3,%eax
jne    11af <fscore+0x2f>
movl   $0x0,-0x1a8(%rbp)
cmpl   $0x4,-0x1a8(%rbp)
jge    121f <fscore+0x9f>
movslq -0x1a8(%rbp),%rax
movsbl -0x1b4(%rbp,%rax,1),%edi
ff
call   1040 <toupper@plt>
mov    %al,%cl
movslq -0x1a8(%rbp),%rax
mov    %cl,-0x1b4(%rbp,%rax,1)
mov    -0x1a8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a8(%rbp)
jmp    11da <fscore+0x5a>
mov    -0x4(%rbp),%esi
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x1b4(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1080 <inscriptionScore@plt>
lea    -0x350(%rbp),%rdi
lea    -0x1a0(%rbp),%rsi
call   1030 <lectureScore@plt>
mov    %eax,-0x1a4(%rbp)
lea    -0x350(%rbp),%rdi
lea    -0x1a0(%rbp),%rsi
mov    -0x1a4(%rbp),%edx
call   1050 <triScore@plt>
add    $0x350,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fscore>:
push   %rbp
push   %rbx
sub    $0x338,%rsp
mov    %edi,%ebp
lea    0x10(%rsp),%rdi
mov    $0x190,%edx
xor    %esi,%esi
call   1090 <memset@plt>
lea    0xe5d(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x4(%rsp),%rbx
nop
mov    %rbx,%rdi
call   10a0 <gets@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
cmp    $0x3,%eax
jne    11b0 <fscore+0x30>
movsbl 0x4(%rsp),%edi
call   1040 <toupper@plt>
mov    %al,0x4(%rsp)
movsbl 0x5(%rsp),%edi
call   1040 <toupper@plt>
mov    %al,0x5(%rsp)
movsbl 0x6(%rsp),%edi
call   1040 <toupper@plt>
mov    %al,0x6(%rsp)
movsbl 0x7(%rsp),%edi
call   1040 <toupper@plt>
mov    %al,0x7(%rsp)
lea    0xe1a(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x4(%rsp),%rdi
mov    %ebp,%esi
call   1080 <inscriptionScore@plt>
lea    0x1a0(%rsp),%rbx
lea    0x10(%rsp),%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1030 <lectureScore@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %eax,%edx
call   1050 <triScore@plt>
add    $0x338,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Votre Pseudo (3 caracteres): \00"
@.str.1 = [24 x i8] c"\0A\0AVotre score est: %d\0A\0A\00"
define void @fscore(i32 %0) {
%2 = alloca i32
%3 = alloca [100 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca [12 x i8]
%7 = alloca [100 x [4 x i8]]
store i32 %0, i32* %2
%8 = bitcast [100 x i32]* %3 to i8*
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %13, %1
%11 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 0
%12 = call i32 @gets(i8* %11)
br label %13
13: ; preds = %10
%14 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 0
%15 = call i32 @strlen(i8* %14)
%16 = icmp ne i32 %15, 3
br i1 %16, label %10, label %17
17: ; preds = %13
store i32 0, i32* %5
br label %18
18: ; preds = %30, %17
%19 = load i32, i32* %5
%20 = icmp slt i32 %19, 4
br i1 %20, label %21, label %33
21: ; preds = %18
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = call signext i8 @toupper(i8 signext %25)
%27 = load i32, i32* %5
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 %28
store i8 %26, i8* %29
br label %30
30: ; preds = %21
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %18
33: ; preds = %18
%34 = load i32, i32* %2
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 0
%37 = load i32, i32* %2
%38 = call i32 @inscriptionScore(i8* %36, i32 %37)
%39 = getelementptr inbounds [100 x [4 x i8]], [100 x [4 x i8]]* %7, i64 0, i64 0
%40 = bitcast [4 x i8]* %39 to i8**
%41 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 0
%42 = call i32 @lectureScore(i8** %40, i32* %41)
store i32 %42, i32* %4
%43 = getelementptr inbounds [100 x [4 x i8]], [100 x [4 x i8]]* %7, i64 0, i64 0
%44 = bitcast [4 x i8]* %43 to i8**
%45 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 0
%46 = load i32, i32* %4
%47 = call i32 @triScore(i8** %44, i32* %45, i32 %46)
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"Votre Pseudo (3 caracteres): \00"
@.str.1 = [24 x i8] c"\0A\0AVotre score est: %d\0A\0A\00"
define void @fscore(i32 %0) {
%2 = alloca [100 x i32]
%3 = alloca [12 x i8]
%4 = alloca [100 x [4 x i8]]
%5 = bitcast [100 x i32]* %2 to i8*
%6 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [100 x [4 x i8]], [100 x [4 x i8]]* %4, i64 0, i64 0, i64 0
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %9, %1
%10 = call i32 @gets(i8* %6)
%11 = call i32 @strlen(i8* %6)
%12 = icmp eq i32 %11, 3
br i1 %12, label %13, label %9
13: ; preds = %9
%14 = load i8, i8* %6
%15 = call signext i8 @toupper(i8 signext %14)
store i8 %15, i8* %6
%16 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 1
%17 = load i8, i8* %16
%18 = call signext i8 @toupper(i8 signext %17)
store i8 %18, i8* %16
%19 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 2
%20 = load i8, i8* %19
%21 = call signext i8 @toupper(i8 signext %20)
store i8 %21, i8* %19
%22 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 3
%23 = load i8, i8* %22
%24 = call signext i8 @toupper(i8 signext %23)
store i8 %24, i8* %22
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%26 = call i32 @inscriptionScore(i8* %6, i32 %0)
%27 = bitcast [100 x [4 x i8]]* %4 to i8**
%28 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%29 = call i32 @lectureScore(i8** %27, i32* %28)
%30 = call i32 @triScore(i8** %27, i32* %28, i32 %29)
ret void
}