#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*/ fd_log_at(char *, int, char *);
int /*<<< orphan*/ fd_ssd1315_write_command_arg2(int, int, int);
void fd_ssd1315_write_image_start(int x, int y, int width, int height) {
  if (!((0 <= x) && (x <= 127)))
    fd_log_at("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/denisbohm/firefly-ice-firmware/refs/"
              "heads/master/src/fd_ssd1315.c",
              89, "(0 <= x) && (x <= 127)");
  if (!((width > 0) && (0 <= (x + width)) && ((x + width) <= 128)))
    fd_log_at("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/denisbohm/firefly-ice-firmware/refs/"
              "heads/master/src/fd_ssd1315.c",
              90, "(width > 0) && (0 <= (x + width)) && ((x + width) <= 128)");
  if (!((0 <= y) && (y <= 63)))
    fd_log_at("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/denisbohm/firefly-ice-firmware/refs/"
              "heads/master/src/fd_ssd1315.c",
              91, "(0 <= y) && (y <= 63)");
  if (!((height > 0) && (0 <= (y + height)) && ((y + height) <= 64)))
    fd_log_at("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/denisbohm/firefly-ice-firmware/refs/"
              "heads/master/src/fd_ssd1315.c",
              92,
              "(height > 0) && (0 <= (y + height)) && ((y + height) <= 64)");
  if (!((y & 0x7) == 0))
    fd_log_at("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/denisbohm/firefly-ice-firmware/refs/"
              "heads/master/src/fd_ssd1315.c",
              93, "(y & 0x7) == 0");
  if (!((height & 0x7) == 0))
    fd_log_at("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/denisbohm/firefly-ice-firmware/refs/"
              "heads/master/src/fd_ssd1315.c",
              94, "(height & 0x7) == 0");
  fd_ssd1315_write_command_arg2(0x21, x, x + width - 1);
  fd_ssd1315_write_command_arg2(0x22, y / 8, (y + height) / 8 - 1);
}


