#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 */
struct binary_exponential_buffer {
  int dummy;
};

/* Variables and functions */
scalar_t__ binary_exponential_buffer_data(struct binary_exponential_buffer *);
unsigned int binary_exponential_buffer_size(struct binary_exponential_buffer *);
void reset_candidates(struct binary_exponential_buffer *candidates) {
  unsigned int *p = (unsigned int *)binary_exponential_buffer_data(candidates);
  unsigned int num_candidates = binary_exponential_buffer_size(candidates);
  unsigned int i;
  for (i = 0; i < num_candidates; i++) {
    p[i] = 1;
  }
}


x86 assembly (clang, -O0):
<reset_candidates>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <binary_exponential_buffer_data@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <binary_exponential_buffer_size@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    1174 <reset_candidates+0x54>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
movl   $0x1,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114c <reset_candidates+0x2c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reset_candidates>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <binary_exponential_buffer_data@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <binary_exponential_buffer_size@plt>
test   %eax,%eax
je     1240 <reset_candidates+0x120>
mov    %eax,%ecx
cmp    $0x8,%eax
jae    114d <reset_candidates+0x2d>
xor    %eax,%eax
jmp    1230 <reset_candidates+0x110>
mov    %ecx,%eax
and    $0xfffffff8,%eax
lea    -0x8(%rax),%rdi
mov    %rdi,%rsi
shr    $0x3,%rsi
add    $0x1,%rsi
mov    %esi,%edx
and    $0x7,%edx
cmp    $0x38,%rdi
jae    1173 <reset_candidates+0x53>
xor    %edi,%edi
jmp    11f1 <reset_candidates+0xd1>
and    $0xfffffffffffffff8,%rsi
xor    %edi,%edi
movaps 0xe80(%rip),%xmm0
movups %xmm0,(%rbx,%rdi,4)
movups %xmm0,0x10(%rbx,%rdi,4)
movups %xmm0,0x20(%rbx,%rdi,4)
movups %xmm0,0x30(%rbx,%rdi,4)
movups %xmm0,0x40(%rbx,%rdi,4)
movups %xmm0,0x50(%rbx,%rdi,4)
movups %xmm0,0x60(%rbx,%rdi,4)
movups %xmm0,0x70(%rbx,%rdi,4)
movups %xmm0,0x80(%rbx,%rdi,4)
movups %xmm0,0x90(%rbx,%rdi,4)
movups %xmm0,0xa0(%rbx,%rdi,4)
movups %xmm0,0xb0(%rbx,%rdi,4)
movups %xmm0,0xc0(%rbx,%rdi,4)
movups %xmm0,0xd0(%rbx,%rdi,4)
movups %xmm0,0xe0(%rbx,%rdi,4)
movups %xmm0,0xf0(%rbx,%rdi,4)
add    $0x40,%rdi
add    $0xfffffffffffffff8,%rsi
jne    1180 <reset_candidates+0x60>
test   %rdx,%rdx
je     1222 <reset_candidates+0x102>
lea    (%rbx,%rdi,4),%rsi
add    $0x10,%rsi
shl    $0x5,%rdx
xor    %edi,%edi
movaps 0xdf5(%rip),%xmm0
nopl   0x0(%rax,%rax,1)
movups %xmm0,-0x10(%rsi,%rdi,1)
movups %xmm0,(%rsi,%rdi,1)
add    $0x20,%rdi
cmp    %rdi,%rdx
jne    1210 <reset_candidates+0xf0>
cmp    %rcx,%rax
je     1240 <reset_candidates+0x120>
nopw   0x0(%rax,%rax,1)
movl   $0x1,(%rbx,%rax,4)
add    $0x1,%rax
cmp    %rax,%rcx
jne    1230 <reset_candidates+0x110>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.binary_exponential_buffer = type { i32 }
define void @reset_candidates(%struct.binary_exponential_buffer* %0) {
%2 = alloca %struct.binary_exponential_buffer*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store %struct.binary_exponential_buffer* %0, %struct.binary_exponential_buffer** %2
%6 = load %struct.binary_exponential_buffer*, %struct.binary_exponential_buffer** %2
%7 = call i64 @binary_exponential_buffer_data(%struct.binary_exponential_buffer* %6)
%8 = inttoptr i64 %7 to i32*
store i32* %8, i32** %3
%9 = load %struct.binary_exponential_buffer*, %struct.binary_exponential_buffer** %2
%10 = call i32 @binary_exponential_buffer_size(%struct.binary_exponential_buffer* %9)
store i32 %10, i32* %4
store i32 0, i32* %5
br label %11
11: ; preds = %20, %1
%12 = load i32, i32* %5
%13 = load i32, i32* %4
%14 = icmp ult i32 %12, %13
br i1 %14, label %15, label %23
15: ; preds = %11
%16 = load i32*, i32** %3
%17 = load i32, i32* %5
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
store i32 1, i32* %19
br label %20
20: ; preds = %15
%21 = load i32, i32* %5
%22 = add i32 %21, 1
store i32 %22, i32* %5
br label %11
23: ; preds = %11
ret void
}

