#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 *, int, int, int, int);
void output_default_array(FILE *file, int id) {
  int x, y;
  int num_249_cnt = id;
  for (x = 0; x < 800; x++) {
    for (y = 0; y < 800; y++) {
      num_249_cnt = (num_249_cnt + 1) % 250;
      fprintf(file, "%4d,%4d,%4d,%4d\n", id, x, y, num_249_cnt);
    }
  }
}


x86 assembly (clang, -O0):
<output_default_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x320,-0x10(%rbp)
jge    119d <output_default_array+0x8d>
movl   $0x0,-0x14(%rbp)
cmpl   $0x320,-0x14(%rbp)
jge    118a <output_default_array+0x7a>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    $0xfa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
lea    0xe89(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1140 <output_default_array+0x30>
jmp    118f <output_default_array+0x7f>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112c <output_default_array+0x1c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_default_array>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%r12
xor    %r13d,%r13d
lea    0xed5(%rip),%r15
mov    %esi,%ebx
nopl   (%rax)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
movslq %ebx,%rbx
imul   $0x10624dd3,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x24,%rax
add    %ecx,%eax
imul   $0xfa,%eax,%eax
sub    %eax,%ebx
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
mov    %r13d,%ecx
mov    %ebp,%r8d
mov    %ebx,%r9d
call   1030 <fprintf@plt>
add    $0x1,%ebp
cmp    $0x320,%ebp
jne    1140 <output_default_array+0x30>
add    $0x1,%r13d
cmp    $0x320,%r13d
jne    1130 <output_default_array+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [17 x i8] c"%4d,%4d,%4d,%4d\0A\00"
define void @output_default_array(i32* nocapture %0, i32 %1) {
br label %3
3: ; preds = %2, %14
%4 = phi i32 [ %1, %2 ], [ %10, %14 ]
%5 = phi i32 [ 0, %2 ], [ %15, %14 ]
br label %6
6: ; preds = %3, %6
%7 = phi i32 [ %4, %3 ], [ %10, %6 ]
%8 = phi i32 [ 0, %3 ], [ %12, %6 ]
%9 = add nsw i32 %7, 1
%10 = srem i32 %9, 250
%11 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %5, i32 %8, i32 %10)
%12 = add nuw nsw i32 %8, 1
%13 = icmp eq i32 %12, 800
br i1 %13, label %14, label %6
14: ; preds = %6
%15 = add nuw nsw i32 %5, 1
%16 = icmp eq i32 %15, 800
br i1 %16, label %17, label %3
17: ; preds = %14
ret void
}