#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*/ pfan_draw_point(int, int, unsigned short *);
void Test_rows(unsigned short display[156]) {
  int j = 0;
  for (int i = 0; i < 40; i += 3) {
    j = (j > 10) ? 0 : j;
    pfan_draw_point(i, j, display);
    pfan_draw_point(i + 1, j++, display);
  }
}


x86 assembly (clang, -O0):
<Test_rows>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x28,-0x10(%rbp)
jge    118b <Test_rows+0x7b>
cmpl   $0xa,-0xc(%rbp)
jle    1148 <Test_rows+0x38>
xor    %eax,%eax
mov    %eax,-0x14(%rbp)
jmp    114e <Test_rows+0x3e>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rdx
call   1030 <pfan_draw_point@plt>
mov    -0x10(%rbp),%edi
add    $0x1,%edi
mov    -0xc(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdx
call   1030 <pfan_draw_point@plt>
mov    -0x10(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x10(%rbp)
jmp    112a <Test_rows+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Test_rows>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r14
xor    %r12d,%r12d
xor    %r15d,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0xb,%ebx
cmovge %r12d,%ebx
mov    %r15d,%edi
mov    %ebx,%esi
mov    %r14,%rdx
call   1030 <pfan_draw_point@plt>
lea    0x1(%rbx),%ebp
lea    0x1(%r15),%edi
mov    %ebx,%esi
mov    %r14,%rdx
call   1030 <pfan_draw_point@plt>
lea    0x3(%r15),%eax
mov    %ebp,%ebx
cmp    $0x25,%r15d
mov    %eax,%r15d
jb     1130 <Test_rows+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @Test_rows(i16* %0) {
%2 = alloca i16*
%3 = alloca i32
%4 = alloca i32
store i16* %0, i16** %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %26, %1
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 40
br i1 %7, label %8, label %29
8: ; preds = %5
%9 = load i32, i32* %3
%10 = icmp sgt i32 %9, 10
br i1 %10, label %11, label %12
11: ; preds = %8
br label %14
12: ; preds = %8
%13 = load i32, i32* %3
br label %14
14: ; preds = %12, %11
%15 = phi i32 [ 0, %11 ], [ %13, %12 ]
store i32 %15, i32* %3
%16 = load i32, i32* %4
%17 = load i32, i32* %3
%18 = load i16*, i16** %2
%19 = call i32 @pfan_draw_point(i32 %16, i32 %17, i16* %18)
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
%24 = load i16*, i16** %2
%25 = call i32 @pfan_draw_point(i32 %21, i32 %22, i16* %24)
br label %26
26: ; preds = %14
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 3
store i32 %28, i32* %4
br label %5
29: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @Test_rows(i16* %0) {
br label %3
2: ; preds = %3
ret void
3: ; preds = %1, %3
%4 = phi i32 [ 0, %1 ], [ %12, %3 ]
%5 = phi i32 [ 0, %1 ], [ %10, %3 ]
%6 = icmp sgt i32 %5, 10
%7 = select i1 %6, i32 0, i32 %5
%8 = tail call i32 @pfan_draw_point(i32 %4, i32 %7, i16* %0)
%9 = add nuw nsw i32 %4, 1
%10 = add nsw i32 %7, 1
%11 = tail call i32 @pfan_draw_point(i32 %9, i32 %7, i16* %0)
%12 = add nuw nsw i32 %4, 3
%13 = icmp ult i32 %4, 37
br i1 %13, label %3, label %2
}