x86 assembly (clang, -O0):
<fd_ssd1315_write_image_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x4(%rbp),%eax
jg     1149 <fd_ssd1315_write_image_start+0x29>
cmpl   $0x7f,-0x4(%rbp)
jle    1161 <fd_ssd1315_write_image_start+0x41>
lea    0xeb0(%rip),%rdi
mov    $0x59,%esi
lea    0xf40(%rip),%rdx
call   1030 <fd_log_at@plt>
cmpl   $0x0,-0xc(%rbp)
jle    118c <fd_ssd1315_write_image_start+0x6c>
mov    -0x4(%rbp),%ecx
add    -0xc(%rbp),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jg     118c <fd_ssd1315_write_image_start+0x6c>
mov    -0x4(%rbp),%eax
add    -0xc(%rbp),%eax
cmp    $0x80,%eax
jle    11a4 <fd_ssd1315_write_image_start+0x84>
lea    0xe6d(%rip),%rdi
mov    $0x5a,%esi
lea    0xf14(%rip),%rdx
call   1030 <fd_log_at@plt>
xor    %eax,%eax
cmp    -0x8(%rbp),%eax
jg     11b9 <fd_ssd1315_write_image_start+0x99>
cmpl   $0x3f,-0x8(%rbp)
jle    11d1 <fd_ssd1315_write_image_start+0xb1>
lea    0xe40(%rip),%rdi
mov    $0x5b,%esi
lea    0xf21(%rip),%rdx
call   1030 <fd_log_at@plt>
cmpl   $0x0,-0x10(%rbp)
jle    11fa <fd_ssd1315_write_image_start+0xda>
mov    -0x8(%rbp),%ecx
add    -0x10(%rbp),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jg     11fa <fd_ssd1315_write_image_start+0xda>
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
cmp    $0x40,%eax
jle    1212 <fd_ssd1315_write_image_start+0xf2>
lea    0xdff(%rip),%rdi
mov    $0x5c,%esi
lea    0xef6(%rip),%rdx
call   1030 <fd_log_at@plt>
mov    -0x8(%rbp),%eax
and    $0x7,%eax
cmp    $0x0,%eax
je     1239 <fd_ssd1315_write_image_start+0x119>
lea    0xdd8(%rip),%rdi
mov    $0x5d,%esi
lea    0xf0b(%rip),%rdx
call   1030 <fd_log_at@plt>
mov    -0x10(%rbp),%eax
and    $0x7,%eax
cmp    $0x0,%eax
je     1260 <fd_ssd1315_write_image_start+0x140>
lea    0xdb1(%rip),%rdi
mov    $0x5e,%esi
lea    0xef3(%rip),%rdx
call   1030 <fd_log_at@plt>
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%edx
add    -0xc(%rbp),%edx
sub    $0x1,%edx
mov    $0x21,%edi
call   1040 <fd_ssd1315_write_command_arg2@plt>
mov    -0x8(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
sub    $0x1,%edx
mov    $0x22,%edi
call   1040 <fd_ssd1315_write_command_arg2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fd_ssd1315_write_image_start>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%r15d
mov    %edx,%ebp
mov    %esi,%ebx
mov    %edi,%r14d
cmp    $0x80,%edi
jb     1152 <fd_ssd1315_write_image_start+0x32>
lea    0xebf(%rip),%rdi
lea    0xf54(%rip),%rdx
mov    $0x59,%esi
call   1030 <fd_log_at@plt>
lea    (%r14,%rbp,1),%r12d
test   %ebp,%ebp
jle    1163 <fd_ssd1315_write_image_start+0x43>
cmp    $0x81,%r12d
jb     117b <fd_ssd1315_write_image_start+0x5b>
lea    0xe96(%rip),%rdi
lea    0xf42(%rip),%rdx
mov    $0x5a,%esi
call   1030 <fd_log_at@plt>
cmp    $0x40,%ebx
jb     1198 <fd_ssd1315_write_image_start+0x78>
lea    0xe79(%rip),%rdi
lea    0xf5f(%rip),%rdx
mov    $0x5b,%esi
call   1030 <fd_log_at@plt>
lea    (%r15,%rbx,1),%ebp
test   %r15d,%r15d
jle    11a6 <fd_ssd1315_write_image_start+0x86>
cmp    $0x41,%ebp
jb     11be <fd_ssd1315_write_image_start+0x9e>
lea    0xe53(%rip),%rdi
lea    0xf4f(%rip),%rdx
mov    $0x5c,%esi
call   1030 <fd_log_at@plt>
test   $0x7,%bl
je     11db <fd_ssd1315_write_image_start+0xbb>
lea    0xe36(%rip),%rdi
lea    0xf6e(%rip),%rdx
mov    $0x5d,%esi
call   1030 <fd_log_at@plt>
test   $0x7,%r15b
je     11f9 <fd_ssd1315_write_image_start+0xd9>
lea    0xe18(%rip),%rdi
lea    0xf5f(%rip),%rdx
mov    $0x5e,%esi
call   1030 <fd_log_at@plt>
add    $0xffffffff,%r12d
mov    $0x21,%edi
mov    %r14d,%esi
mov    %r12d,%edx
call   1040 <fd_ssd1315_write_command_arg2@plt>
lea    0x7(%rbx),%esi
test   %ebx,%ebx
cmovns %ebx,%esi
sar    $0x3,%esi
lea    0x7(%rbp),%edx
test   %ebp,%ebp
cmovns %ebp,%edx
sar    $0x3,%edx
add    $0xffffffff,%edx
mov    $0x22,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fd_ssd1315_write_command_arg2@plt>

LLVM IR (-O0):
@.str = [156 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/denisbohm/firefly-ice-firmware/refs/heads/master/src/fd_ssd1315.c\00"
@.str.1 = [23 x i8] c"(0 <= x) && (x <= 127)\00"
@.str.2 = [58 x i8] c"(width > 0) && (0 <= (x + width)) && ((x + width) <= 128)\00"
@.str.3 = [22 x i8] c"(0 <= y) && (y <= 63)\00"
@.str.4 = [60 x i8] c"(height > 0) && (0 <= (y + height)) && ((y + height) <= 64)\00"
@.str.5 = [15 x i8] c"(y & 0x7) == 0\00"
@.str.6 = [20 x i8] c"(height & 0x7) == 0\00"
define void @fd_ssd1315_write_image_start(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = icmp sle i32 0, %9
br i1 %10, label %11, label %14
11: ; preds = %4
%12 = load i32, i32* %5
%13 = icmp sle i32 %12, 127
br i1 %13, label %16, label %14
14: ; preds = %11, %4
%15 = call i32 @fd_log_at(i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str, i64 0, i64 0), i32 89, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %11
%17 = load i32, i32* %7
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %29
19: ; preds = %16
%20 = load i32, i32* %5
%21 = load i32, i32* %7
%22 = add nsw i32 %20, %21
%23 = icmp sle i32 0, %22
br i1 %23, label %24, label %29
24: ; preds = %19
%25 = load i32, i32* %5
%26 = load i32, i32* %7
%27 = add nsw i32 %25, %26
%28 = icmp sle i32 %27, 128
br i1 %28, label %31, label %29
29: ; preds = %24, %19, %16
%30 = call i32 @fd_log_at(i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str, i64 0, i64 0), i32 90, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
br label %31
31: ; preds = %29, %24
%32 = load i32, i32* %6
%33 = icmp sle i32 0, %32
br i1 %33, label %34, label %37
34: ; preds = %31
%35 = load i32, i32* %6
%36 = icmp sle i32 %35, 63
br i1 %36, label %39, label %37
37: ; preds = %34, %31
%38 = call i32 @fd_log_at(i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str, i64 0, i64 0), i32 91, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %39
39: ; preds = %37, %34
%40 = load i32, i32* %8
%41 = icmp sgt i32 %40, 0
br i1 %41, label %42, label %52
42: ; preds = %39
%43 = load i32, i32* %6
%44 = load i32, i32* %8
%45 = add nsw i32 %43, %44
%46 = icmp sle i32 0, %45
br i1 %46, label %47, label %52
47: ; preds = %42
%48 = load i32, i32* %6
%49 = load i32, i32* %8
%50 = add nsw i32 %48, %49
%51 = icmp sle i32 %50, 64
br i1 %51, label %54, label %52
52: ; preds = %47, %42, %39
%53 = call i32 @fd_log_at(i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str, i64 0, i64 0), i32 92, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.4, i64 0, i64 0))
br label %54
54: ; preds = %52, %47
%55 = load i32, i32* %6
%56 = and i32 %55, 7
%57 = icmp eq i32 %56, 0
br i1 %57, label %60, label %58
58: ; preds = %54
%59 = call i32 @fd_log_at(i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str, i64 0, i64 0), i32 93, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
br label %60
60: ; preds = %58, %54
%61 = load i32, i32* %8
%62 = and i32 %61, 7
%63 = icmp eq i32 %62, 0
br i1 %63, label %66, label %64
64: ; preds = %60
%65 = call i32 @fd_log_at(i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str, i64 0, i64 0), i32 94, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
br label %66
66: ; preds = %64, %60
%67 = load i32, i32* %5
%68 = load i32, i32* %5
%69 = load i32, i32* %7
%70 = add nsw i32 %68, %69
%71 = sub nsw i32 %70, 1
%72 = call i32 @fd_ssd1315_write_command_arg2(i32 33, i32 %67, i32 %71)
%73 = load i32, i32* %6
%74 = sdiv i32 %73, 8
%75 = load i32, i32* %6
%76 = load i32, i32* %8
%77 = add nsw i32 %75, %76
%78 = sdiv i32 %77, 8
%79 = sub nsw i32 %78, 1
%80 = call i32 @fd_ssd1315_write_command_arg2(i32 34, i32 %74, i32 %79)
ret void
}

