#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*/ inital();
int /*<<< orphan*/ placer(unsigned int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ simulation(unsigned long);
int /*<<< orphan*/ vider();
int main(void) {
  unsigned long n = 0;
  unsigned int nb_sucre;
  inital();
  vider();
  printf("Nombre de tours ( Si 0 : jusqu'a la fin ) : ");
  scanf("%lu", &n);
  printf("Au bout de combien de chargement un emplacement de sucre s'est-il "
         "vide ?\n");
  do {
    printf("Veuillez entrer une valeur dans [0,255] :\n");
    scanf("%u", &nb_sucre);
  } while (nb_sucre > 255 || nb_sucre < 0);
  placer(nb_sucre);
  simulation(n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <inital@plt>
mov    $0x0,%al
call   1080 <vider@plt>
lea    0xe74(%rip),%rdi
call   1040 <printf@plt>
lea    0xe95(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    0xe87(%rip),%rdi
call   1040 <printf@plt>
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
lea    0xee4(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    $0x1,%al
cmpl   $0xff,-0x14(%rbp)
mov    %al,-0x15(%rbp)
ja     11e9 <main+0x89>
cmpl   $0x0,-0x14(%rbp)
setb   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    11af <main+0x4f>
mov    -0x14(%rbp),%edi
call   1070 <placer@plt>
mov    -0x10(%rbp),%rdi
call   1050 <simulation@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
xor    %eax,%eax
call   1040 <inital@plt>
xor    %eax,%eax
call   1090 <vider@plt>
lea    0xe69(%rip),%rdi
call   1050 <printf@plt>
lea    0xe8a(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
lea    0xe7e(%rip),%rdi
call   1030 <puts@plt>
lea    0xebb(%rip),%r14
lea    0xe68(%rip),%r15
lea    0x4(%rsp),%rbx
xchg   %ax,%ax
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0x4(%rsp),%edi
cmp    $0xff,%edi
ja     11d0 <main+0x60>
call   1080 <placer@plt>
mov    0x8(%rsp),%rdi
call   1060 <simulation@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [45 x i8] c"Nombre de tours ( Si 0 : jusqu'a la fin ) : \00"
@.str.1 = [4 x i8] c"%lu\00"
@.str.2 = [74 x i8] c"Au bout de combien de chargement un emplacement de sucre s'est-il vide ?\0A\00"
@.str.3 = [43 x i8] c"Veuillez entrer une valeur dans [0,255] :\0A\00"
@.str.4 = [3 x i8] c"%u\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32
store i32 0, i32* %1
store i64 0, i64* %2
%4 = call i32 (...) @inital()
%5 = call i32 (...) @vider()
%6 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %2)
%8 = call i32 @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.2, i64 0, i64 0))
br label %9
9: ; preds = %18, %0
%10 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %3)
br label %12
12: ; preds = %9
%13 = load i32, i32* %3
%14 = icmp ugt i32 %13, 255
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = load i32, i32* %3
%17 = icmp ult i32 %16, 0
br label %18
18: ; preds = %15, %12
%19 = phi i1 [ true, %12 ], [ %17, %15 ]
br i1 %19, label %9, label %20
20: ; preds = %18
%21 = load i32, i32* %3
%22 = call i32 @placer(i32 %21)
%23 = load i64, i64* %2
%24 = call i32 @simulation(i64 %23)
ret i32 0
}

LLVM IR (-O2):
@.str = [45 x i8] c"Nombre de tours ( Si 0 : jusqu'a la fin ) : \00"
@.str.1 = [4 x i8] c"%lu\00"
@.str.4 = [3 x i8] c"%u\00"
@str = [73 x i8] c"Au bout de combien de chargement un emplacement de sucre s'est-il vide ?\00"
@str.5 = [42 x i8] c"Veuillez entrer une valeur dans [0,255] :\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i32
%3 = bitcast i64* %1 to i8*
store i64 0, i64* %1
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (...) @inital()
%6 = tail call i32 (...) @vider()
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %1)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str, i64 0, i64 0))
br label %10
10: ; preds = %10, %0
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.5, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%13 = load i32, i32* %2
%14 = icmp ugt i32 %13, 255
br i1 %14, label %10, label %15
15: ; preds = %10
%16 = call i32 @placer(i32 %13)
%17 = load i64, i64* %1
%18 = call i32 @simulation(i64 %17)
ret i32 0
}