#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*/ shift(unsigned int *);
void set(unsigned int *wide, int count, unsigned int value, int del) {
  wide[count] = value;
  for (del = del; del > 0; del--) {
    wide[count + del] = 0xffffffff;
  }
  shift(wide);
}


x86 assembly (clang, -O0):
<set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x10(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1165 <set+0x55>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
movl   $0xffffffff,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <set+0x29>
mov    -0x8(%rbp),%rdi
call   1030 <shift@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set>:
push   %rbx
mov    %rdi,%rbx
movslq %esi,%rax
mov    %edx,(%rdi,%rax,4)
test   %ecx,%ecx
jle    114d <set+0x2d>
add    %ecx,%esi
movslq %esi,%rax
lea    -0x1(%rcx),%edx
sub    %rdx,%rax
lea    (%rbx,%rax,4),%rdi
mov    %ecx,%edx
shl    $0x2,%rdx
mov    $0xff,%esi
call   1030 <memset@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <shift@plt>

LLVM IR (-O0):
define void @set(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %7
%10 = load i32*, i32** %5
%11 = load i32, i32* %6
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %10, i64 %12
store i32 %9, i32* %13
%14 = load i32, i32* %8
store i32 %14, i32* %8
br label %15
15: ; preds = %25, %4
%16 = load i32, i32* %8
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %28
18: ; preds = %15
%19 = load i32*, i32** %5
%20 = load i32, i32* %6
%21 = load i32, i32* %8
%22 = add nsw i32 %20, %21
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %19, i64 %23
store i32 -1, i32* %24
br label %25
25: ; preds = %18
%26 = load i32, i32* %8
%27 = add nsw i32 %26, -1
store i32 %27, i32* %8
br label %15
28: ; preds = %15
%29 = load i32*, i32** %5
%30 = call i32 @shift(i32* %29)
ret void
}

LLVM IR (-O2):
define void @set(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = sext i32 %1 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
store i32 %2, i32* %6
%7 = icmp sgt i32 %3, 0
br i1 %7, label %8, label %18
8: ; preds = %4
%9 = add i32 %3, %1
%10 = sext i32 %9 to i64
%11 = add nsw i32 %3, -1
%12 = zext i32 %11 to i64
%13 = sub nsw i64 %10, %12
%14 = getelementptr i32, i32* %0, i64 %13
%15 = bitcast i32* %14 to i8*
%16 = zext i32 %3 to i64
%17 = shl nuw nsw i64 %16, 2
br label %18
18: ; preds = %8, %4
%19 = tail call i32 @shift(i32* %0)
ret void
}