#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*/ set(int, int, int, int, int, int);
void hlen_vs_alpha_twostep(int y, int invert) {
  set(100, y, 300, y + 320, (invert ? 0x7F : 0), 0x0001 | 0x0010);
  set(100, y, 400, y + 320, (invert ? 0x7F : 0), 0x0001 | 0x0010);
  set(100, y, 500, y + 320, (invert ? 0 : 0x7F), 0x0001 | 0x0010);
  set(100, y, 600, y + 320, (invert ? 0 : 0x7F), 0x0001 | 0x0010);
}


x86 assembly (clang, -O0):
<hlen_vs_alpha_twostep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%ecx
add    $0x140,%ecx
mov    -0x8(%rbp),%edx
xor    %r8d,%r8d
mov    $0x7f,%eax
cmp    $0x0,%edx
cmovne %eax,%r8d
mov    $0x64,%edi
mov    $0x12c,%edx
mov    $0x11,%r9d
call   1030 <set@plt>
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%ecx
add    $0x140,%ecx
mov    -0x8(%rbp),%edx
xor    %r8d,%r8d
mov    $0x7f,%eax
cmp    $0x0,%edx
cmovne %eax,%r8d
mov    $0x64,%edi
mov    $0x190,%edx
mov    $0x11,%r9d
call   1030 <set@plt>
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%ecx
add    $0x140,%ecx
mov    -0x8(%rbp),%edx
mov    $0x7f,%r8d
xor    %eax,%eax
cmp    $0x0,%edx
cmovne %eax,%r8d
mov    $0x64,%edi
mov    $0x1f4,%edx
mov    $0x11,%r9d
call   1030 <set@plt>
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%ecx
add    $0x140,%ecx
mov    -0x8(%rbp),%edx
mov    $0x7f,%r8d
xor    %eax,%eax
cmp    $0x0,%edx
cmovne %eax,%r8d
mov    $0x64,%edi
mov    $0x258,%edx
mov    $0x11,%r9d
call   1030 <set@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hlen_vs_alpha_twostep>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
lea    0x140(%rbx),%r14d
xor    %r15d,%r15d
test   %esi,%esi
mov    $0x7f,%eax
cmovne %eax,%ebp
cmove  %eax,%r15d
mov    $0x64,%edi
mov    %ebx,%esi
mov    $0x12c,%edx
mov    %r14d,%ecx
mov    %ebp,%r8d
mov    $0x11,%r9d
call   1030 <set@plt>
mov    $0x64,%edi
mov    %ebx,%esi
mov    $0x190,%edx
mov    %r14d,%ecx
mov    %ebp,%r8d
mov    $0x11,%r9d
call   1030 <set@plt>
mov    $0x64,%edi
mov    %ebx,%esi
mov    $0x1f4,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x11,%r9d
call   1030 <set@plt>
mov    $0x64,%edi
mov    %ebx,%esi
mov    $0x258,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    $0x11,%r9d
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <set@plt>

LLVM IR (-O0):
define void @hlen_vs_alpha_twostep(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 320
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 127, i32 0
%12 = call i32 @set(i32 100, i32 %5, i32 300, i32 %7, i32 %11, i32 17)
%13 = load i32, i32* %3
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 320
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 0
%18 = zext i1 %17 to i64
%19 = select i1 %17, i32 127, i32 0
%20 = call i32 @set(i32 100, i32 %13, i32 400, i32 %15, i32 %19, i32 17)
%21 = load i32, i32* %3
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 320
%24 = load i32, i32* %4
%25 = icmp ne i32 %24, 0
%26 = zext i1 %25 to i64
%27 = select i1 %25, i32 0, i32 127
%28 = call i32 @set(i32 100, i32 %21, i32 500, i32 %23, i32 %27, i32 17)
%29 = load i32, i32* %3
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 320
%32 = load i32, i32* %4
%33 = icmp ne i32 %32, 0
%34 = zext i1 %33 to i64
%35 = select i1 %33, i32 0, i32 127
%36 = call i32 @set(i32 100, i32 %29, i32 600, i32 %31, i32 %35, i32 17)
ret void
}

LLVM IR (-O2):
define void @hlen_vs_alpha_twostep(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 320
%4 = icmp eq i32 %1, 0
%5 = select i1 %4, i32 0, i32 127
%6 = tail call i32 @set(i32 100, i32 %0, i32 300, i32 %3, i32 %5, i32 17)
%7 = tail call i32 @set(i32 100, i32 %0, i32 400, i32 %3, i32 %5, i32 17)
%8 = select i1 %4, i32 127, i32 0
%9 = tail call i32 @set(i32 100, i32 %0, i32 500, i32 %3, i32 %8, i32 17)
%10 = tail call i32 @set(i32 100, i32 %0, i32 600, i32 %3, i32 %8, i32 17)
ret void
}