#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 */
scalar_t__ inner_point(int, int, int, int);
int /*<<< orphan*/ lincombin(int /*<<< orphan*/, int /*<<< orphan*/, float);
void put_pixel_gray_aa(int a, int b, float f, void *pp) {
  struct {
    int w, h;
    uint8_t *x, c;
  } *p = pp;
  if (inner_point(p->w, p->h, a, b)) {
    uint8_t *g = p->x + b * p->w + a;
    uint8_t *k = &p->c;
    *g = lincombin(*g, *k, f);
  }
}


x86 assembly (clang, -O0):
<put_pixel_gray_aa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
call   1030 <inner_point@plt>
cmp    $0x0,%rax
je     11b6 <put_pixel_gray_aa+0x96>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x8(%rbp),%ecx
mov    -0x20(%rbp),%rdx
imul   (%rdx),%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x4(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rax
mov    (%rax),%esi
movss  -0xc(%rbp),%xmm0
call   1040 <lincombin@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_pixel_gray_aa>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
movss  %xmm0,0xc(%rsp)
mov    %esi,%ebp
mov    %edi,%r14d
mov    (%rdx),%edi
mov    0x4(%rdx),%esi
mov    %r14d,%edx
mov    %ebp,%ecx
call   1030 <inner_point@plt>
test   %rax,%rax
je     1177 <put_pixel_gray_aa+0x57>
movslq (%rbx),%rax
movslq %ebp,%rbp
imul   %rax,%rbp
shl    $0x2,%rbp
add    0x8(%rbx),%rbp
movslq %r14d,%r14
mov    0x0(%rbp,%r14,4),%edi
mov    0x10(%rbx),%esi
movss  0xc(%rsp),%xmm0
call   1040 <lincombin@plt>
mov    %eax,0x0(%rbp,%r14,4)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.anon = type { i32, i32, i32*, i32 }
define void @put_pixel_gray_aa(i32 %0, i32 %1, float %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
%8 = alloca i8*
%9 = alloca %struct.anon*
%10 = alloca i32*
%11 = alloca i32*
store i32 %0, i32* %5
store i32 %1, i32* %6
store float %2, float* %7
store i8* %3, i8** %8
%12 = load i8*, i8** %8
%13 = bitcast i8* %12 to %struct.anon*
store %struct.anon* %13, %struct.anon** %9
%14 = load %struct.anon*, %struct.anon** %9
%15 = getelementptr inbounds %struct.anon, %struct.anon* %14, i32 0, i32 0
%16 = load i32, i32* %15
%17 = load %struct.anon*, %struct.anon** %9
%18 = getelementptr inbounds %struct.anon, %struct.anon* %17, i32 0, i32 1
%19 = load i32, i32* %18
%20 = load i32, i32* %5
%21 = load i32, i32* %6
%22 = call i64 @inner_point(i32 %16, i32 %19, i32 %20, i32 %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %47
24: ; preds = %4
%25 = load %struct.anon*, %struct.anon** %9
%26 = getelementptr inbounds %struct.anon, %struct.anon* %25, i32 0, i32 2
%27 = load i32*, i32** %26
%28 = load i32, i32* %6
%29 = load %struct.anon*, %struct.anon** %9
%30 = getelementptr inbounds %struct.anon, %struct.anon* %29, i32 0, i32 0
%31 = load i32, i32* %30
%32 = mul nsw i32 %28, %31
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %27, i64 %33
%35 = load i32, i32* %5
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %34, i64 %36
store i32* %37, i32** %10
%38 = load %struct.anon*, %struct.anon** %9
%39 = getelementptr inbounds %struct.anon, %struct.anon* %38, i32 0, i32 3
store i32* %39, i32** %11
%40 = load i32*, i32** %10
%41 = load i32, i32* %40
%42 = load i32*, i32** %11
%43 = load i32, i32* %42
%44 = load float, float* %7
%45 = call i32 @lincombin(i32 %41, i32 %43, float %44)
%46 = load i32*, i32** %10
store i32 %45, i32* %46
br label %47
47: ; preds = %24, %4
ret void
}

LLVM IR (-O2):
define void @put_pixel_gray_aa(i32 %0, i32 %1, float %2, i8* nocapture %3) {
%5 = bitcast i8* %3 to i32*
%6 = load i32, i32* %5
%7 = getelementptr inbounds i8, i8* %3, i64 4
%8 = bitcast i8* %7 to i32*
%9 = load i32, i32* %8
%10 = tail call i64 @inner_point(i32 %6, i32 %9, i32 %0, i32 %1)
%11 = icmp eq i64 %10, 0
br i1 %11, label %27, label %12
12: ; preds = %4
%13 = getelementptr inbounds i8, i8* %3, i64 8
%14 = bitcast i8* %13 to i32**
%15 = load i32*, i32** %14
%16 = load i32, i32* %5
%17 = mul nsw i32 %16, %1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %15, i64 %18
%20 = sext i32 %0 to i64
%21 = getelementptr inbounds i32, i32* %19, i64 %20
%22 = getelementptr inbounds i8, i8* %3, i64 16
%23 = bitcast i8* %22 to i32*
%24 = load i32, i32* %21
%25 = load i32, i32* %23
%26 = tail call i32 @lincombin(i32 %24, i32 %25, float %2)
store i32 %26, i32* %21
br label %27
27: ; preds = %12, %4
ret void
}