#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 */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ cng_clear_screen();
int /*<<< orphan*/ cng_current_color_index(int);
int /*<<< orphan*/ cng_line(int /*<<< orphan*/, int, int, int);
double difftime(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void speed_test() {
  int j;
  time_t deb, fin;
  deb = time(NULL);
  for (j = 0; j < 256; j++) {
    cng_current_color_index(0);
    cng_clear_screen();
    cng_current_color_index(j);
    cng_line(0, j, 640, j);
  }
  fin = time(NULL);
  printf("\nTemps %5.2f sec.\n", difftime(fin, deb));
}


x86 assembly (clang, -O0):
<speed_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0x100,-0x4(%rbp)
jge    11be <speed_test+0x5e>
xor    %edi,%edi
call   1060 <cng_current_color_index@plt>
mov    $0x0,%al
call   1080 <cng_clear_screen@plt>
mov    -0x4(%rbp),%edi
call   1060 <cng_current_color_index@plt>
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%ecx
xor    %edi,%edi
mov    $0x280,%edx
call   1050 <cng_line@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    117b <speed_test+0x1b>
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <difftime@plt>
lea    0xe24(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<speed_test>:
push   %rbp
push   %rbx
push   %rax
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%ebx
xor    %ebp,%ebp
xchg   %ax,%ax
xor    %edi,%edi
call   1060 <cng_current_color_index@plt>
xor    %eax,%eax
call   1080 <cng_clear_screen@plt>
mov    %ebp,%edi
call   1060 <cng_current_color_index@plt>
xor    %edi,%edi
mov    %ebp,%esi
mov    $0x280,%edx
mov    %ebp,%ecx
call   1050 <cng_line@plt>
add    $0x1,%ebp
cmp    $0x100,%ebp
jne    1170 <speed_test+0x10>
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
mov    %ebx,%esi
call   1040 <difftime@plt>
lea    0xe49(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"\0ATemps %5.2f sec.\0A\00"
define void @speed_test() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 @time(i32* null)
store i32 %4, i32* %2
store i32 0, i32* %1
br label %5
5: ; preds = %16, %0
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 256
br i1 %7, label %8, label %19
8: ; preds = %5
%9 = call i32 @cng_current_color_index(i32 0)
%10 = call i32 (...) @cng_clear_screen()
%11 = load i32, i32* %1
%12 = call i32 @cng_current_color_index(i32 %11)
%13 = load i32, i32* %1
%14 = load i32, i32* %1
%15 = call i32 @cng_line(i32 0, i32 %13, i32 640, i32 %14)
br label %16
16: ; preds = %8
%17 = load i32, i32* %1
%18 = add nsw i32 %17, 1
store i32 %18, i32* %1
br label %5
19: ; preds = %5
%20 = call i32 @time(i32* null)
store i32 %20, i32* %3
%21 = load i32, i32* %3
%22 = load i32, i32* %2
%23 = call double @difftime(i32 %21, i32 %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), double %23)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"\0ATemps %5.2f sec.\0A\00"
define void @speed_test() {
%1 = tail call i32 @time(i32* null)
br label %2
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %8, %2 ]
%4 = tail call i32 @cng_current_color_index(i32 0)
%5 = tail call i32 (...) @cng_clear_screen()
%6 = tail call i32 @cng_current_color_index(i32 %3)
%7 = tail call i32 @cng_line(i32 0, i32 %3, i32 640, i32 %3)
%8 = add nuw nsw i32 %3, 1
%9 = icmp eq i32 %8, 256
br i1 %9, label %10, label %2
10: ; preds = %2
%11 = tail call i32 @time(i32* null)
%12 = tail call double @difftime(i32 %11, i32 %1)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), double %12)
ret void
}