#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 hpig(int *dog, int hdog) {
  int c, d;
  c = 0;
  d = 0;
  printf("\n");
  for (; c < hdog; c++) {
    printf(" %d   ", *(dog + c));
    if ((c + 1) % 5 == 0)
      printf("\n");
    else
      ;
  }
}


x86 assembly (clang, -O0):
<hpig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a2 <hpig+0x92>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    118a <hpig+0x7a>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118f <hpig+0x7f>
jmp    118f <hpig+0x7f>
jmp    1194 <hpig+0x84>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113b <hpig+0x2b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hpig>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%r15
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %ebp,%ebp
jle    1199 <hpig+0x79>
mov    %ebp,%r13d
mov    $0x1,%ebx
xor    %r12d,%r12d
jmp    1158 <hpig+0x38>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    %r12,%r13
je     1199 <hpig+0x79>
mov    %r12,%rbp
mov    %ebx,%eax
mov    $0xcccccccd,%ecx
imul   %rcx,%rax
shr    $0x22,%rax
lea    (%rax,%rax,4),%r14d
add    $0xffffffff,%r14d
mov    (%r15,%r12,4),%esi
lea    0xe83(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r12
cmp    %ebp,%r14d
jne    1150 <hpig+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1150 <hpig+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [7 x i8] c" %d \00"
define void @hpig(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* %5
store i32 0, i32* %6
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %27, %2
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %30
12: ; preds = %8
%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 ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
%21 = srem i32 %20, 5
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %12
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %26
25: ; preds = %12
br label %26
26: ; preds = %25, %23
br label %27
27: ; preds = %26
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %8
30: ; preds = %8
ret void
}

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