LLVM IR (-O2):
%struct.binary_exponential_buffer = type { i32 }
define void @reset_candidates(%struct.binary_exponential_buffer* %0) {
%2 = tail call i64 @binary_exponential_buffer_data(%struct.binary_exponential_buffer* %0)
%3 = inttoptr i64 %2 to i32*
%4 = tail call i32 @binary_exponential_buffer_size(%struct.binary_exponential_buffer* %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %85, label %6
6: ; preds = %1
%7 = zext i32 %4 to i64
%8 = icmp ult i32 %4, 8
br i1 %8, label %78, label %9
9: ; preds = %6
%10 = and i64 %7, 4294967288
%11 = add nsw i64 %10, -8
%12 = lshr exact i64 %11, 3
%13 = add nuw nsw i64 %12, 1
%14 = and i64 %13, 7
%15 = icmp ult i64 %11, 56
br i1 %15, label %63, label %16
16: ; preds = %9
%17 = and i64 %13, 4611686018427387896
br label %18
18: ; preds = %18, %16
%19 = phi i64 [ 0, %16 ], [ %60, %18 ]
%20 = phi i64 [ 0, %16 ], [ %61, %18 ]
%21 = getelementptr inbounds i32, i32* %3, i64 %19
%22 = bitcast i32* %21 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %22
%23 = getelementptr inbounds i32, i32* %21, i64 4
%24 = bitcast i32* %23 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %24
%25 = or i64 %19, 8
%26 = getelementptr inbounds i32, i32* %3, i64 %25
%27 = bitcast i32* %26 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %27
%28 = getelementptr inbounds i32, i32* %26, i64 4
%29 = bitcast i32* %28 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %29
%30 = or i64 %19, 16
%31 = getelementptr inbounds i32, i32* %3, i64 %30
%32 = bitcast i32* %31 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %32
%33 = getelementptr inbounds i32, i32* %31, i64 4
%34 = bitcast i32* %33 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %34
%35 = or i64 %19, 24
%36 = getelementptr inbounds i32, i32* %3, i64 %35
%37 = bitcast i32* %36 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %37
%38 = getelementptr inbounds i32, i32* %36, i64 4
%39 = bitcast i32* %38 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %39
%40 = or i64 %19, 32
%41 = getelementptr inbounds i32, i32* %3, i64 %40
%42 = bitcast i32* %41 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %42
%43 = getelementptr inbounds i32, i32* %41, i64 4
%44 = bitcast i32* %43 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %44
%45 = or i64 %19, 40
%46 = getelementptr inbounds i32, i32* %3, i64 %45
%47 = bitcast i32* %46 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %47
%48 = getelementptr inbounds i32, i32* %46, i64 4
%49 = bitcast i32* %48 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %49
%50 = or i64 %19, 48
%51 = getelementptr inbounds i32, i32* %3, i64 %50
%52 = bitcast i32* %51 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %52
%53 = getelementptr inbounds i32, i32* %51, i64 4
%54 = bitcast i32* %53 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %54
%55 = or i64 %19, 56
%56 = getelementptr inbounds i32, i32* %3, i64 %55
%57 = bitcast i32* %56 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %57
%58 = getelementptr inbounds i32, i32* %56, i64 4
%59 = bitcast i32* %58 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %59
%60 = add nuw i64 %19, 64
%61 = add nuw i64 %20, 8
%62 = icmp eq i64 %61, %17
br i1 %62, label %63, label %18
63: ; preds = %18, %9
%64 = phi i64 [ 0, %9 ], [ %60, %18 ]
%65 = icmp eq i64 %14, 0
br i1 %65, label %76, label %66
66: ; preds = %63, %66
%67 = phi i64 [ %73, %66 ], [ %64, %63 ]
%68 = phi i64 [ %74, %66 ], [ 0, %63 ]
%69 = getelementptr inbounds i32, i32* %3, i64 %67
%70 = bitcast i32* %69 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %70
%71 = getelementptr inbounds i32, i32* %69, i64 4
%72 = bitcast i32* %71 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %72
%73 = add nuw i64 %67, 8
%74 = add i64 %68, 1
%75 = icmp eq i64 %74, %14
br i1 %75, label %76, label %66
76: ; preds = %66, %63
%77 = icmp eq i64 %10, %7
br i1 %77, label %85, label %78
78: ; preds = %6, %76
%79 = phi i64 [ 0, %6 ], [ %10, %76 ]
br label %80
80: ; preds = %78, %80
%81 = phi i64 [ %83, %80 ], [ %79, %78 ]
%82 = getelementptr inbounds i32, i32* %3, i64 %81
store i32 1, i32* %82
%83 = add nuw nsw i64 %81, 1
%84 = icmp eq i64 %83, %7
br i1 %84, label %85, label %80
85: ; preds = %80, %76, %1
ret void
}