#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 abs(int);
int /*<<< orphan*/ cng_circle(int, int, int);
int /*<<< orphan*/ cng_clear_screen();
int /*<<< orphan*/ cng_current_color_index(int);
int /*<<< orphan*/ cng_delay(int);
double cng_get_time();
int /*<<< orphan*/ cng_line(int /*<<< orphan*/, int /*<<< orphan*/, int,
                            int /*<<< orphan*/);
int /*<<< orphan*/ cng_start_clock();
int /*<<< orphan*/ menu();
int /*<<< orphan*/ printf(char *, double);
int very_simple_animation() {
  int i;
  int cx = 640 / 2, cy = 480 / 2;
  int vx = 5, vy = 5;
  int cra = 50;
  cng_current_color_index(255);
  cng_clear_screen();
  cng_current_color_index(3);
  cng_line(0, 0, 640, 0);
  cng_start_clock();
  for (i = 0; i < 500; i++) {
    if ((cx + vx + cra > 640) || (cx - abs(vx) - cra < 0))
      vx = -vx;
    if ((cy + vy + cra > 480) || (cy - abs(vy) - cra < 0))
      vy = -vy;
    cx += vx;
    cy += vy;
    cng_current_color_index(3);
    cng_circle(cx, cy, cra);
    cng_current_color_index(255);
    cng_clear_screen();
  }
  printf("Temps : %f\n", cng_get_time());
  cng_delay(500);
  menu();
}


