#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 uint32_t;

/* Variables and functions */
void __attribute__((noipa))
test_0xffff_uint32_t(uint32_t *restrict r, uint32_t *restrict a,
                     uint32_t *restrict b) {
  for (int i = 0; i < (320 / sizeof(uint32_t)); ++i)
    r[i] = a[i] > 20 ? b[i] & 0xffff : 127;
}


x86 assembly (clang, -O0):
<test_0xffff_uint32_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    $0x50,%rax
jae    1178 <test_0xffff_uint32_t+0x78>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpl   $0x14,(%rax,%rcx,4)
jle    114f <test_0xffff_uint32_t+0x4f>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
and    $0xffff,%eax
mov    %eax,-0x20(%rbp)
jmp    115c <test_0xffff_uint32_t+0x5c>
mov    $0x7f,%eax
mov    %eax,-0x20(%rbp)
jmp    115c <test_0xffff_uint32_t+0x5c>
mov    -0x20(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1117 <test_0xffff_uint32_t+0x17>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_0xffff_uint32_t>:
mov    $0x1,%eax
jmp    111e <test_0xffff_uint32_t+0x1e>
nopw   0x0(%rax,%rax,1)
mov    %r8d,(%rdi,%rax,4)
add    $0x2,%rax
cmp    $0x51,%rax
je     1146 <test_0xffff_uint32_t+0x46>
mov    $0x7f,%r8d
cmpl   $0x15,-0x4(%rsi,%rax,4)
mov    $0x7f,%ecx
jl     1135 <test_0xffff_uint32_t+0x35>
movzwl -0x4(%rdx,%rax,4),%ecx
mov    %ecx,-0x4(%rdi,%rax,4)
cmpl   $0x15,(%rsi,%rax,4)
jl     1110 <test_0xffff_uint32_t+0x10>
movzwl (%rdx,%rax,4),%r8d
jmp    1110 <test_0xffff_uint32_t+0x10>
ret

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

LLVM IR (-O2):
define void @test_0xffff_uint32_t(i32* noalias nocapture writeonly %0, i32* noalias nocapture %1, i32* noalias nocapture %2) {
br label %5
4: ; preds = %25
ret void
5: ; preds = %25, %3
%6 = phi i64 [ 0, %3 ], [ %28, %25 ]
%7 = getelementptr inbounds i32, i32* %1, i64 %6
%8 = load i32, i32* %7
%9 = icmp sgt i32 %8, 20
br i1 %9, label %10, label %14
10: ; preds = %5
%11 = getelementptr inbounds i32, i32* %2, i64 %6
%12 = load i32, i32* %11
%13 = and i32 %12, 65535
br label %14
14: ; preds = %5, %10
%15 = phi i32 [ %13, %10 ], [ 127, %5 ]
%16 = getelementptr inbounds i32, i32* %0, i64 %6
store i32 %15, i32* %16
%17 = or i64 %6, 1
%18 = getelementptr inbounds i32, i32* %1, i64 %17
%19 = load i32, i32* %18
%20 = icmp sgt i32 %19, 20
br i1 %20, label %21, label %25
21: ; preds = %14
%22 = getelementptr inbounds i32, i32* %2, i64 %17
%23 = load i32, i32* %22
%24 = and i32 %23, 65535
br label %25
25: ; preds = %21, %14
%26 = phi i32 [ %24, %21 ], [ 127, %14 ]
%27 = getelementptr inbounds i32, i32* %0, i64 %17
store i32 %26, i32* %27
%28 = add nuw nsw i64 %6, 2
%29 = icmp eq i64 %28, 80
br i1 %29, label %4, label %5
}