#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 */
struct colordata {
  int dummy;
};

/* Variables and functions */
int findline(int, int);
int /*<<< orphan*/ moirerow(struct colordata *, int);
int /*<<< orphan*/ moverow(int);
void do_other_lines(struct colordata *cdp, int line) {
  int foundone;
  int l;
  do {
    foundone = 0;
    l = findline(line & 0xff00, 1);
    if (l >= 0) {
      line = l;
      moirerow(cdp, line);
      foundone = 1;
    }
    l = findline(line & 0xff00, 2);
    if (l >= 0) {
      line = l;
      moverow(line);
      foundone = 1;
    }
  } while (foundone != 0);
}


x86 assembly (clang, -O0):
<do_other_lines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%edi
and    $0xff00,%edi
mov    $0x1,%esi
call   1030 <findline@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     117f <do_other_lines+0x4f>
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <moirerow@plt>
movl   $0x1,-0x10(%rbp)
mov    -0xc(%rbp),%edi
and    $0xff00,%edi
mov    $0x2,%esi
call   1030 <findline@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     11b4 <do_other_lines+0x84>
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <moverow@plt>
movl   $0x1,-0x10(%rbp)
jmp    11b9 <do_other_lines+0x89>
cmpl   $0x0,-0x10(%rbp)
jne    113f <do_other_lines+0xf>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_other_lines>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r15d
mov    %rdi,%r14
jmp    1145 <do_other_lines+0x15>
test   %r12d,%r12d
je     11a7 <do_other_lines+0x77>
mov    %r15d,%ebp
and    $0xff00,%ebp
mov    %ebp,%edi
mov    $0x1,%esi
call   1030 <findline@plt>
test   %eax,%eax
js     1180 <do_other_lines+0x50>
mov    %eax,%ebx
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <moirerow@plt>
mov    %ebx,%ebp
and    $0xff00,%ebp
mov    $0x1,%r12d
mov    %ebx,%r15d
jmp    1183 <do_other_lines+0x53>
nopl   (%rax)
xor    %r12d,%r12d
mov    %ebp,%edi
mov    $0x2,%esi
call   1030 <findline@plt>
test   %eax,%eax
js     1140 <do_other_lines+0x10>
mov    %eax,%ebx
mov    %eax,%edi
call   1050 <moverow@plt>
mov    $0x1,%r12d
mov    %ebx,%r15d
jmp    1140 <do_other_lines+0x10>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.colordata = type { i32 }
define void @do_other_lines(%struct.colordata* %0, i32 %1) {
%3 = alloca %struct.colordata*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store %struct.colordata* %0, %struct.colordata** %3
store i32 %1, i32* %4
br label %7
7: ; preds = %29, %2
store i32 0, i32* %5
%8 = load i32, i32* %4
%9 = and i32 %8, 65280
%10 = call i32 @findline(i32 %9, i32 1)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp sge i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %7
%14 = load i32, i32* %6
store i32 %14, i32* %4
%15 = load %struct.colordata*, %struct.colordata** %3
%16 = load i32, i32* %4
%17 = call i32 @moirerow(%struct.colordata* %15, i32 %16)
store i32 1, i32* %5
br label %18
18: ; preds = %13, %7
%19 = load i32, i32* %4
%20 = and i32 %19, 65280
%21 = call i32 @findline(i32 %20, i32 2)
store i32 %21, i32* %6
%22 = load i32, i32* %6
%23 = icmp sge i32 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %18
%25 = load i32, i32* %6
store i32 %25, i32* %4
%26 = load i32, i32* %4
%27 = call i32 @moverow(i32 %26)
store i32 1, i32* %5
br label %28
28: ; preds = %24, %18
br label %29
29: ; preds = %28
%30 = load i32, i32* %5
%31 = icmp ne i32 %30, 0
br i1 %31, label %7, label %32
32: ; preds = %29
ret void
}

LLVM IR (-O2):
%struct.colordata = type { i32 }
define void @do_other_lines(%struct.colordata* %0, i32 %1) {
br label %3
3: ; preds = %19, %2
%4 = phi i32 [ %1, %2 ], [ %20, %19 ]
%5 = and i32 %4, 65280
%6 = tail call i32 @findline(i32 %5, i32 1)
%7 = icmp sgt i32 %6, -1
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = tail call i32 @moirerow(%struct.colordata* %0, i32 %6)
%10 = and i32 %6, 65280
br label %11
11: ; preds = %8, %3
%12 = phi i32 [ %10, %8 ], [ %5, %3 ]
%13 = phi i32 [ %6, %8 ], [ %4, %3 ]
%14 = phi i32 [ 1, %8 ], [ 0, %3 ]
%15 = tail call i32 @findline(i32 %12, i32 2)
%16 = icmp sgt i32 %15, -1
br i1 %16, label %17, label %19
17: ; preds = %11
%18 = tail call i32 @moverow(i32 %15)
br label %19
19: ; preds = %11, %17
%20 = phi i32 [ %15, %17 ], [ %13, %11 ]
%21 = phi i32 [ 1, %17 ], [ %14, %11 ]
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %3
23: ; preds = %19
ret void
}