#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 main() {
  int i, j;
  printf("PART A: \n \n");
  for (i = 0; i < 5; i++) {
    for (j = 0; j < 5; j++)
      printf("S ");
    printf("\n");
  }
  printf("\nPART B: \n \n");
  for (i = 0; i < 5; i++) {
    for (j = 0; j < 5; j++)
      if ((i == 0) || (j == 0) || (i == 4) || (j == 4))
        printf("S ");
      else
        printf("  ");
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1181 <main+0x71>
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    1167 <main+0x57>
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1143 <main+0x33>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1132 <main+0x22>
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1221 <main+0x111>
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    1207 <main+0xf7>
cmpl   $0x0,-0x8(%rbp)
je     11d7 <main+0xc7>
cmpl   $0x0,-0xc(%rbp)
je     11d7 <main+0xc7>
cmpl   $0x4,-0x8(%rbp)
je     11d7 <main+0xc7>
cmpl   $0x4,-0xc(%rbp)
jne    11e8 <main+0xd8>
lea    0xe2e(%rip),%rdi
call   1030 <printf@plt>
jmp    11f4 <main+0xe4>
lea    0xe2d(%rip),%rdi
call   1030 <printf@plt>
jmp    11f9 <main+0xe9>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a5 <main+0x95>
lea    0xdfc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1194 <main+0x84>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xecb(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb9(%rip),%rbx
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdc9(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
lea    0xd75(%rip),%r14
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [12 x i8] c"PART A: \0A \0A\00"
@.str.1 = [3 x i8] c"S \00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [13 x i8] c"\0APART B: \0A \0A\00"
@.str.4 = [3 x i8] c" \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %5
5: ; preds = %19, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 5
br i1 %7, label %8, label %22
8: ; preds = %5
store i32 0, i32* %3
br label %9
9: ; preds = %14, %8
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 5
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %9
17: ; preds = %9
%18 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %5
22: ; preds = %5
%23 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %2
br label %24
24: ; preds = %53, %22
%25 = load i32, i32* %2
%26 = icmp slt i32 %25, 5
br i1 %26, label %27, label %56
27: ; preds = %24
store i32 0, i32* %3
br label %28
28: ; preds = %48, %27
%29 = load i32, i32* %3
%30 = icmp slt i32 %29, 5
br i1 %30, label %31, label %51
31: ; preds = %28
%32 = load i32, i32* %2
%33 = icmp eq i32 %32, 0
br i1 %33, label %43, label %34
34: ; preds = %31
%35 = load i32, i32* %3
%36 = icmp eq i32 %35, 0
br i1 %36, label %43, label %37
37: ; preds = %34
%38 = load i32, i32* %2
%39 = icmp eq i32 %38, 4
br i1 %39, label %43, label %40
40: ; preds = %37
%41 = load i32, i32* %3
%42 = icmp eq i32 %41, 4
br i1 %42, label %43, label %45
43: ; preds = %40, %37, %34, %31
%44 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %47
45: ; preds = %40
%46 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %47
47: ; preds = %45, %43
br label %48
48: ; preds = %47
%49 = load i32, i32* %3
%50 = add nsw i32 %49, 1
store i32 %50, i32* %3
br label %28
51: ; preds = %28
%52 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %53
53: ; preds = %51
%54 = load i32, i32* %2
%55 = add nsw i32 %54, 1
store i32 %55, i32* %2
br label %24
56: ; preds = %24
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"S \00"
@.str.4 = [3 x i8] c" \00"
@str = [11 x i8] c"PART A: \0A \00"
@str.5 = [12 x i8] c"\0APART B: \0A \00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @putchar(i32 10)
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%13 = tail call i32 @putchar(i32 10)
%14 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%15 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%16 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%17 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%18 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%19 = tail call i32 @putchar(i32 10)
%20 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%21 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%22 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%23 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%24 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%25 = tail call i32 @putchar(i32 10)
%26 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%27 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%28 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%29 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%30 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%31 = tail call i32 @putchar(i32 10)
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.5, i64 0, i64 0))
%33 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%34 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%35 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%36 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%37 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%38 = tail call i32 @putchar(i32 10)
%39 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%40 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%41 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%42 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%43 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%44 = tail call i32 @putchar(i32 10)
%45 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%46 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%47 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%48 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%49 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%50 = tail call i32 @putchar(i32 10)
%51 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%52 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%53 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%54 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%55 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%56 = tail call i32 @putchar(i32 10)
%57 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%58 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%59 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%60 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%61 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%62 = tail call i32 @putchar(i32 10)
ret i32 0
}