#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*/ printf(char *, ...);
int saisieEntier();
int /*<<< orphan*/ system(char *);
int main() {
  int cde, val, xi, xf, yi, yf, e;
  int dx;
  int dy;
  xi = 0;
  printf("duree de la derniere phase [en nb de TIC TAC]: ");
  xf = saisieEntier();
  yi = 0;
  yf = 6;
  dx = xf - xi;
  dy = yf - yi;
  dy *= 2;
  e = dx;
  while (xi < xf) {
    xi++;
    e -= dy;
    if (e < 0) {
      yi++;
      e += dx * 2;
    }
    printf("y = %d -> TICTAC No %d\n", yi, xi);
  }
  system("Pause");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <saisieEntier@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x6,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11e5 <main+0xb5>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x28(%rbp),%ecx
mov    -0x20(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    11cc <main+0x9c>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x24(%rbp),%eax
shl    $0x1,%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    118d <main+0x5d>
lea    0xe5c(%rip),%rdi
call   1030 <system@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <saisieEntier@plt>
test   %eax,%eax
jle    11ac <main+0x7c>
mov    %eax,%ebx
lea    (%rbx,%rbx,1),%r12d
mov    %eax,%r13d
neg    %r13d
mov    $0x1,%r15d
lea    0xec3(%rip),%r14
xor    %ebp,%ebp
nop
xor    %eax,%eax
cmp    $0xc,%ebx
setl   %al
mov    $0x0,%ecx
cmovl  %r12d,%ecx
add    %eax,%ebp
add    %ecx,%ebx
add    $0xfffffff4,%ebx
mov    %r14,%rdi
mov    %ebp,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%r15,%r13,1),%eax
add    $0x1,%eax
mov    %r15d,%ecx
add    $0x1,%ecx
mov    %ecx,%r15d
cmp    $0x1,%eax
jne    1170 <main+0x40>
lea    0xe95(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [48 x i8] c"duree de la derniere phase [en nb de TIC TAC]: \00"
@.str.1 = [24 x i8] c"y = %d -> TICTAC No %d\0A\00"
@.str.2 = [6 x i8] c"Pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (...) @saisieEntier()
store i32 %12, i32* %5
store i32 0, i32* %6
store i32 6, i32* %7
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = sub nsw i32 %13, %14
store i32 %15, i32* %9
%16 = load i32, i32* %7
%17 = load i32, i32* %6
%18 = sub nsw i32 %16, %17
store i32 %18, i32* %10
%19 = load i32, i32* %10
%20 = mul nsw i32 %19, 2
store i32 %20, i32* %10
%21 = load i32, i32* %9
store i32 %21, i32* %8
br label %22
22: ; preds = %41, %0
%23 = load i32, i32* %4
%24 = load i32, i32* %5
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %45
26: ; preds = %22
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
%29 = load i32, i32* %10
%30 = load i32, i32* %8
%31 = sub nsw i32 %30, %29
store i32 %31, i32* %8
%32 = load i32, i32* %8
%33 = icmp slt i32 %32, 0
br i1 %33, label %34, label %41
34: ; preds = %26
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %6
%37 = load i32, i32* %9
%38 = mul nsw i32 %37, 2
%39 = load i32, i32* %8
%40 = add nsw i32 %39, %38
store i32 %40, i32* %8
br label %41
41: ; preds = %34, %26
%42 = load i32, i32* %6
%43 = load i32, i32* %4
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %42, i32 %43)
br label %22
45: ; preds = %22
%46 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%47 = load i32, i32* %1
ret i32 %47
}

LLVM IR (-O2):
@.str = [48 x i8] c"duree de la derniere phase [en nb de TIC TAC]: \00"
@.str.1 = [24 x i8] c"y = %d -> TICTAC No %d\0A\00"
@.str.2 = [6 x i8] c"Pause\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @saisieEntier()
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %19
4: ; preds = %0
%5 = shl nuw nsw i32 %2, 1
br label %6
6: ; preds = %4, %6
%7 = phi i32 [ 0, %4 ], [ %10, %6 ]
%8 = phi i32 [ %2, %4 ], [ %16, %6 ]
%9 = phi i32 [ 0, %4 ], [ %14, %6 ]
%10 = add nuw nsw i32 %7, 1
%11 = add nsw i32 %8, -12
%12 = icmp slt i32 %8, 12
%13 = zext i1 %12 to i32
%14 = add nuw nsw i32 %9, %13
%15 = select i1 %12, i32 %5, i32 0
%16 = add nsw i32 %11, %15
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %14, i32 %10)
%18 = icmp eq i32 %10, %2
br i1 %18, label %19, label %6
19: ; preds = %6, %0
%20 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}