#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_distances(int numObjects, int *distances) {
  char spaces[40];
  int i;
  int j;
  int current_distance = 0;
  printf("\n\n\n\n|->> ");
  for (i = 0; i < numObjects; i++) {
    for (j = 0; j < distances[i] - current_distance - 1; j++) {
      spaces[j] = '-';
    }
    current_distance = current_distance + j + 1;
    spaces[j] = '*';
    spaces[j + 1] = '\0';
    printf("%s", spaces);
  }
  printf("\n\n\n\n");
}


x86 assembly (clang, -O0):
<print_distances>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x4c(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11c3 <print_distances+0xb3>
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x44(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
sub    -0x4c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1181 <print_distances+0x71>
movslq -0x48(%rbp),%rax
movb   $0x2d,-0x40(%rbp,%rax,1)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    114e <print_distances+0x3e>
mov    -0x4c(%rbp),%eax
add    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
movslq -0x48(%rbp),%rax
movb   $0x2a,-0x40(%rbp,%rax,1)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
cltq
movb   $0x0,-0x40(%rbp,%rax,1)
lea    -0x40(%rbp),%rsi
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    113b <print_distances+0x2b>
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_distances>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r12
mov    %edi,%ebx
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
jle    11cb <print_distances+0x9b>
mov    %ebx,%r13d
mov    %rsp,%r14
xor    %ebp,%ebp
xor    %r15d,%r15d
jmp    11b8 <print_distances+0x88>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
sub    %r15d,%ebx
add    $0xfffffffe,%ebx
add    $0x1,%rbx
mov    %r14,%rdi
mov    $0x2d,%esi
mov    %rbx,%rdx
call   1050 <memset@plt>
lea    0x1(%rbx),%eax
add    %ebx,%r15d
add    $0x1,%r15d
mov    %ebx,%ecx
movb   $0x2a,(%rsp,%rcx,1)
movb   $0x0,(%rsp,%rax,1)
lea    0xe65(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
je     11cb <print_distances+0x9b>
mov    (%r12,%rbp,4),%ebx
mov    %r15d,%eax
not    %eax
add    %ebx,%eax
test   %eax,%eax
jg     1170 <print_distances+0x40>
xor    %ebx,%ebx
jmp    118a <print_distances+0x5a>
lea    0xe3b(%rip),%rdi
call   1030 <puts@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"\0A\0A\0A\0A|->> \00"
@.str.1 = [3 x i8] c"%s\00"
@str = [4 x i8] c"\0A\0A\0A\00"
define void @print_distances(i32 %0, i32* nocapture %1) {
%3 = alloca [40 x i8]
%4 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 0
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%7 = icmp sgt i32 %0, 0
br i1 %7, label %8, label %35
8: ; preds = %2
%9 = zext i32 %0 to i64
br label %10
10: ; preds = %8, %24
%11 = phi i64 [ 0, %8 ], [ %33, %24 ]
%12 = phi i32 [ 0, %8 ], [ %27, %24 ]
%13 = getelementptr inbounds i32, i32* %1, i64 %11
%14 = load i32, i32* %13
%15 = xor i32 %12, -1
%16 = add i32 %14, %15
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %10
%19 = add i32 %14, -2
%20 = sub i32 %19, %12
%21 = zext i32 %20 to i64
%22 = add nuw nsw i64 %21, 1
%23 = trunc i64 %22 to i32
br label %24
24: ; preds = %18, %10
%25 = phi i32 [ 0, %10 ], [ %23, %18 ]
%26 = add i32 %25, 1
%27 = add i32 %26, %12
%28 = zext i32 %25 to i64
%29 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 %28
store i8 42, i8* %29
%30 = zext i32 %26 to i64
%31 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 %30
store i8 0, i8* %31
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%33 = add nuw nsw i64 %11, 1
%34 = icmp eq i64 %33, %9
br i1 %34, label %35, label %10
35: ; preds = %24, %2
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret void
}