#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void ighmm_dvector_print(FILE *file, int *vector, int len, char *tab,
                         char *separator, char *ending) {
  int j;
  fprintf(file, "%s", tab);
  if (len > 0)
    fprintf(file, "%3d", vector[0]);
  for (j = 1; j < len; j++)
    fprintf(file, "%s %3d", separator, vector[j]);
  fprintf(file, "%s\n", ending);
}


x86 assembly (clang, -O0):
<ighmm_dvector_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xec2(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpl   $0x0,-0x14(%rbp)
jle    1167 <ighmm_dvector_print+0x57>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xea6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11a9 <ighmm_dvector_print+0x99>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xe6f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    116e <ighmm_dvector_print+0x5e>
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rdx
lea    0xe52(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ighmm_dvector_print>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,(%rsp)
mov    %r8,%r15
mov    %edx,%ebp
mov    %rsi,%r12
mov    %rdi,%rbx
mov    %rcx,%rdi
mov    %rbx,%rsi
call   1030 <fputs@plt>
test   %ebp,%ebp
jle    119d <ighmm_dvector_print+0x7d>
mov    (%r12),%edx
lea    0xeaf(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <fprintf@plt>
cmp    $0x1,%ebp
je     119d <ighmm_dvector_print+0x7d>
mov    %ebp,%ebp
mov    $0x1,%r14d
lea    0xe8e(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r12,%r14,4),%ecx
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
add    $0x1,%r14
cmp    %r14,%rbp
jne    1180 <ighmm_dvector_print+0x60>
lea    0xe63(%rip),%rsi
mov    %rbx,%rdi
mov    (%rsp),%rdx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fprintf@plt>

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

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%3d\00"
@.str.2 = [7 x i8] c"%s %3d\00"
@.str.3 = [4 x i8] c"%s\0A\00"
define void @ighmm_dvector_print(i32* nocapture %0, i32* nocapture %1, i32 %2, i8* nocapture %3, i8* %4, i8* %5) {
%7 = tail call i32 @fputs(i8* %3, i32* %0)
%8 = icmp sgt i32 %2, 0
br i1 %8, label %9, label %22
9: ; preds = %6
%10 = load i32, i32* %1
%11 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = icmp eq i32 %2, 1
br i1 %12, label %22, label %13
13: ; preds = %9
%14 = zext i32 %2 to i64
br label %15
15: ; preds = %13, %15
%16 = phi i64 [ 1, %13 ], [ %20, %15 ]
%17 = getelementptr inbounds i32, i32* %1, i64 %16
%18 = load i32, i32* %17
%19 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %4, i32 %18)
%20 = add nuw nsw i64 %16, 1
%21 = icmp eq i64 %20, %14
br i1 %21, label %22, label %15
22: ; preds = %15, %6, %9
%23 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %5)
ret void
}