#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_oneval_array(FILE *file, int id, int oneval) {
  int x, y;
  int num_249_cnt = id;
  for (x = 0; x < 800; x++) {
    for (y = 0; y < 800; y++) {
      if (x == id * 50 && y == id * 40) {
        fprintf(file, "%4d,%4d,%4d,%4d\n", id, x, y, oneval);
      } else {
        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_oneval_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x320,-0x14(%rbp)
jge    11e6 <output_oneval_array+0xd6>
movl   $0x0,-0x18(%rbp)
cmpl   $0x320,-0x18(%rbp)
jge    11d3 <output_oneval_array+0xc3>
mov    -0x14(%rbp),%eax
imul   $0x32,-0xc(%rbp),%ecx
cmp    %ecx,%eax
jne    1191 <output_oneval_array+0x81>
mov    -0x18(%rbp),%eax
imul   $0x28,-0xc(%rbp),%ecx
cmp    %ecx,%eax
jne    1191 <output_oneval_array+0x81>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x10(%rbp),%r9d
lea    0xe79(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11c0 <output_oneval_array+0xb0>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    $0xfa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
lea    0xe45(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11c5 <output_oneval_array+0xb5>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1143 <output_oneval_array+0x33>
jmp    11d8 <output_oneval_array+0xc8>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112f <output_oneval_array+0x1f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_oneval_array>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,0xc(%rsp)
mov    %rdi,0x10(%rsp)
imul   $0x32,%esi,%ebx
lea    0x0(,%rsi,8),%eax
lea    (%rax,%rax,4),%r13d
xor    %ebp,%ebp
mov    %rsi,%r12
mov    %esi,%r15d
jmp    114b <output_oneval_array+0x3b>
nop
add    $0x1,%ebp
cmp    $0x320,%ebp
je     11c1 <output_oneval_array+0xb1>
xor    %r14d,%r14d
jmp    119d <output_oneval_array+0x8d>
add    $0x1,%r15d
movslq %r15d,%r15
imul   $0x10624dd3,%r15,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x24,%rax
add    %ecx,%eax
imul   $0xfa,%eax,%eax
sub    %eax,%r15d
mov    0x10(%rsp),%rdi
lea    0xe80(%rip),%rsi
mov    %r12d,%edx
mov    %ebp,%ecx
mov    %r14d,%r8d
mov    %r15d,%r9d
call   1030 <fprintf@plt>
add    $0x1,%r14d
cmp    $0x320,%r14d
je     1140 <output_oneval_array+0x30>
cmp    %ebx,%ebp
jne    1150 <output_oneval_array+0x40>
cmp    %r14d,%r13d
jne    1150 <output_oneval_array+0x40>
mov    0x10(%rsp),%rdi
lea    0xe4e(%rip),%rsi
mov    %r12d,%edx
mov    %ebx,%ecx
mov    %r13d,%r8d
mov    0xc(%rsp),%r9d
jmp    118b <output_oneval_array+0x7b>
add    $0x18,%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_oneval_array(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = load i32, i32* %5
store i32 %10, i32* %9
store i32 0, i32* %7
br label %11
11: ; preds = %50, %3
%12 = load i32, i32* %7
%13 = icmp slt i32 %12, 800
br i1 %13, label %14, label %53
14: ; preds = %11
store i32 0, i32* %8
br label %15
15: ; preds = %46, %14
%16 = load i32, i32* %8
%17 = icmp slt i32 %16, 800
br i1 %17, label %18, label %49
18: ; preds = %15
%19 = load i32, i32* %7
%20 = load i32, i32* %5
%21 = mul nsw i32 %20, 50
%22 = icmp eq i32 %19, %21
br i1 %22, label %23, label %35
23: ; preds = %18
%24 = load i32, i32* %8
%25 = load i32, i32* %5
%26 = mul nsw i32 %25, 40
%27 = icmp eq i32 %24, %26
br i1 %27, label %28, label %35
28: ; preds = %23
%29 = load i32*, i32** %4
%30 = load i32, i32* %5
%31 = load i32, i32* %7
%32 = load i32, i32* %8
%33 = load i32, i32* %6
%34 = call i32 @fprintf(i32* %29, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %30, i32 %31, i32 %32, i32 %33)
br label %45
35: ; preds = %23, %18
%36 = load i32, i32* %9
%37 = add nsw i32 %36, 1
%38 = srem i32 %37, 250
store i32 %38, i32* %9
%39 = load i32*, i32** %4
%40 = load i32, i32* %5
%41 = load i32, i32* %7
%42 = load i32, i32* %8
%43 = load i32, i32* %9
%44 = call i32 @fprintf(i32* %39, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %40, i32 %41, i32 %42, i32 %43)
br label %45
45: ; preds = %35, %28
br label %46
46: ; preds = %45
%47 = load i32, i32* %8
%48 = add nsw i32 %47, 1
store i32 %48, i32* %8
br label %15
49: ; preds = %15
br label %50
50: ; preds = %49
%51 = load i32, i32* %7
%52 = add nsw i32 %51, 1
store i32 %52, i32* %7
br label %11
53: ; preds = %11
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"%4d,%4d,%4d,%4d\0A\00"
define void @output_oneval_array(i32* nocapture %0, i32 %1, i32 %2) {
%4 = mul nsw i32 %1, 50
%5 = mul nsw i32 %1, 40
br label %6
6: ; preds = %3, %25
%7 = phi i32 [ %1, %3 ], [ %22, %25 ]
%8 = phi i32 [ 0, %3 ], [ %26, %25 ]
%9 = icmp eq i32 %8, %4
br label %10
10: ; preds = %6, %21
%11 = phi i32 [ %7, %6 ], [ %22, %21 ]
%12 = phi i32 [ 0, %6 ], [ %23, %21 ]
%13 = icmp eq i32 %12, %5
%14 = select i1 %9, i1 %13, i1 false
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %4, i32 %5, i32 %2)
br label %21
17: ; preds = %10
%18 = add nsw i32 %11, 1
%19 = srem i32 %18, 250
%20 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %8, i32 %12, i32 %19)
br label %21
21: ; preds = %15, %17
%22 = phi i32 [ %11, %15 ], [ %19, %17 ]
%23 = add nuw nsw i32 %12, 1
%24 = icmp eq i32 %23, 800
br i1 %24, label %25, label %10
25: ; preds = %21
%26 = add nuw nsw i32 %8, 1
%27 = icmp eq i32 %26, 800
br i1 %27, label %28, label %6
28: ; preds = %25
ret void
}