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

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int increment_offset(uint64_t *cache_offset, int *probe_step) {
  *cache_offset += *probe_step;
  static int deepest_probe = 0;
  if (((*probe_step) * (*probe_step + 1)) / 2 > deepest_probe) {
    deepest_probe = ((*probe_step) * (*probe_step + 1)) / 2;
  }
  if (((*probe_step) * (*probe_step + 1)) / 2 > 50000) {
    printf("\nMaximum probe depth exceeded: increase max_probe_depth.\n");
    exit(EXIT_FAILURE);
  }
  *probe_step += 1;
  return deepest_probe;
}


x86 assembly (clang, -O0):
<increment_offset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    0x2ed6(%rip),%eax
jle    1184 <increment_offset+0x64>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,0x2eb0(%rip)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0xc350,%eax
jle    11c3 <increment_offset+0xa3>
lea    0xe50(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e24(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    0x2e60(%rip),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<increment_offset>:
push   %rax
mov    (%rsi),%eax
add    %eax,(%rdi)
mov    (%rsi),%edx
lea    0x1(%rdx),%ecx
imul   %ecx,%edx
mov    %edx,%edi
shr    $0x1f,%edi
add    %edx,%edi
sar    %edi
mov    0x2ef8(%rip),%eax
cmp    %eax,%edi
jle    1148 <increment_offset+0x28>
mov    %edi,0x2eee(%rip)
mov    %edi,%eax
cmp    $0x186a2,%edx
jge    1154 <increment_offset+0x34>
mov    %ecx,(%rsi)
pop    %rcx
ret
lea    0xea5(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@increment_offset.deepest_probe = internal global i32 0
@.str = [58 x i8] c"\0AMaximum probe depth exceeded: increase max_probe_depth.\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @increment_offset(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %4
%6 = load i32, i32* %5
%7 = load i32*, i32** %3
%8 = load i32, i32* %7
%9 = add nsw i32 %8, %6
store i32 %9, i32* %7
%10 = load i32*, i32** %4
%11 = load i32, i32* %10
%12 = load i32*, i32** %4
%13 = load i32, i32* %12
%14 = add nsw i32 %13, 1
%15 = mul nsw i32 %11, %14
%16 = sdiv i32 %15, 2
%17 = load i32, i32* @increment_offset.deepest_probe
%18 = icmp sgt i32 %16, %17
br i1 %18, label %19, label %27
19: ; preds = %2
%20 = load i32*, i32** %4
%21 = load i32, i32* %20
%22 = load i32*, i32** %4
%23 = load i32, i32* %22
%24 = add nsw i32 %23, 1
%25 = mul nsw i32 %21, %24
%26 = sdiv i32 %25, 2
store i32 %26, i32* @increment_offset.deepest_probe
br label %27
27: ; preds = %19, %2
%28 = load i32*, i32** %4
%29 = load i32, i32* %28
%30 = load i32*, i32** %4
%31 = load i32, i32* %30
%32 = add nsw i32 %31, 1
%33 = mul nsw i32 %29, %32
%34 = sdiv i32 %33, 2
%35 = icmp sgt i32 %34, 50000
br i1 %35, label %36, label %40
36: ; preds = %27
%37 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%38 = load i32, i32* @EXIT_FAILURE
%39 = call i32 @exit(i32 %38)
unreachable
40: ; preds = %27
%41 = load i32*, i32** %4
%42 = load i32, i32* %41
%43 = add nsw i32 %42, 1
store i32 %43, i32* %41
%44 = load i32, i32* @increment_offset.deepest_probe
ret i32 %44
}

LLVM IR (-O2):
@increment_offset.deepest_probe = internal unnamed_addr global i32 0
@EXIT_FAILURE = global i32 0
@str = [57 x i8] c"\0AMaximum probe depth exceeded: increase max_probe_depth.\00"
define i32 @increment_offset(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = load i32, i32* %0
%5 = add nsw i32 %4, %3
store i32 %5, i32* %0
%6 = load i32, i32* %1
%7 = add nsw i32 %6, 1
%8 = mul nsw i32 %7, %6
%9 = sdiv i32 %8, 2
%10 = load i32, i32* @increment_offset.deepest_probe
%11 = icmp sgt i32 %9, %10
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 %9, i32* @increment_offset.deepest_probe
br label %13
13: ; preds = %12, %2
%14 = phi i32 [ %9, %12 ], [ %10, %2 ]
%15 = icmp sgt i32 %8, 100001
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str, i64 0, i64 0))
%18 = load i32, i32* @EXIT_FAILURE
%19 = tail call i32 @exit(i32 %18)
unreachable
20: ; preds = %13
store i32 %7, i32* %1
ret i32 %14
}