#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*/ chunk;

/* Variables and functions */
scalar_t__ probe_ro_dir(char *);
const char *get_platform_ro_dir(void) {
  static char chunk[512];
  static const char *ro_dir = "";
  const char *src = ro_dir;
  while (*src) {
    char *dst = chunk;
    int skip = 0;
    do {
      *dst = *src;
      if (!*dst)
        break;
      if (*src++ == ',') {
        *dst = '\0';
        break;
      }
      dst += 1;
    } while (!(skip = dst == chunk + sizeof(chunk)));
    if (skip) {
      while (*src)
        if (*src++ == ',')
          break;
      continue;
    }
    if (probe_ro_dir(chunk))
      return chunk;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<get_platform_ro_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2f09(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     122d <get_platform_ro_dir+0x11d>
lea    0x2f09(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1160 <get_platform_ro_dir+0x50>
jmp    11bc <get_platform_ro_dir+0xac>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
cmp    $0x2c,%eax
jne    1187 <get_platform_ro_dir+0x77>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
jmp    11bc <get_platform_ro_dir+0xac>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
lea    0x2ea6(%rip),%rax
add    $0x200,%rax
cmp    %rax,-0x18(%rbp)
sete   %al
mov    %al,%cl
and    $0x1,%cl
movzbl %cl,%ecx
mov    %ecx,-0x1c(%rbp)
xor    $0xff,%al
test   $0x1,%al
jne    1142 <get_platform_ro_dir+0x32>
cmpl   $0x0,-0x1c(%rbp)
je     1202 <get_platform_ro_dir+0xf2>
jmp    11cb <get_platform_ro_dir+0xbb>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11fd <get_platform_ro_dir+0xed>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
cmp    $0x2c,%eax
jne    11f8 <get_platform_ro_dir+0xe8>
jmp    11fd <get_platform_ro_dir+0xed>
jmp    11cb <get_platform_ro_dir+0xbb>
jmp    1123 <get_platform_ro_dir+0x13>
lea    0x2e37(%rip),%rdi
call   1030 <probe_ro_dir@plt>
cmp    $0x0,%rax
je     1228 <get_platform_ro_dir+0x118>
lea    0x2e21(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1235 <get_platform_ro_dir+0x125>
jmp    1123 <get_platform_ro_dir+0x13>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_platform_ro_dir>:
xor    %eax,%eax
ret

LLVM IR (-O0):
@get_platform_ro_dir.chunk = internal global [512 x i8] zeroinitializer
@get_platform_ro_dir.ro_dir = internal global i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i32 0, i32 0)
@.str = [1 x i8] zeroinitializer
define i8* @get_platform_ro_dir() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = load i8*, i8** @get_platform_ro_dir.ro_dir
store i8* %5, i8** %2
br label %6
6: ; preds = %56, %51, %0
%7 = load i8*, i8** %2
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %57
10: ; preds = %6
store i8* getelementptr inbounds ([512 x i8], [512 x i8]* @get_platform_ro_dir.chunk, i64 0, i64 0), i8** %3
store i32 0, i32* %4
br label %11
11: ; preds = %30, %10
%12 = load i8*, i8** %2
%13 = load i8, i8* %12
%14 = load i8*, i8** %3
store i8 %13, i8* %14
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = icmp ne i8 %16, 0
br i1 %17, label %19, label %18
18: ; preds = %11
br label %35
19: ; preds = %11
%20 = load i8*, i8** %2
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %2
%22 = load i8, i8* %20
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 44
br i1 %24, label %25, label %27
25: ; preds = %19
%26 = load i8*, i8** %3
store i8 0, i8* %26
br label %35
27: ; preds = %19
%28 = load i8*, i8** %3
%29 = getelementptr inbounds i8, i8* %28, i64 1
store i8* %29, i8** %3
br label %30
30: ; preds = %27
%31 = load i8*, i8** %3
%32 = icmp eq i8* %31, getelementptr inbounds ([512 x i8], [512 x i8]* @get_platform_ro_dir.chunk, i64 1, i64 0)
%33 = zext i1 %32 to i32
store i32 %33, i32* %4
%34 = xor i1 %32, true
br i1 %34, label %11, label %35
35: ; preds = %30, %25, %18
%36 = load i32, i32* %4
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %52
38: ; preds = %35
br label %39
39: ; preds = %50, %38
%40 = load i8*, i8** %2
%41 = load i8, i8* %40
%42 = icmp ne i8 %41, 0
br i1 %42, label %43, label %51
43: ; preds = %39
%44 = load i8*, i8** %2
%45 = getelementptr inbounds i8, i8* %44, i32 1
store i8* %45, i8** %2
%46 = load i8, i8* %44
%47 = sext i8 %46 to i32
%48 = icmp eq i32 %47, 44
br i1 %48, label %49, label %50
49: ; preds = %43
br label %51
50: ; preds = %43
br label %39
51: ; preds = %49, %39
br label %6
52: ; preds = %35
%53 = call i64 @probe_ro_dir(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @get_platform_ro_dir.chunk, i64 0, i64 0))
%54 = icmp ne i64 %53, 0
br i1 %54, label %55, label %56
55: ; preds = %52
store i8* getelementptr inbounds ([512 x i8], [512 x i8]* @get_platform_ro_dir.chunk, i64 0, i64 0), i8** %1
br label %58
56: ; preds = %52
br label %6
57: ; preds = %6
store i8* null, i8** %1
br label %58
58: ; preds = %57, %55
%59 = load i8*, i8** %1
ret i8* %59
}

LLVM IR (-O2):
define noalias i8* @get_platform_ro_dir() {
ret i8* null
}