#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 block(int n) {
  int x, y;
  for (y = 1; y <= n; y++, printf("\n"))
    for (x = 1; x <= n; x++)
      printf("%d ", x * y);
}


x86 assembly (clang, -O0):
<block>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1185 <block+0x75>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1164 <block+0x54>
mov    -0x8(%rbp),%esi
imul   -0xc(%rbp),%esi
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1135 <block+0x25>
jmp    1169 <block+0x59>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1122 <block+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<block>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edi,%edi
jle    117b <block+0x5b>
mov    %edi,%r14d
mov    $0x1,%r12d
lea    0xec4(%rip),%r15
nopl   0x0(%rax)
mov    %r12d,%ebp
mov    %r14d,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %r12d,%ebp
add    $0xffffffff,%ebx
jne    1150 <block+0x30>
lea    0x1(%r12),%ebx
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    %r14d,%r12d
mov    %ebx,%r12d
jne    1140 <block+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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