#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*/ SHA256_CTX;
typedef int /*<<< orphan*/ EC_POINT;
typedef int /*<<< orphan*/ EC_GROUP;
typedef int /*<<< orphan*/ BN_CTX;
typedef int /*<<< orphan*/ BIGNUM;

/* Variables and functions */
int get_affine_coordinates(int /*<<< orphan*/ const *,
                           int /*<<< orphan*/ const *, int /*<<< orphan*/ *,
                           int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int hash_bn(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int hash_point(SHA256_CTX *sha, const EC_GROUP *G, const EC_POINT *P,
               BIGNUM *P_x, BIGNUM *P_y, BN_CTX *ctx) {
  int ret = get_affine_coordinates(G, P, P_x, P_y, ctx);
  if (ret)
    ret = hash_bn(sha, P_x);
  if (ret)
    ret = hash_bn(sha, P_y);
  return ret;
}


x86 assembly (clang, -O0):
<hash_point>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
call   1040 <get_affine_coordinates@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     1176 <hash_point+0x56>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <hash_bn@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     1190 <hash_point+0x70>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <hash_bn@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_point>:
push   %r15
push   %r14
push   %rbx
mov    %r8,%r15
mov    %rcx,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
mov    %r8,%rcx
mov    %r9,%r8
call   1040 <get_affine_coordinates@plt>
test   %eax,%eax
je     1165 <hash_point+0x45>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <hash_bn@plt>
test   %eax,%eax
je     1165 <hash_point+0x45>
mov    %r14,%rdi
mov    %r15,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <hash_bn@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @hash_point(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5) {
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32
store i32* %0, i32** %7
store i32* %1, i32** %8
store i32* %2, i32** %9
store i32* %3, i32** %10
store i32* %4, i32** %11
store i32* %5, i32** %12
%14 = load i32*, i32** %8
%15 = load i32*, i32** %9
%16 = load i32*, i32** %10
%17 = load i32*, i32** %11
%18 = load i32*, i32** %12
%19 = call i32 @get_affine_coordinates(i32* %14, i32* %15, i32* %16, i32* %17, i32* %18)
store i32 %19, i32* %13
%20 = load i32, i32* %13
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %6
%23 = load i32*, i32** %7
%24 = load i32*, i32** %10
%25 = call i32 @hash_bn(i32* %23, i32* %24)
store i32 %25, i32* %13
br label %26
26: ; preds = %22, %6
%27 = load i32, i32* %13
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %33
29: ; preds = %26
%30 = load i32*, i32** %7
%31 = load i32*, i32** %11
%32 = call i32 @hash_bn(i32* %30, i32* %31)
store i32 %32, i32* %13
br label %33
33: ; preds = %29, %26
%34 = load i32, i32* %13
ret i32 %34
}

LLVM IR (-O2):
define i32 @hash_point(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5) {
%7 = tail call i32 @get_affine_coordinates(i32* %1, i32* %2, i32* %3, i32* %4, i32* %5)
%8 = icmp eq i32 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %6
%10 = tail call i32 @hash_bn(i32* %0, i32* %3)
%11 = icmp eq i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %9
%13 = tail call i32 @hash_bn(i32* %0, i32* %4)
br label %14
14: ; preds = %6, %12, %9
%15 = phi i32 [ %13, %12 ], [ 0, %9 ], [ 0, %6 ]
ret i32 %15
}