#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 size_t int32_t;

/* Variables and functions */
int /*<<< orphan*/ _xstrfmtcat(char **, char *, size_t, size_t);
char *inx2bitfmt(int32_t *inx) {
  int32_t j = 0;
  char *bit_char_ptr = NULL;
  if (inx == NULL)
    return NULL;
  while (inx[j] >= 0) {
    if (bit_char_ptr)
      _xstrfmtcat(&(bit_char_ptr), ",%d-%d", inx[j], inx[j + 1]);
    else
      _xstrfmtcat(&(bit_char_ptr), "%d-%d", inx[j], inx[j + 1]);
    j += 2;
  }
  return bit_char_ptr;
}


x86 assembly (clang, -O0):
<inx2bitfmt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1144 <inx2bitfmt+0x34>
movq   $0x0,-0x8(%rbp)
jmp    11d7 <inx2bitfmt+0xc7>
jmp    1149 <inx2bitfmt+0x39>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jb     11cf <inx2bitfmt+0xbf>
cmpq   $0x0,-0x20(%rbp)
je     1195 <inx2bitfmt+0x85>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    0x8(%rax,%rcx,8),%rcx
lea    -0x20(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1030 <_xstrfmtcat@plt>
jmp    11be <inx2bitfmt+0xae>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    0x8(%rax,%rcx,8),%rcx
lea    -0x20(%rbp),%rdi
lea    0xe48(%rip),%rsi
call   1030 <_xstrfmtcat@plt>
mov    -0x18(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x18(%rbp)
jmp    1149 <inx2bitfmt+0x39>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inx2bitfmt>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movq   $0x0,(%rsp)
test   %rdi,%rdi
je     1163 <inx2bitfmt+0x53>
mov    %rdi,%rbx
add    $0x8,%rbx
xor    %eax,%eax
lea    0xecc(%rip),%r15
lea    0xec4(%rip),%r12
mov    %rsp,%r14
nop
test   %rax,%rax
mov    -0x8(%rbx),%rdx
mov    (%rbx),%rcx
mov    %r12,%rsi
cmove  %r15,%rsi
mov    %r14,%rdi
call   1030 <_xstrfmtcat@plt>
mov    (%rsp),%rax
add    $0x10,%rbx
jmp    1140 <inx2bitfmt+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c",%d-%d\00"
@.str.1 = [6 x i8] c"%d-%d\00"
define noalias i8* @inx2bitfmt(i64* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%4 = icmp eq i64* %0, null
br i1 %4, label %18, label %5
5: ; preds = %1, %5
%6 = phi i8* [ %17, %5 ], [ null, %1 ]
%7 = phi i64 [ %16, %5 ], [ 0, %1 ]
%8 = getelementptr inbounds i64, i64* %0, i64 %7
%9 = load i64, i64* %8
%10 = icmp eq i8* %6, null
%11 = or i64 %7, 1
%12 = getelementptr inbounds i64, i64* %0, i64 %11
%13 = load i64, i64* %12
%14 = select i1 %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
%15 = call i32 @_xstrfmtcat(i8** %2, i8* %14, i64 %9, i64 %13)
%16 = add i64 %7, 2
%17 = load i8*, i8** %2
br label %5
18: ; preds = %1
ret i8* null
}