#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 *);
void print_ruler(const unsigned int no_bytes) {
  int nibble = 0;
  printf("     ");
  for (nibble = (int)no_bytes; nibble; nibble--) {
    printf("^---+---");
    if (nibble == 5)
      printf("   ");
  }
  printf("\n\n");
}


x86 assembly (clang, -O0):
<print_ruler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1173 <print_ruler+0x63>
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x5,-0x8(%rbp)
jne    1160 <print_ruler+0x50>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
jmp    1165 <print_ruler+0x55>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1134 <print_ruler+0x24>
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_ruler>:
push   %r15
push   %r14
push   %rbx
mov    %edi,%ebx
lea    0xed2(%rip),%rdi
call   1040 <printf@plt>
test   %ebx,%ebx
je     116c <print_ruler+0x4c>
lea    0xec8(%rip),%r14
lea    0xebd(%rip),%r15
jmp    1155 <print_ruler+0x35>
nopw   0x0(%rax,%rax,1)
add    $0xffffffff,%ebx
je     116c <print_ruler+0x4c>
mov    %r14,%rdi
call   1040 <printf@plt>
cmp    $0x5,%ebx
jne    1150 <print_ruler+0x30>
mov    %r15,%rdi
call   1040 <printf@plt>
jmp    1150 <print_ruler+0x30>
lea    0xe9c(%rip),%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [6 x i8] c" \00"
@.str.1 = [9 x i8] c"^---+---\00"
@.str.2 = [4 x i8] c" \00"
@.str.3 = [3 x i8] c"\0A\0A\00"
define void @print_ruler(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %2
store i32 %5, i32* %3
br label %6
6: ; preds = %16, %1
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 5
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %13, %9
br label %16
16: ; preds = %15
%17 = load i32, i32* %3
%18 = add nsw i32 %17, -1
store i32 %18, i32* %3
br label %6
19: ; preds = %6
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c" \00"
@.str.1 = [9 x i8] c"^---+---\00"
@.str.2 = [4 x i8] c" \00"
@str = [2 x i8] c"\0A\00"
define void @print_ruler(i32 %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %0, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %10
%5 = phi i32 [ %11, %10 ], [ %0, %1 ]
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32 %5, 5
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %4, %8
%11 = add nsw i32 %5, -1
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %10, %1
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}