#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*/ SetPixelsQuickly(int, int, unsigned long *, short);
void SetPixCopy(int x0, int y0, unsigned char bmval, short sz,
                unsigned long theNewValue[]) {
  register int row;
  for (row = sz; row > 0; row--, y0++) {
    SetPixelsQuickly(x0, y0, theNewValue, sz);
  }
}


x86 assembly (clang, -O0):
<SetPixCopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cx,%ax
mov    %dl,%cl
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %ax,-0xc(%rbp)
mov    %r8,-0x18(%rbp)
movswl -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    1169 <SetPixCopy+0x59>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x18(%rbp),%rdx
movswl -0xc(%rbp),%ecx
call   1030 <SetPixelsQuickly@plt>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1135 <SetPixCopy+0x25>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetPixCopy>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %cx,%cx
jle    114b <SetPixCopy+0x3b>
mov    %r8,%r14
mov    %esi,%ebp
mov    %edi,%r15d
movzwl %cx,%ebx
add    $0x1,%ebx
movswl %cx,%r12d
nop
mov    %r15d,%edi
mov    %ebp,%esi
mov    %r14,%rdx
mov    %r12d,%ecx
call   1030 <SetPixelsQuickly@plt>
add    $0x1,%ebp
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1130 <SetPixCopy+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @SetPixCopy(i32 %0, i32 %1, i8 zeroext %2, i16 signext %3, i64* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
%9 = alloca i16
%10 = alloca i64*
%11 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i8 %2, i8* %8
store i16 %3, i16* %9
store i64* %4, i64** %10
%12 = load i16, i16* %9
%13 = sext i16 %12 to i32
store i32 %13, i32* %11
br label %14
14: ; preds = %23, %5
%15 = load i32, i32* %11
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %28
17: ; preds = %14
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = load i64*, i64** %10
%21 = load i16, i16* %9
%22 = call i32 @SetPixelsQuickly(i32 %18, i32 %19, i64* %20, i16 signext %21)
br label %23
23: ; preds = %17
%24 = load i32, i32* %11
%25 = add nsw i32 %24, -1
store i32 %25, i32* %11
%26 = load i32, i32* %7
%27 = add nsw i32 %26, 1
store i32 %27, i32* %7
br label %14
28: ; preds = %14
ret void
}

LLVM IR (-O2):
define void @SetPixCopy(i32 %0, i32 %1, i8 zeroext %2, i16 signext %3, i64* %4) {
%6 = icmp sgt i16 %3, 0
br i1 %6, label %7, label %16
7: ; preds = %5
%8 = zext i16 %3 to i32
br label %9
9: ; preds = %7, %9
%10 = phi i32 [ %13, %9 ], [ %8, %7 ]
%11 = phi i32 [ %14, %9 ], [ %1, %7 ]
%12 = tail call i32 @SetPixelsQuickly(i32 %0, i32 %11, i64* %4, i16 signext %3)
%13 = add nsw i32 %10, -1
%14 = add nsw i32 %11, 1
%15 = icmp ugt i32 %10, 1
br i1 %15, label %9, label %16
16: ; preds = %9, %5
ret void
}