#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 */
char *malloc(int);
int /*<<< orphan*/ oldgaa_gl__fout_of_memory(char *, int);
int strlen(char const *);
char *get_value(int *jj, const char *cond, const char delimiter) {
  int i, j = *jj, length = strlen(cond);
  char *str = NULL;
  str = malloc(length + 1);
  if (!str)
    oldgaa_gl__fout_of_memory(
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/ellert/globus-toolkit/refs/heads/"
        "globus_6_branch/gsi/callback/source/library/oldgaa/"
        "oldgaa_policy_evaluator.c",
        857);
  ;
  for (i = 0; j <= length; i++) {
    str[i] = cond[j];
    j++;
    if ((cond[j] == delimiter)) {
      j++;
      break;
    }
  }
  str[i + 1] = '\0';
  *jj = j;
  return str;
}


x86 assembly (clang, -O0):
<get_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x20(%rbp),%edi
add    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    118d <get_value+0x5d>
lea    0xe7d(%rip),%rdi
mov    $0x359,%esi
call   1040 <oldgaa_gl__fout_of_memory@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     11f8 <get_value+0xc8>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    11e5 <get_value+0xb5>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11f8 <get_value+0xc8>
jmp    11ea <get_value+0xba>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1194 <get_value+0x64>
mov    -0x28(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x1c(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_value>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%r12
mov    %rdi,(%rsp)
mov    (%rdi),%r14d
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %eax,%r13d
lea    0x1(%r13),%ebx
mov    %ebx,%edi
call   1050 <malloc@plt>
mov    %rax,%r15
test   %rax,%rax
je     116e <get_value+0x3e>
cmp    %r13d,%r14d
jle    1184 <get_value+0x54>
xor    %ebx,%ebx
jmp    11c9 <get_value+0x99>
lea    0xe8b(%rip),%rdi
mov    $0x359,%esi
call   1040 <oldgaa_gl__fout_of_memory@plt>
cmp    %r13d,%r14d
jg     116a <get_value+0x3a>
movslq %r14d,%rax
sub    %r14d,%ebx
mov    (%r12,%rax,1),%dl
lea    (%r12,%rax,1),%rcx
add    $0x1,%rcx
xor    %eax,%eax
xor    %esi,%esi
nopw   0x0(%rax,%rax,1)
mov    %dl,(%r15,%rsi,1)
movzbl (%rcx,%rsi,1),%edx
cmp    %bpl,%dl
je     11be <get_value+0x8e>
add    $0x1,%rsi
add    $0xffffffff,%eax
cmp    %rsi,%rbx
jne    11a0 <get_value+0x70>
sub    %eax,%r14d
jmp    11c9 <get_value+0x99>
sub    %eax,%r14d
neg    %eax
add    $0x2,%r14d
mov    %eax,%ebx
mov    %ebx,%eax
movb   $0x0,0x1(%rax,%r15,1)
mov    (%rsp),%rax
mov    %r14d,(%rax)
mov    %r15,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [200 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ellert/globus-toolkit/refs/heads/globus_6_branch/gsi/callback/source/library/oldgaa/oldgaa_policy_evaluator.c\00"
define i8* @get_value(i32* %0, i8* %1, i8 signext %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
store i32* %0, i32** %4
store i8* %1, i8** %5
store i8 %2, i8* %6
%11 = load i32*, i32** %4
%12 = load i32, i32* %11
store i32 %12, i32* %8
%13 = load i8*, i8** %5
%14 = call i32 @strlen(i8* %13)
store i32 %14, i32* %9
store i8* null, i8** %10
%15 = load i32, i32* %9
%16 = add nsw i32 %15, 1
%17 = call i8* @malloc(i32 %16)
store i8* %17, i8** %10
%18 = load i8*, i8** %10
%19 = icmp ne i8* %18, null
br i1 %19, label %22, label %20
20: ; preds = %3
%21 = call i32 @oldgaa_gl__fout_of_memory(i8* getelementptr inbounds ([200 x i8], [200 x i8]* @.str, i64 0, i64 0), i32 857)
br label %22
22: ; preds = %20, %3
store i32 0, i32* %7
br label %23
23: ; preds = %52, %22
%24 = load i32, i32* %8
%25 = load i32, i32* %9
%26 = icmp sle i32 %24, %25
br i1 %26, label %27, label %55
27: ; preds = %23
%28 = load i8*, i8** %5
%29 = load i32, i32* %8
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = load i8, i8* %31
%33 = load i8*, i8** %10
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %33, i64 %35
store i8 %32, i8* %36
%37 = load i32, i32* %8
%38 = add nsw i32 %37, 1
store i32 %38, i32* %8
%39 = load i8*, i8** %5
%40 = load i32, i32* %8
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %39, i64 %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = load i8, i8* %6
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %44, %46
br i1 %47, label %48, label %51
48: ; preds = %27
%49 = load i32, i32* %8
%50 = add nsw i32 %49, 1
store i32 %50, i32* %8
br label %55
51: ; preds = %27
br label %52
52: ; preds = %51
%53 = load i32, i32* %7
%54 = add nsw i32 %53, 1
store i32 %54, i32* %7
br label %23
55: ; preds = %48, %23
%56 = load i8*, i8** %10
%57 = load i32, i32* %7
%58 = add nsw i32 %57, 1
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8, i8* %56, i64 %59
store i8 0, i8* %60
%61 = load i32, i32* %8
%62 = load i32*, i32** %4
store i32 %61, i32* %62
%63 = load i8*, i8** %10
ret i8* %63
}

LLVM IR (-O2):
@.str = [200 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ellert/globus-toolkit/refs/heads/globus_6_branch/gsi/callback/source/library/oldgaa/oldgaa_policy_evaluator.c\00"
define noalias i8* @get_value(i32* nocapture %0, i8* %1, i8 signext %2) {
%4 = load i32, i32* %0
%5 = tail call i32 @strlen(i8* %1)
%6 = add i32 %5, 1
%7 = tail call i8* @malloc(i32 %6)
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = tail call i32 @oldgaa_gl__fout_of_memory(i8* getelementptr inbounds ([200 x i8], [200 x i8]* @.str, i64 0, i64 0), i32 857)
br label %11
11: ; preds = %9, %3
%12 = icmp sgt i32 %4, %5
br i1 %12, label %37, label %13
13: ; preds = %11
%14 = sext i32 %4 to i64
%15 = sub i32 %6, %4
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %1, i64 %14
%18 = load i8, i8* %17
br label %19
19: ; preds = %13, %32
%20 = phi i8 [ %18, %13 ], [ %26, %32 ]
%21 = phi i64 [ %14, %13 ], [ %24, %32 ]
%22 = phi i64 [ 0, %13 ], [ %33, %32 ]
%23 = getelementptr inbounds i8, i8* %7, i64 %22
store i8 %20, i8* %23
%24 = add nsw i64 %21, 1
%25 = getelementptr inbounds i8, i8* %1, i64 %24
%26 = load i8, i8* %25
%27 = icmp eq i8 %26, %2
br i1 %27, label %28, label %32
28: ; preds = %19
%29 = trunc i64 %21 to i32
%30 = trunc i64 %22 to i32
%31 = add nsw i32 %29, 2
br label %37
32: ; preds = %19
%33 = add nuw nsw i64 %22, 1
%34 = icmp eq i64 %33, %16
br i1 %34, label %35, label %19
35: ; preds = %32
%36 = trunc i64 %24 to i32
br label %37
37: ; preds = %35, %11, %28
%38 = phi i32 [ %30, %28 ], [ 0, %11 ], [ %15, %35 ]
%39 = phi i32 [ %31, %28 ], [ %4, %11 ], [ %36, %35 ]
%40 = add nuw nsw i32 %38, 1
%41 = zext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %7, i64 %41
store i8 0, i8* %42
store i32 %39, i32* %0
ret i8* %7
}