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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void numbersWrite(FILE *fp, int numElmnts, void *array) {
  FILE *output;
  int *numArray;
  int i;
  int j = 0;
  output = fp;
  numArray = array;
  for (i = 0; i < numElmnts; i++) {
    fprintf(output, "%d ", numArray[i]);
    j++;
    if (j == 10) {
      fprintf(output, "\n");
      j = 0;
    }
  }
}


x86 assembly (clang, -O0):
<numbersWrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a9 <numbersWrite+0x99>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe9d(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
cmpl   $0xa,-0x30(%rbp)
jne    1196 <numbersWrite+0x86>
mov    -0x20(%rbp),%rdi
lea    0xe7c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x30(%rbp)
jmp    119b <numbersWrite+0x8b>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1141 <numbersWrite+0x31>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<numbersWrite>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1183 <numbersWrite+0x63>
mov    %rdx,%r14
mov    %rdi,%r13
mov    %esi,%r12d
lea    0xec1(%rip),%r15
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    1159 <numbersWrite+0x39>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rbx
cmp    %rbx,%r12
je     1183 <numbersWrite+0x63>
mov    (%r14,%rbx,4),%edx
mov    %r13,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
add    $0x1,%ebp
cmp    $0xa,%ebp
jne    1150 <numbersWrite+0x30>
mov    $0xa,%edi
mov    %r13,%rsi
call   1030 <fputc@plt>
xor    %ebp,%ebp
jmp    1150 <numbersWrite+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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