#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 uint8_t;
struct fb_var_screeninfo {
  int dummy;
};

/* Variables and functions */
void *setPixelRGB(void *, struct fb_var_screeninfo const *, int, int, int);
void *draw_cross_rgb(void *ptr, struct fb_var_screeninfo const *info, int x,
                     int y) {
  int is_black = 1;
  uint8_t col;
  if (x == y || x == -y || x == -50 + 5 || x + 1 == 50 - 5 || y == -50 + 5 ||
      y + 1 == 50 - 5)
    is_black = !is_black;
  if (y < 0)
    is_black = !is_black;
  col = is_black ? 0 : 255;
  return setPixelRGB(ptr, info, col, col, col);
}


x86 assembly (clang, -O0):
<draw_cross_rgb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
je     117b <draw_cross_rgb+0x6b>
mov    -0x14(%rbp),%eax
xor    %ecx,%ecx
sub    -0x18(%rbp),%ecx
cmp    %ecx,%eax
je     117b <draw_cross_rgb+0x6b>
cmpl   $0xffffffd3,-0x14(%rbp)
je     117b <draw_cross_rgb+0x6b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cmp    $0x2d,%eax
je     117b <draw_cross_rgb+0x6b>
cmpl   $0xffffffd3,-0x18(%rbp)
je     117b <draw_cross_rgb+0x6b>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
cmp    $0x2d,%eax
jne    118c <draw_cross_rgb+0x7c>
cmpl   $0x0,-0x1c(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    11a7 <draw_cross_rgb+0x97>
cmpl   $0x0,-0x1c(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edx
mov    $0xff,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <setPixelRGB@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_cross_rgb>:
cmp    %ecx,%edx
je     1130 <draw_cross_rgb+0x20>
mov    %ecx,%eax
neg    %eax
cmp    %edx,%eax
je     1130 <draw_cross_rgb+0x20>
cmp    $0xffffffd3,%edx
je     1130 <draw_cross_rgb+0x20>
cmp    $0x2c,%edx
je     1130 <draw_cross_rgb+0x20>
cmp    $0x2c,%ecx
je     1130 <draw_cross_rgb+0x20>
cmp    $0xffffffd3,%ecx
jne    1152 <draw_cross_rgb+0x42>
xor    %edx,%edx
mov    $0x1,%eax
test   %ecx,%ecx
cmovns %edx,%eax
xor    %edx,%edx
test   %eax,%eax
mov    $0xff,%ecx
cmovne %edx,%ecx
mov    %ecx,%edx
mov    %ecx,%r8d
jmp    1030 <setPixelRGB@plt>
mov    $0x1,%edx
xor    %eax,%eax
jmp    1137 <draw_cross_rgb+0x27>

LLVM IR (-O0):
%struct.fb_var_screeninfo = type { i32 }
define i8* @draw_cross_rgb(i8* %0, %struct.fb_var_screeninfo* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca %struct.fb_var_screeninfo*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %5
store %struct.fb_var_screeninfo* %1, %struct.fb_var_screeninfo** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 1, i32* %9
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = icmp eq i32 %11, %12
br i1 %13, label %33, label %14
14: ; preds = %4
%15 = load i32, i32* %7
%16 = load i32, i32* %8
%17 = sub nsw i32 0, %16
%18 = icmp eq i32 %15, %17
br i1 %18, label %33, label %19
19: ; preds = %14
%20 = load i32, i32* %7
%21 = icmp eq i32 %20, -45
br i1 %21, label %33, label %22
22: ; preds = %19
%23 = load i32, i32* %7
%24 = add nsw i32 %23, 1
%25 = icmp eq i32 %24, 45
br i1 %25, label %33, label %26
26: ; preds = %22
%27 = load i32, i32* %8
%28 = icmp eq i32 %27, -45
br i1 %28, label %33, label %29
29: ; preds = %26
%30 = load i32, i32* %8
%31 = add nsw i32 %30, 1
%32 = icmp eq i32 %31, 45
br i1 %32, label %33, label %38
33: ; preds = %29, %26, %22, %19, %14, %4
%34 = load i32, i32* %9
%35 = icmp ne i32 %34, 0
%36 = xor i1 %35, true
%37 = zext i1 %36 to i32
store i32 %37, i32* %9
br label %38
38: ; preds = %33, %29
%39 = load i32, i32* %8
%40 = icmp slt i32 %39, 0
br i1 %40, label %41, label %46
41: ; preds = %38
%42 = load i32, i32* %9
%43 = icmp ne i32 %42, 0
%44 = xor i1 %43, true
%45 = zext i1 %44 to i32
store i32 %45, i32* %9
br label %46
46: ; preds = %41, %38
%47 = load i32, i32* %9
%48 = icmp ne i32 %47, 0
%49 = zext i1 %48 to i64
%50 = select i1 %48, i32 0, i32 255
store i32 %50, i32* %10
%51 = load i8*, i8** %5
%52 = load %struct.fb_var_screeninfo*, %struct.fb_var_screeninfo** %6
%53 = load i32, i32* %10
%54 = load i32, i32* %10
%55 = load i32, i32* %10
%56 = call i8* @setPixelRGB(i8* %51, %struct.fb_var_screeninfo* %52, i32 %53, i32 %54, i32 %55)
ret i8* %56
}

LLVM IR (-O2):
%struct.fb_var_screeninfo = type { i32 }
define i8* @draw_cross_rgb(i8* %0, %struct.fb_var_screeninfo* %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %2, %3
%6 = sub i32 0, %3
%7 = icmp eq i32 %6, %2
%8 = or i1 %5, %7
br i1 %8, label %11, label %9
9: ; preds = %4
switch i32 %2, label %10 [
i32 -45, label %11
i32 44, label %11
]
10: ; preds = %9
switch i32 %3, label %12 [
i32 -45, label %11
i32 44, label %11
]
11: ; preds = %9, %9, %10, %10, %4
br label %12
12: ; preds = %10, %11
%13 = phi i32 [ 1, %11 ], [ 0, %10 ]
%14 = phi i32 [ 0, %11 ], [ 1, %10 ]
%15 = icmp slt i32 %3, 0
%16 = select i1 %15, i32 %13, i32 %14
%17 = icmp eq i32 %16, 0
%18 = select i1 %17, i32 255, i32 0
%19 = tail call i8* @setPixelRGB(i8* %0, %struct.fb_var_screeninfo* %1, i32 %18, i32 %18, i32 %18)
ret i8* %19
}