#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*/ scanf(char *, int *);
int main(void) {
  int i, j, r, k = 1;
  printf("Enter the range: ");
  scanf("%d", &r);
  printf("Floyd's triangle:\n");
  for (i = 1; i <= r; i++) {
    for (j = 1; j <= i; j++, k++) {
      printf(" %d", k);
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x14(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     11cc <main+0xac>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11b0 <main+0x90>
mov    -0x14(%rbp),%esi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117c <main+0x5c>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1169 <main+0x49>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
lea    0xea8(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,0x4(%rsp)
jle    11d2 <main+0x92>
mov    $0x1,%r15d
lea    0xe8b(%rip),%r14
mov    $0x1,%r12d
nopl   (%rax)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    (%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebx
cmp    %ebx,%r12d
jne    11a0 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    %r12d,%r15d
lea    0x1(%r12),%eax
cmp    0x4(%rsp),%r12d
mov    %eax,%r12d
jl     1190 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [18 x i8] c"Enter the range: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c" %d\00"
@str = [18 x i8] c"Floyd's triangle:\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 1
br i1 %7, label %22, label %8
8: ; preds = %0, %17
%9 = phi i32 [ %11, %17 ], [ 1, %0 ]
%10 = phi i32 [ %19, %17 ], [ 1, %0 ]
%11 = add i32 %9, %10
br label %12
12: ; preds = %8, %12
%13 = phi i32 [ %9, %8 ], [ %15, %12 ]
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%15 = add i32 %13, 1
%16 = icmp eq i32 %15, %11
br i1 %16, label %17, label %12
17: ; preds = %12
%18 = call i32 @putchar(i32 10)
%19 = add nuw nsw i32 %10, 1
%20 = load i32, i32* %1
%21 = icmp slt i32 %10, %20
br i1 %21, label %8, label %22
22: ; preds = %17, %0
ret i32 0
}