#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 /*<<< orphan*/ uint8_t;

/* Variables and functions */
int __breakpoint__inv(int /*<<< orphan*/ **, size_t *, size_t *);
void array_inc(uint8_t a[], size_t n) {
  for (size_t i = 0; __breakpoint__inv(&a, &n, &i), i < n; ++i) {
    ++a[i];
  }
}


x86 assembly (clang, -O0):
<array_inc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1030 <__breakpoint__inv@plt>
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1169 <array_inc+0x59>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <array_inc+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_inc>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rdi,0x18(%rsp)
mov    %rsi,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    0x18(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1030 <__breakpoint__inv@plt>
mov    0x8(%rsp),%rax
cmp    0x10(%rsp),%rax
jae    118c <array_inc+0x7c>
lea    0x18(%rsp),%r14
lea    0x10(%rsp),%r15
lea    0x8(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    0x18(%rsp),%rcx
addl   $0x1,(%rcx,%rax,4)
add    $0x1,%rax
mov    %rax,0x8(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <__breakpoint__inv@plt>
mov    0x8(%rsp),%rax
cmp    0x10(%rsp),%rax
jb     1160 <array_inc+0x50>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @array_inc(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i64
store i32* %0, i32** %3
store i64 %1, i64* %4
store i64 0, i64* %5
br label %6
6: ; preds = %17, %2
%7 = call i32 @__breakpoint__inv(i32** %3, i64* %4, i64* %5)
%8 = load i64, i64* %5
%9 = load i64, i64* %4
%10 = icmp ult i64 %8, %9
br i1 %10, label %11, label %20
11: ; preds = %6
%12 = load i32*, i32** %3
%13 = load i64, i64* %5
%14 = getelementptr inbounds i32, i32* %12, i64 %13
%15 = load i32, i32* %14
%16 = add nsw i32 %15, 1
store i32 %16, i32* %14
br label %17
17: ; preds = %11
%18 = load i64, i64* %5
%19 = add i64 %18, 1
store i64 %19, i64* %5
br label %6
20: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @array_inc(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i64
store i32* %0, i32** %3
store i64 %1, i64* %4
%6 = bitcast i64* %5 to i8*
store i64 0, i64* %5
%7 = call i32 @__breakpoint__inv(i32** %3, i64* %4, i64* %5)
%8 = load i64, i64* %5
%9 = load i64, i64* %4
%10 = icmp ult i64 %8, %9
br i1 %10, label %12, label %11
11: ; preds = %12, %2
ret void
12: ; preds = %2, %12
%13 = phi i64 [ %20, %12 ], [ %8, %2 ]
%14 = load i32*, i32** %3
%15 = getelementptr inbounds i32, i32* %14, i64 %13
%16 = load i32, i32* %15
%17 = add nsw i32 %16, 1
store i32 %17, i32* %15
%18 = add nuw i64 %13, 1
store i64 %18, i64* %5
%19 = call i32 @__breakpoint__inv(i32** %3, i64* %4, i64* %5)
%20 = load i64, i64* %5
%21 = load i64, i64* %4
%22 = icmp ult i64 %20, %21
br i1 %22, label %12, label %11
}