#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*/ print_char(char);
void print_diagonal(int n) {
  int i;
  int j;
  if (n <= 0) {
    print_char('\n');
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < i; j++) {
      print_char(' ');
    }
    print_char('\\');
    print_char('\n');
  }
}


x86 assembly (clang, -O0):
<print_diagonal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     112f <print_diagonal+0x1f>
mov    $0xa,%edi
call   1030 <print_char@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    118f <print_diagonal+0x7f>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    116d <print_diagonal+0x5d>
mov    $0x20,%edi
call   1030 <print_char@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1149 <print_diagonal+0x39>
mov    $0x5c,%edi
call   1030 <print_char@plt>
mov    $0xa,%edi
call   1030 <print_char@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <print_diagonal+0x26>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_diagonal>:
test   %edi,%edi
jle    1166 <print_diagonal+0x56>
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
xor    %ebx,%ebx
jmp    113c <print_diagonal+0x2c>
nop
mov    $0x5c,%edi
call   1030 <print_char@plt>
mov    $0xa,%edi
call   1030 <print_char@plt>
add    $0x1,%ebx
cmp    %r14d,%ebx
je     1161 <print_diagonal+0x51>
test   %ebx,%ebx
je     1120 <print_diagonal+0x10>
mov    %ebx,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <print_char@plt>
add    $0xffffffff,%ebp
jne    1150 <print_diagonal+0x40>
jmp    1120 <print_diagonal+0x10>
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    $0xa,%edi
jmp    1030 <print_char@plt>

LLVM IR (-O0):
define void @print_diagonal(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = icmp sle i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @print_char(i8 signext 10)
br label %9
9: ; preds = %7, %1
store i32 0, i32* %3
br label %10
10: ; preds = %27, %9
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %30
14: ; preds = %10
store i32 0, i32* %4
br label %15
15: ; preds = %21, %14
%16 = load i32, i32* %4
%17 = load i32, i32* %3
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %24
19: ; preds = %15
%20 = call i32 @print_char(i8 signext 32)
br label %21
21: ; preds = %19
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %15
24: ; preds = %15
%25 = call i32 @print_char(i8 signext 92)
%26 = call i32 @print_char(i8 signext 10)
br label %27
27: ; preds = %24
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %10
30: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @print_diagonal(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @print_char(i8 signext 10)
br label %18
5: ; preds = %1, %13
%6 = phi i32 [ %16, %13 ], [ 0, %1 ]
%7 = icmp eq i32 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %5, %8
%9 = phi i32 [ %11, %8 ], [ 0, %5 ]
%10 = tail call i32 @print_char(i8 signext 32)
%11 = add nuw nsw i32 %9, 1
%12 = icmp eq i32 %11, %6
br i1 %12, label %13, label %8
13: ; preds = %8, %5
%14 = tail call i32 @print_char(i8 signext 92)
%15 = tail call i32 @print_char(i8 signext 10)
%16 = add nuw nsw i32 %6, 1
%17 = icmp eq i32 %16, %0
br i1 %17, label %18, label %5
18: ; preds = %13, %3
ret void
}