#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 *, ...);
int /*<<< orphan*/ putchar(char);
void wrt(char *s, int *a, int n) {
  int i;
  printf("\n%s\n%s%s\n", "---", s, ":");
  for (i = 0; i < n; ++i) {
    if (i % 10 == 0)
      putchar('\n');
    printf("%7d", a[i]);
  }
  if (n % 10 != 0)
    putchar('\n');
}


x86 assembly (clang, -O0):
<wrt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdx
lea    0xec2(%rip),%rdi
lea    0xec5(%rip),%rsi
lea    0xec2(%rip),%rcx
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11ab <wrt+0x8b>
mov    -0x18(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1184 <wrt+0x64>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115a <wrt+0x3a>
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11c9 <wrt+0xa9>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wrt>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rsi,%r13
mov    %rdi,%rdx
lea    0xec6(%rip),%rdi
lea    0xec9(%rip),%rsi
lea    0xec6(%rip),%rcx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,0x4(%rsp)
test   %ebx,%ebx
jle    11ab <wrt+0x8b>
mov    0x4(%rsp),%ebp
mov    $0xcccccccd,%r12d
lea    0xea8(%rip),%r15
xor    %ebx,%ebx
xor    %r14d,%r14d
jmp    118b <wrt+0x6b>
nop
mov    0x0(%r13,%r14,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r14
add    $0xffffffff,%ebx
cmp    %r14,%rbp
je     11ab <wrt+0x8b>
mov    %r14d,%eax
imul   %r12,%rax
shr    $0x23,%rax
lea    (%rax,%rax,4),%eax
add    %eax,%eax
add    %ebx,%eax
jne    1170 <wrt+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1170 <wrt+0x50>
imul   $0xcccccccd,0x4(%rsp),%eax
cc
add    $0x19999998,%eax
ror    %eax
cmp    $0x19999999,%eax
jb     11d9 <wrt+0xb9>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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