LLVM IR (-O2):
@.str = [156 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/denisbohm/firefly-ice-firmware/refs/heads/master/src/fd_ssd1315.c\00"
@.str.1 = [23 x i8] c"(0 <= x) && (x <= 127)\00"
@.str.2 = [58 x i8] c"(width > 0) && (0 <= (x + width)) && ((x + width) <= 128)\00"
@.str.3 = [22 x i8] c"(0 <= y) && (y <= 63)\00"
@.str.4 = [60 x i8] c"(height > 0) && (0 <= (y + height)) && ((y + height) <= 64)\00"
@.str.5 = [15 x i8] c"(y & 0x7) == 0\00"
@.str.6 = [20 x i8] c"(height & 0x7) == 0\00"
define void @fd_ssd1315_write_image_start(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp ult i32 %0, 128
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = tail call i32 @fd_log_at(i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str, i64 0, i64 0), i32 89, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %4, %6
%9 = icmp sgt i32 %2, 0
%10 = add nsw i32 %2, %0
%11 = icmp ult i32 %10, 129
%12 = select i1 %9, i1 %11, i1 false
br i1 %12, label %15, label %13
13: ; preds = %8
%14 = tail call i32 @fd_log_at(i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str, i64 0, i64 0), i32 90, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %8, %13
%16 = icmp ult i32 %1, 64
br i1 %16, label %19, label %17
17: ; preds = %15
%18 = tail call i32 @fd_log_at(i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str, i64 0, i64 0), i32 91, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %19
19: ; preds = %15, %17
%20 = icmp sgt i32 %3, 0
%21 = add nsw i32 %3, %1
%22 = icmp ult i32 %21, 65
%23 = select i1 %20, i1 %22, i1 false
br i1 %23, label %26, label %24
24: ; preds = %19
%25 = tail call i32 @fd_log_at(i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str, i64 0, i64 0), i32 92, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.4, i64 0, i64 0))
br label %26
26: ; preds = %19, %24
%27 = and i32 %1, 7
%28 = icmp eq i32 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %26
%30 = tail call i32 @fd_log_at(i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str, i64 0, i64 0), i32 93, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
br label %31
31: ; preds = %29, %26
%32 = and i32 %3, 7
%33 = icmp eq i32 %32, 0
br i1 %33, label %36, label %34
34: ; preds = %31
%35 = tail call i32 @fd_log_at(i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str, i64 0, i64 0), i32 94, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
br label %36
36: ; preds = %34, %31
%37 = add nsw i32 %10, -1
%38 = tail call i32 @fd_ssd1315_write_command_arg2(i32 33, i32 %0, i32 %37)
%39 = sdiv i32 %1, 8
%40 = sdiv i32 %21, 8
%41 = add nsw i32 %40, -1
%42 = tail call i32 @fd_ssd1315_write_command_arg2(i32 34, i32 %39, i32 %41)
ret void
}