#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*/ draw_line(char *, int, int, int, int);
int /*<<< orphan*/ memset(char *, int, int);
int /*<<< orphan*/ sleep(int);
int line_test(char *fbp, int size, int fbfd, int xres, int yres) {
  int x0, y0;
  int x1, y1;
  while (1) {
    int i, j;
    for (j = 10; j < (yres - 20); j += 11) {
      for (i = 10; i < xres; i += 10) {
        x0 = i;
        y0 = j;
        x1 = i;
        y1 = j + 9;
        sleep(1);
        draw_line(fbp, x0, y0, x1, y1);
      }
    }
    memset(fbp, 0x00, size);
  }
  return 0;
}


x86 assembly (clang, -O0):
<line_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
movl   $0xa,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x14,%ecx
cmp    %ecx,%eax
jge    11d0 <line_test+0xa0>
movl   $0xa,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11bd <line_test+0x8d>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x30(%rbp),%eax
add    $0x9,%eax
mov    %eax,-0x28(%rbp)
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    -0x28(%rbp),%r8d
call   1040 <draw_line@plt>
mov    -0x2c(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x2c(%rbp)
jmp    1168 <line_test+0x38>
jmp    11c2 <line_test+0x92>
mov    -0x30(%rbp),%eax
add    $0xb,%eax
mov    %eax,-0x30(%rbp)
jmp    1150 <line_test+0x20>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   1030 <memset@plt>
jmp    1149 <line_test+0x19>

x86 assembly (clang, -O2):
<line_test>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%r13d
mov    %esi,0xc(%rsp)
mov    %rdi,%r12
mov    %r8,%rax
mov    %r8,0x10(%rsp)
lea    -0x14(%r8),%r15d
jmp    116e <line_test+0x3e>
cs nopw 0x0(%rax,%rax,1)
mov    %r12,%rdi
xor    %esi,%esi
mov    0xc(%rsp),%edx
call   1030 <memset@plt>
cmpl   $0x1f,0x10(%rsp)
jl     1160 <line_test+0x30>
mov    $0xa,%ebx
jmp    1188 <line_test+0x58>
nopl   0x0(%rax)
add    $0xb,%ebx
cmp    %r15d,%ebx
jge    1160 <line_test+0x30>
cmp    $0xb,%r13d
jl     1180 <line_test+0x50>
lea    0x9(%rbx),%ebp
mov    $0xa,%r14d
nopw   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    %r12,%rdi
mov    %r14d,%esi
mov    %ebx,%edx
mov    %r14d,%ecx
mov    %ebp,%r8d
call   1040 <draw_line@plt>
add    $0xa,%r14d
cmp    %r13d,%r14d
jl     11a0 <line_test+0x70>
jmp    1180 <line_test+0x50>

LLVM IR (-O0):
define i32 @line_test(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
br label %17
17: ; preds = %5, %48
store i32 10, i32* %16
br label %18
18: ; preds = %45, %17
%19 = load i32, i32* %16
%20 = load i32, i32* %10
%21 = sub nsw i32 %20, 20
%22 = icmp slt i32 %19, %21
br i1 %22, label %23, label %48
23: ; preds = %18
store i32 10, i32* %15
br label %24
24: ; preds = %41, %23
%25 = load i32, i32* %15
%26 = load i32, i32* %9
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %44
28: ; preds = %24
%29 = load i32, i32* %15
store i32 %29, i32* %11
%30 = load i32, i32* %16
store i32 %30, i32* %12
%31 = load i32, i32* %15
store i32 %31, i32* %13
%32 = load i32, i32* %16
%33 = add nsw i32 %32, 9
store i32 %33, i32* %14
%34 = call i32 @sleep(i32 1)
%35 = load i8*, i8** %6
%36 = load i32, i32* %11
%37 = load i32, i32* %12
%38 = load i32, i32* %13
%39 = load i32, i32* %14
%40 = call i32 @draw_line(i8* %35, i32 %36, i32 %37, i32 %38, i32 %39)
br label %41
41: ; preds = %28
%42 = load i32, i32* %15
%43 = add nsw i32 %42, 10
store i32 %43, i32* %15
br label %24
44: ; preds = %24
br label %45
45: ; preds = %44
%46 = load i32, i32* %16
%47 = add nsw i32 %46, 11
store i32 %47, i32* %16
br label %18
48: ; preds = %18
%49 = load i8*, i8** %6
%50 = load i32, i32* %7
%51 = call i32 @memset(i8* %49, i32 0, i32 %50)
br label %17
}

LLVM IR (-O2):
define i32 @line_test(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = add nsw i32 %4, -20
%7 = icmp sgt i32 %4, 30
%8 = icmp sgt i32 %3, 10
br label %9
9: ; preds = %23, %5
br i1 %7, label %10, label %23
10: ; preds = %9, %20
%11 = phi i32 [ %21, %20 ], [ 10, %9 ]
br i1 %8, label %12, label %20
12: ; preds = %10
%13 = add nuw nsw i32 %11, 9
br label %14
14: ; preds = %12, %14
%15 = phi i32 [ 10, %12 ], [ %18, %14 ]
%16 = tail call i32 @sleep(i32 1)
%17 = tail call i32 @draw_line(i8* %0, i32 %15, i32 %11, i32 %15, i32 %13)
%18 = add nuw nsw i32 %15, 10
%19 = icmp slt i32 %18, %3
br i1 %19, label %14, label %20
20: ; preds = %14, %10
%21 = add nuw nsw i32 %11, 11
%22 = icmp slt i32 %21, %6
br i1 %22, label %10, label %23
23: ; preds = %20, %9
%24 = tail call i32 @memset(i8* %0, i32 0, i32 %1)
br label %9
}