#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 /*<<< orphan*/ uint8_t;

/* Variables and functions */
void draw_pixel(uint8_t frame[8][80], int sample, int x, int y) {
  int h;
  h = (8 + sample - 1) / 2 + y;
  h = ((h) > (0) ? (h) : (0));
  h = ((h) < (8 - 1) ? (h) : (8 - 1));
  frame[h][x]++;
}


x86 assembly (clang, -O0):
<draw_pixel>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0x8,%eax
sub    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jle    113d <draw_pixel+0x3d>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1147 <draw_pixel+0x47>
xor    %eax,%eax
mov    %eax,-0x1c(%rbp)
jmp    1147 <draw_pixel+0x47>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x7,-0x18(%rbp)
jge    1162 <draw_pixel+0x62>
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    116f <draw_pixel+0x6f>
mov    $0x7,%eax
mov    %eax,-0x20(%rbp)
jmp    116f <draw_pixel+0x6f>
mov    -0x20(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
imul   $0x140,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_pixel>:
mov    %esi,%eax
add    $0x7,%eax
shr    $0x1f,%eax
add    %esi,%eax
add    $0x7,%eax
sar    %eax
xor    %esi,%esi
add    %ecx,%eax
cmovs  %esi,%eax
cmp    $0x7,%eax
mov    $0x7,%ecx
cmovb  %eax,%ecx
movslq %edx,%rax
lea    (%rcx,%rcx,4),%rcx
shl    $0x6,%rcx
add    %rdi,%rcx
addl   $0x1,(%rcx,%rax,4)
ret

LLVM IR (-O0):
define void @draw_pixel([80 x i32]* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca [80 x i32]*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store [80 x i32]* %0, [80 x i32]** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %6
%11 = add nsw i32 8, %10
%12 = sub nsw i32 %11, 1
%13 = sdiv i32 %12, 2
%14 = load i32, i32* %8
%15 = add nsw i32 %13, %14
store i32 %15, i32* %9
%16 = load i32, i32* %9
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %4
%19 = load i32, i32* %9
br label %21
20: ; preds = %4
br label %21
21: ; preds = %20, %18
%22 = phi i32 [ %19, %18 ], [ 0, %20 ]
store i32 %22, i32* %9
%23 = load i32, i32* %9
%24 = icmp slt i32 %23, 7
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = load i32, i32* %9
br label %28
27: ; preds = %21
br label %28
28: ; preds = %27, %25
%29 = phi i32 [ %26, %25 ], [ 7, %27 ]
store i32 %29, i32* %9
%30 = load [80 x i32]*, [80 x i32]** %5
%31 = load i32, i32* %9
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [80 x i32], [80 x i32]* %30, i64 %32
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [80 x i32], [80 x i32]* %33, i64 0, i64 %35
%37 = load i32, i32* %36
%38 = add nsw i32 %37, 1
store i32 %38, i32* %36
ret void
}

LLVM IR (-O2):
define void @draw_pixel([80 x i32]* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = add nsw i32 %1, 7
%6 = sdiv i32 %5, 2
%7 = add nsw i32 %6, %3
%8 = icmp sgt i32 %7, 0
%9 = select i1 %8, i32 %7, i32 0
%10 = icmp ult i32 %9, 7
%11 = select i1 %10, i32 %9, i32 7
%12 = zext i32 %11 to i64
%13 = sext i32 %2 to i64
%14 = getelementptr inbounds [80 x i32], [80 x i32]* %0, i64 %12, i64 %13
%15 = load i32, i32* %14
%16 = add nsw i32 %15, 1
store i32 %16, i32* %14
ret void
}