#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*/ substr(char *, int, int);
int main() {
  int j, k;
  char c[] = "shubhmsng";
  for (j = 0; j < 9; j++) {
    for (k = 0; k < 9; k++) {
      substr(c, j, k);
      printf("\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x16(%rbp)
mov    0xec7(%rip),%ax
mov    %ax,-0xe(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x9,-0x8(%rbp)
jge    11a3 <main+0x83>
movl   $0x0,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jge    1190 <main+0x70>
lea    -0x16(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <substr@plt>
lea    0xe8d(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115d <main+0x3d>
jmp    1195 <main+0x75>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114c <main+0x2c>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movabs $0x6e736d6862756873,%rax
6d 73 6e
mov    %rax,0x8(%rsp)
movw   $0x67,0x10(%rsp)
xor    %ebx,%ebx
lea    0x8(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %ebx,%esi
xor    %edx,%edx
call   1040 <substr@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
call   1040 <substr@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x2,%edx
call   1040 <substr@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x3,%edx
call   1040 <substr@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x4,%edx
call   1040 <substr@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x5,%edx
call   1040 <substr@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x6,%edx
call   1040 <substr@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x7,%edx
call   1040 <substr@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x8,%edx
call   1040 <substr@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    $0x9,%ebx
jne    1150 <main+0x30>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.c = [10 x i8] c"shubhmsng\00"
@.str = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [10 x i8]
store i32 0, i32* %1
%5 = bitcast [10 x i8]* %4 to i8*
store i32 0, i32* %2
br label %6
6: ; preds = %23, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 9
br i1 %8, label %9, label %26
9: ; preds = %6
store i32 0, i32* %3
br label %10
10: ; preds = %19, %9
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 9
br i1 %12, label %13, label %22
13: ; preds = %10
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = call i32 @substr(i8* %14, i32 %15, i32 %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %13
%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* %2
%25 = add nsw i32 %24, 1
store i32 %25, i32* %2
br label %6
26: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@__const.main.c = [10 x i8] c"shubhmsng\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %23, %3 ]
%5 = call i32 @substr(i8* %2, i32 %4, i32 0)
%6 = call i32 @putchar(i32 10)
%7 = call i32 @substr(i8* %2, i32 %4, i32 1)
%8 = call i32 @putchar(i32 10)
%9 = call i32 @substr(i8* %2, i32 %4, i32 2)
%10 = call i32 @putchar(i32 10)
%11 = call i32 @substr(i8* %2, i32 %4, i32 3)
%12 = call i32 @putchar(i32 10)
%13 = call i32 @substr(i8* %2, i32 %4, i32 4)
%14 = call i32 @putchar(i32 10)
%15 = call i32 @substr(i8* %2, i32 %4, i32 5)
%16 = call i32 @putchar(i32 10)
%17 = call i32 @substr(i8* %2, i32 %4, i32 6)
%18 = call i32 @putchar(i32 10)
%19 = call i32 @substr(i8* %2, i32 %4, i32 7)
%20 = call i32 @putchar(i32 10)
%21 = call i32 @substr(i8* %2, i32 %4, i32 8)
%22 = call i32 @putchar(i32 10)
%23 = add nuw nsw i32 %4, 1
%24 = icmp eq i32 %23, 9
br i1 %24, label %25, label %3
25: ; preds = %3
ret i32 0
}