#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*/ _putchar(char);
void print_diagonal(int n) {
  int s, lines;
  if (n > 0) {
    for (s = 0; s < n; s++) {
      for (lines = 0; lines < s; lines++)
        _putchar(' ');
      _putchar('\\');
      _putchar('\n');
    }
  } else
    _putchar('\n');
}


x86 assembly (clang, -O0):
<print_diagonal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    118a <print_diagonal+0x7a>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1185 <print_diagonal+0x75>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1163 <print_diagonal+0x53>
mov    $0x20,%edi
call   1030 <_putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113f <print_diagonal+0x2f>
mov    $0x5c,%edi
call   1030 <_putchar@plt>
mov    $0xa,%edi
call   1030 <_putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112c <print_diagonal+0x1c>
jmp    1194 <print_diagonal+0x84>
mov    $0xa,%edi
call   1030 <_putchar@plt>
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 <_putchar@plt>
mov    $0xa,%edi
call   1030 <_putchar@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 <_putchar@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 <_putchar@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 sgt i32 %5, 0
br i1 %6, label %7, label %29
7: ; preds = %1
store i32 0, i32* %3
br label %8
8: ; preds = %25, %7
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %28
12: ; preds = %8
store i32 0, i32* %4
br label %13
13: ; preds = %19, %12
%14 = load i32, i32* %4
%15 = load i32, i32* %3
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = call i32 @_putchar(i8 signext 32)
br label %19
19: ; preds = %17
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %13
22: ; preds = %13
%23 = call i32 @_putchar(i8 signext 92)
%24 = call i32 @_putchar(i8 signext 10)
br label %25
25: ; preds = %22
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %8
28: ; preds = %8
br label %31
29: ; preds = %1
%30 = call i32 @_putchar(i8 signext 10)
br label %31
31: ; preds = %29, %28
ret void
}

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