x86 assembly (clang, -O0):
<very_simple_animation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x140,-0xc(%rbp)
movl   $0xf0,-0x10(%rbp)
movl   $0x5,-0x14(%rbp)
movl   $0x5,-0x18(%rbp)
movl   $0x32,-0x1c(%rbp)
mov    $0xff,%edi
call   1070 <cng_current_color_index@plt>
mov    $0x0,%al
call   1090 <cng_clear_screen@plt>
mov    $0x3,%edi
call   1070 <cng_current_color_index@plt>
xor    %ecx,%ecx
mov    $0x280,%edx
mov    %ecx,%edi
mov    %ecx,%esi
call   1060 <cng_line@plt>
mov    $0x0,%al
call   1080 <cng_start_clock@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x1f4,-0x8(%rbp)
jge    12d4 <very_simple_animation+0x134>
mov    -0xc(%rbp),%eax
add    -0x14(%rbp),%eax
add    -0x1c(%rbp),%eax
cmp    $0x280,%eax
jg     1246 <very_simple_animation+0xa6>
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
sub    %ecx,%eax
sub    -0x1c(%rbp),%eax
cmp    $0x0,%eax
jge    124e <very_simple_animation+0xae>
xor    %eax,%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
cmp    $0x1e0,%eax
jg     1283 <very_simple_animation+0xe3>
mov    -0x10(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
sub    %ecx,%eax
sub    -0x1c(%rbp),%eax
cmp    $0x0,%eax
jge    128b <very_simple_animation+0xeb>
xor    %eax,%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0x3,%edi
call   1070 <cng_current_color_index@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   10c0 <cng_circle@plt>
mov    $0xff,%edi
call   1070 <cng_current_color_index@plt>
mov    $0x0,%al
call   1090 <cng_clear_screen@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1204 <very_simple_animation+0x64>
mov    $0x0,%al
call   10b0 <cng_get_time@plt>
lea    0xd1e(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1f4,%edi
call   10a0 <cng_delay@plt>
mov    $0x0,%al
call   1040 <menu@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<very_simple_animation>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0xff,%edi
call   1060 <cng_current_color_index@plt>
xor    %eax,%eax
call   1080 <cng_clear_screen@plt>
mov    $0x3,%edi
call   1060 <cng_current_color_index@plt>
xor    %edi,%edi
xor    %esi,%esi
mov    $0x280,%edx
xor    %ecx,%ecx
call   1050 <cng_line@plt>
xor    %eax,%eax
call   1070 <cng_start_clock@plt>
mov    $0x140,%ebx
mov    $0xf0,%eax
mov    $0x5,%r14d
mov    $0x1f4,%r15d
mov    $0x5,%r12d
jmp    122c <very_simple_animation+0x9c>
nopl   0x0(%rax,%rax,1)
sub    %r14d,%eax
neg    %r14d
mov    %eax,%ebp
add    %r12d,%ebx
mov    $0x3,%edi
call   1060 <cng_current_color_index@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0x32,%edx
call   10b0 <cng_circle@plt>
mov    $0xff,%edi
call   1060 <cng_current_color_index@plt>
xor    %eax,%eax
call   1080 <cng_clear_screen@plt>
mov    %ebp,%eax
add    $0xffffffff,%r15d
je     1269 <very_simple_animation+0xd9>
lea    (%r12,%rbx,1),%ecx
cmp    $0x24e,%ecx
jg     1248 <very_simple_animation+0xb8>
mov    %r12d,%ecx
neg    %ecx
cmovns %r12d,%ecx
add    %ebx,%ecx
cmp    $0x31,%ecx
jg     124b <very_simple_animation+0xbb>
neg    %r12d
lea    (%r14,%rax,1),%ebp
cmp    $0x1ae,%ebp
jg     11f0 <very_simple_animation+0x60>
mov    %r14d,%ecx
neg    %ecx
cmovns %r14d,%ecx
add    %eax,%ecx
cmp    $0x31,%ecx
jle    11f0 <very_simple_animation+0x60>
jmp    11f8 <very_simple_animation+0x68>
xor    %eax,%eax
call   10a0 <cng_get_time@plt>
lea    0xd89(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1f4,%edi
call   1090 <cng_delay@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <menu@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"Temps : %f\0A\00"
define i32 @very_simple_animation() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 320, i32* %3
store i32 240, i32* %4
store i32 5, i32* %5
store i32 5, i32* %6
store i32 50, i32* %7
%8 = call i32 @cng_current_color_index(i32 255)
%9 = call i32 (...) @cng_clear_screen()
%10 = call i32 @cng_current_color_index(i32 3)
%11 = call i32 @cng_line(i32 0, i32 0, i32 640, i32 0)
%12 = call i32 (...) @cng_start_clock()
store i32 0, i32* %2
br label %13
13: ; preds = %66, %0
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, 500
br i1 %15, label %16, label %69
16: ; preds = %13
%17 = load i32, i32* %3
%18 = load i32, i32* %5
%19 = add nsw i32 %17, %18
%20 = load i32, i32* %7
%21 = add nsw i32 %19, %20
%22 = icmp sgt i32 %21, 640
br i1 %22, label %31, label %23
23: ; preds = %16
%24 = load i32, i32* %3
%25 = load i32, i32* %5
%26 = call i32 @abs(i32 %25)
%27 = sub nsw i32 %24, %26
%28 = load i32, i32* %7
%29 = sub nsw i32 %27, %28
%30 = icmp slt i32 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %23, %16
%32 = load i32, i32* %5
%33 = sub nsw i32 0, %32
store i32 %33, i32* %5
br label %34
34: ; preds = %31, %23
%35 = load i32, i32* %4
%36 = load i32, i32* %6
%37 = add nsw i32 %35, %36
%38 = load i32, i32* %7
%39 = add nsw i32 %37, %38
%40 = icmp sgt i32 %39, 480
br i1 %40, label %49, label %41
41: ; preds = %34
%42 = load i32, i32* %4
%43 = load i32, i32* %6
%44 = call i32 @abs(i32 %43)
%45 = sub nsw i32 %42, %44
%46 = load i32, i32* %7
%47 = sub nsw i32 %45, %46
%48 = icmp slt i32 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %41, %34
%50 = load i32, i32* %6
%51 = sub nsw i32 0, %50
store i32 %51, i32* %6
br label %52
52: ; preds = %49, %41
%53 = load i32, i32* %5
%54 = load i32, i32* %3
%55 = add nsw i32 %54, %53
store i32 %55, i32* %3
%56 = load i32, i32* %6
%57 = load i32, i32* %4
%58 = add nsw i32 %57, %56
store i32 %58, i32* %4
%59 = call i32 @cng_current_color_index(i32 3)
%60 = load i32, i32* %3
%61 = load i32, i32* %4
%62 = load i32, i32* %7
%63 = call i32 @cng_circle(i32 %60, i32 %61, i32 %62)
%64 = call i32 @cng_current_color_index(i32 255)
%65 = call i32 (...) @cng_clear_screen()
br label %66
66: ; preds = %52
%67 = load i32, i32* %2
%68 = add nsw i32 %67, 1
store i32 %68, i32* %2
br label %13
69: ; preds = %13
%70 = call double (...) @cng_get_time()
%71 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double %70)
%72 = call i32 @cng_delay(i32 500)
%73 = call i32 (...) @menu()
%74 = load i32, i32* %1
ret i32 %74
}

LLVM IR (-O2):
@.str = [12 x i8] c"Temps : %f\0A\00"
define i32 @very_simple_animation() {
%1 = tail call i32 @cng_current_color_index(i32 255)
%2 = tail call i32 (...) @cng_clear_screen()
%3 = tail call i32 @cng_current_color_index(i32 3)
%4 = tail call i32 @cng_line(i32 0, i32 0, i32 640, i32 0)
%5 = tail call i32 (...) @cng_start_clock()
br label %6
6: ; preds = %0, %31
%7 = phi i32 [ 0, %0 ], [ %39, %31 ]
%8 = phi i32 [ 5, %0 ], [ %33, %31 ]
%9 = phi i32 [ 5, %0 ], [ %21, %31 ]
%10 = phi i32 [ 240, %0 ], [ %32, %31 ]
%11 = phi i32 [ 320, %0 ], [ %34, %31 ]
%12 = add nsw i32 %9, %11
%13 = icmp sgt i32 %12, 590
br i1 %13, label %18, label %14
14: ; preds = %6
%15 = tail call i32 @llvm.abs.i32(i32 %9, i1 true)
%16 = sub nsw i32 %11, %15
%17 = icmp slt i32 %16, 50
br i1 %17, label %18, label %20
18: ; preds = %14, %6
%19 = sub nsw i32 0, %9
br label %20
20: ; preds = %18, %14
%21 = phi i32 [ %19, %18 ], [ %9, %14 ]
%22 = add nsw i32 %8, %10
%23 = icmp sgt i32 %22, 430
br i1 %23, label %28, label %24
24: ; preds = %20
%25 = tail call i32 @llvm.abs.i32(i32 %8, i1 true)
%26 = sub nsw i32 %10, %25
%27 = icmp slt i32 %26, 50
br i1 %27, label %28, label %31
28: ; preds = %24, %20
%29 = sub nsw i32 0, %8
%30 = sub i32 %10, %8
br label %31
31: ; preds = %28, %24
%32 = phi i32 [ %30, %28 ], [ %22, %24 ]
%33 = phi i32 [ %29, %28 ], [ %8, %24 ]
%34 = add nsw i32 %21, %11
%35 = tail call i32 @cng_current_color_index(i32 3)
%36 = tail call i32 @cng_circle(i32 %34, i32 %32, i32 50)
%37 = tail call i32 @cng_current_color_index(i32 255)
%38 = tail call i32 (...) @cng_clear_screen()
%39 = add nuw nsw i32 %7, 1
%40 = icmp eq i32 %39, 500
br i1 %40, label %41, label %6
41: ; preds = %31
%42 = tail call double (...) @cng_get_time()
%43 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double %42)
%44 = tail call i32 @cng_delay(i32 500)
%45 = tail call i32 (...) @menu()
ret i32 undef
}