#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 display_array(int *p, int size, int nl, FILE *fp) {
  int i;
  for (i = 1; i <= size; i++, p++) {
    switch (*p) {
    case 1000000:
      fprintf(fp, "   INF");
      break;
    case -1000000:
      fprintf(fp, "  -INf");
      break;
    case -50:
      fprintf(fp, "   DEF");
      break;
    default:
      fprintf(fp, "%6d", *p);
      break;
    }
    if ((i % nl) == 0)
      fprintf(fp, "\n");
  }
  if (size % nl)
    fprintf(fp, "\n");
  return;
}


x86 assembly (clang, -O0):
<display_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1214 <display_array+0x104>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
sub    $0xfff0bdc0,%eax
je     118d <display_array+0x7d>
jmp    1152 <display_array+0x42>
mov    -0x20(%rbp),%eax
sub    $0xffffffce,%eax
je     11a4 <display_array+0x94>
jmp    1163 <display_array+0x53>
mov    -0x20(%rbp),%eax
sub    $0xf4240,%eax
jne    11bb <display_array+0xab>
jmp    1176 <display_array+0x66>
mov    -0x18(%rbp),%rdi
lea    0xe7f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11d3 <display_array+0xc3>
mov    -0x18(%rbp),%rdi
lea    0xe6f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11d3 <display_array+0xc3>
mov    -0x18(%rbp),%rdi
lea    0xe5f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11d3 <display_array+0xc3>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
lea    0xe49(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x1c(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    11f5 <display_array+0xe5>
mov    -0x18(%rbp),%rdi
lea    0xe2b(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11fa <display_array+0xea>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
jmp    112d <display_array+0x1d>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
je     1236 <display_array+0x126>
mov    -0x18(%rbp),%rdi
lea    0xdea(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_array>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %edx,%ebp
mov    %esi,%r14d
test   %esi,%esi
jle    1211 <display_array+0xe1>
mov    %rdi,%r15
mov    %r14d,%r13d
xor    %r12d,%r12d
jmp    1169 <display_array+0x39>
cs nopw 0x0(%rax,%rax,1)
cmp    %r12d,%r13d
je     1211 <display_array+0xe1>
mov    (%r15,%r12,4),%edx
add    $0x1,%r12
cmp    $0xfff0bdc0,%edx
je     11a0 <display_array+0x70>
cmp    $0xffffffce,%edx
je     11c0 <display_array+0x90>
cmp    $0xf4240,%edx
jne    11e0 <display_array+0xb0>
mov    $0x6,%esi
mov    $0x1,%edx
lea    0xe69(%rip),%rdi
jmp    11d1 <display_array+0xa1>
nopl   0x0(%rax)
mov    $0x6,%esi
mov    $0x1,%edx
lea    0xe56(%rip),%rdi
jmp    11d1 <display_array+0xa1>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x6,%esi
mov    $0x1,%edx
lea    0xe3d(%rip),%rdi
mov    %rbx,%rcx
call   1050 <fwrite@plt>
jmp    11f1 <display_array+0xc1>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
lea    0xe2b(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %r12d,%eax
cltd
idiv   %ebp
test   %edx,%edx
jne    1160 <display_array+0x30>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
jmp    1160 <display_array+0x30>
mov    %r14d,%eax
cltd
idiv   %ebp
test   %edx,%edx
je     1236 <display_array+0x106>
mov    $0xa,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fputc@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c" INF\00"
@.str.1 = [7 x i8] c" -INf\00"
@.str.2 = [7 x i8] c" DEF\00"
@.str.3 = [4 x i8] c"%6d\00"
@.str.4 = [2 x i8] c"\0A\00"
define void @display_array(i32* %0, i32 %1, i32 %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32* %3, i32** %8
store i32 1, i32* %9
br label %10
10: ; preds = %40, %4
%11 = load i32, i32* %9
%12 = load i32, i32* %6
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %45
14: ; preds = %10
%15 = load i32*, i32** %5
%16 = load i32, i32* %15
switch i32 %16, label %26 [
i32 1000000, label %17
i32 -1000000, label %20
i32 -50, label %23
]
17: ; preds = %14
%18 = load i32*, i32** %8
%19 = call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %31
20: ; preds = %14
%21 = load i32*, i32** %8
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %31
23: ; preds = %14
%24 = load i32*, i32** %8
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %31
26: ; preds = %14
%27 = load i32*, i32** %8
%28 = load i32*, i32** %5
%29 = load i32, i32* %28
%30 = call i32 (i32*, i8*, ...) @fprintf(i32* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %26, %23, %20, %17
%32 = load i32, i32* %9
%33 = load i32, i32* %7
%34 = srem i32 %32, %33
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %31
%37 = load i32*, i32** %8
%38 = call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %39
39: ; preds = %36, %31
br label %40
40: ; preds = %39
%41 = load i32, i32* %9
%42 = add nsw i32 %41, 1
store i32 %42, i32* %9
%43 = load i32*, i32** %5
%44 = getelementptr inbounds i32, i32* %43, i32 1
store i32* %44, i32** %5
br label %10
45: ; preds = %10
%46 = load i32, i32* %6
%47 = load i32, i32* %7
%48 = srem i32 %46, %47
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %53
50: ; preds = %45
%51 = load i32*, i32** %8
%52 = call i32 (i32*, i8*, ...) @fprintf(i32* %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %53
53: ; preds = %50, %45
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c" INF\00"
@.str.1 = [7 x i8] c" -INf\00"
@.str.2 = [7 x i8] c" DEF\00"
@.str.3 = [4 x i8] c"%6d\00"
define void @display_array(i32* nocapture %0, i32 %1, i32 %2, i32* nocapture %3) {
%5 = icmp slt i32 %1, 1
br i1 %5, label %27, label %6
6: ; preds = %4, %23
%7 = phi i32 [ %24, %23 ], [ 1, %4 ]
%8 = phi i32* [ %25, %23 ], [ %0, %4 ]
%9 = load i32, i32* %8
switch i32 %9, label %16 [
i32 1000000, label %10
i32 -1000000, label %12
i32 -50, label %14
]
10: ; preds = %6
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 6, i64 1, i32* %3)
br label %18
12: ; preds = %6
%13 = tail call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i64 6, i64 1, i32* %3)
br label %18
14: ; preds = %6
%15 = tail call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i64 6, i64 1, i32* %3)
br label %18
16: ; preds = %6
%17 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %9)
br label %18
18: ; preds = %16, %14, %12, %10
%19 = srem i32 %7, %2
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = tail call i32 @fputc(i32 10, i32* %3)
br label %23
23: ; preds = %18, %21
%24 = add nuw i32 %7, 1
%25 = getelementptr inbounds i32, i32* %8, i64 1
%26 = icmp eq i32 %7, %1
br i1 %26, label %27, label %6
27: ; preds = %23, %4
%28 = srem i32 %1, %2
%29 = icmp eq i32 %28, 0
br i1 %29, label %32, label %30
30: ; preds = %27
%31 = tail call i32 @fputc(i32 10, i32* %3)
br label %32
32: ; preds = %30, %27
ret void
}