#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*/ free(char *);
char *get_next_indexing(char *, size_t *);
char *get_indexing(char *buf, char *expression, size_t *offset) {
  char *i, *b, *indexing;
  *offset = 0;
  indexing = get_next_indexing(expression, offset);
  for (i = indexing, b = buf; *i != 0; i++, b++)
    *b = *i;
  free(indexing);
  return b;
}


x86 assembly (clang, -O0):
<get_indexing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <get_next_indexing@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1199 <get_indexing+0x79>
mov    -0x20(%rbp),%rax
mov    (%rax),%cl
mov    -0x28(%rbp),%rax
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1160 <get_indexing+0x40>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_indexing>:
push   %rbx
mov    %rdi,%rbx
movq   $0x0,(%rdx)
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1040 <get_next_indexing@plt>
mov    (%rax),%cl
test   %cl,%cl
je     1161 <get_indexing+0x41>
mov    %rax,%rdx
add    $0x1,%rdx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %cl,(%rbx)
add    $0x1,%rbx
movzbl (%rdx),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1150 <get_indexing+0x30>
mov    %rax,%rdi
call   1030 <free@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @get_indexing(i8* %0, i8* %1, i64* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64* %2, i64** %6
%10 = load i64*, i64** %6
store i64 0, i64* %10
%11 = load i8*, i8** %5
%12 = load i64*, i64** %6
%13 = call i8* @get_next_indexing(i8* %11, i64* %12)
store i8* %13, i8** %9
%14 = load i8*, i8** %9
store i8* %14, i8** %7
%15 = load i8*, i8** %4
store i8* %15, i8** %8
br label %16
16: ; preds = %25, %3
%17 = load i8*, i8** %7
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %30
21: ; preds = %16
%22 = load i8*, i8** %7
%23 = load i8, i8* %22
%24 = load i8*, i8** %8
store i8 %23, i8* %24
br label %25
25: ; preds = %21
%26 = load i8*, i8** %7
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %7
%28 = load i8*, i8** %8
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %8
br label %16
30: ; preds = %16
%31 = load i8*, i8** %9
%32 = call i32 @free(i8* %31)
%33 = load i8*, i8** %8
ret i8* %33
}

LLVM IR (-O2):
define i8* @get_indexing(i8* writeonly %0, i8* %1, i64* %2) {
store i64 0, i64* %2
%4 = tail call i8* @get_next_indexing(i8* %1, i64* %2)
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
br i1 %6, label %15, label %7
7: ; preds = %3, %7
%8 = phi i8 [ %13, %7 ], [ %5, %3 ]
%9 = phi i8* [ %11, %7 ], [ %4, %3 ]
%10 = phi i8* [ %12, %7 ], [ %0, %3 ]
store i8 %8, i8* %10
%11 = getelementptr inbounds i8, i8* %9, i64 1
%12 = getelementptr inbounds i8, i8* %10, i64 1
%13 = load i8, i8* %11
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %7
15: ; preds = %7, %3
%16 = phi i8* [ %0, %3 ], [ %12, %7 ]
%17 = tail call i32 @free(i8* %4)
ret i8* %16
}