#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 h;
  h = (8 + sample - 1) / 2;
  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    -0xc(%rbp),%eax
add    $0x8,%eax
sub    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1137 <draw_pixel+0x37>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1141 <draw_pixel+0x41>
xor    %eax,%eax
mov    %eax,-0x18(%rbp)
jmp    1141 <draw_pixel+0x41>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x7,-0x14(%rbp)
jge    115c <draw_pixel+0x5c>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1169 <draw_pixel+0x69>
mov    $0x7,%eax
mov    %eax,-0x1c(%rbp)
jmp    1169 <draw_pixel+0x69>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%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
xor    %ecx,%ecx
sar    %eax
cmovs  %ecx,%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) {
%4 = alloca [80 x i32]*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store [80 x i32]* %0, [80 x i32]** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = add nsw i32 8, %8
%10 = sub nsw i32 %9, 1
%11 = sdiv i32 %10, 2
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %3
%15 = load i32, i32* %7
br label %17
16: ; preds = %3
br label %17
17: ; preds = %16, %14
%18 = phi i32 [ %15, %14 ], [ 0, %16 ]
store i32 %18, i32* %7
%19 = load i32, i32* %7
%20 = icmp slt i32 %19, 7
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = load i32, i32* %7
br label %24
23: ; preds = %17
br label %24
24: ; preds = %23, %21
%25 = phi i32 [ %22, %21 ], [ 7, %23 ]
store i32 %25, i32* %7
%26 = load [80 x i32]*, [80 x i32]** %4
%27 = load i32, i32* %7
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [80 x i32], [80 x i32]* %26, i64 %28
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [80 x i32], [80 x i32]* %29, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = add nsw i32 %33, 1
store i32 %34, i32* %32
ret void
}

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