#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*/ printf(char *, ...);
void print_array_values(const int *values, const int *nvalues) {
  int i, c = 0;
  for (i = 0; i < *nvalues; i++) {
    printf("%d, ", values[i]);
    if (++c >= 10) {
      c = 0;
      printf("\n");
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_array_values>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    1190 <print_array_values+0x80>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmp    $0xa,%eax
jl     117d <print_array_values+0x6d>
movl   $0x0,-0x18(%rbp)
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1182 <print_array_values+0x72>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112e <print_array_values+0x1e>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_array_values>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmpl   $0x0,(%rsi)
jle    1171 <print_array_values+0x51>
mov    %rsi,%r12
mov    %rdi,%r14
lea    0xec6(%rip),%r15
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    1159 <print_array_values+0x39>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %ebp,%ebp
add    $0x1,%rbx
movslq (%r12),%rax
cmp    %rax,%rbx
jge    1171 <print_array_values+0x51>
mov    (%r14,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x9,%ebp
jge    1140 <print_array_values+0x20>
add    $0x1,%ebp
jmp    114c <print_array_values+0x2c>
mov    $0xa,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%d, \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_array_values(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
store i32 0, i32* %6
store i32 0, i32* %5
br label %7
7: ; preds = %25, %2
%8 = load i32, i32* %5
%9 = load i32*, i32** %4
%10 = load i32, i32* %9
%11 = icmp slt i32 %8, %10
br i1 %11, label %12, label %28
12: ; preds = %7
%13 = load i32*, i32** %3
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %6
%20 = add nsw i32 %19, 1
store i32 %20, i32* %6
%21 = icmp sge i32 %20, 10
br i1 %21, label %22, label %24
22: ; preds = %12
store i32 0, i32* %6
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %24
24: ; preds = %22, %12
br label %25
25: ; preds = %24
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %7
28: ; preds = %7
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d, \00"
define void @print_array_values(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %21
5: ; preds = %2, %15
%6 = phi i64 [ %17, %15 ], [ 0, %2 ]
%7 = phi i32 [ %16, %15 ], [ 0, %2 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %6
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nsw i32 %7, 1
%12 = icmp sgt i32 %7, 8
br i1 %12, label %13, label %15
13: ; preds = %5
%14 = tail call i32 @putchar(i32 10)
br label %15
15: ; preds = %5, %13
%16 = phi i32 [ 0, %13 ], [ %11, %5 ]
%17 = add nuw nsw i64 %6, 1
%18 = load i32, i32* %1
%19 = sext i32 %18 to i64
%20 = icmp slt i64 %17, %19
br i1 %20, label %5, label %21
21: ; preds = %15, %2
%22 = tail call i32 @putchar(i32 10)
ret void
}