#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*/ _CS_PATH;
size_t confstr(int /*<<< orphan*/, char *, size_t);
int /*<<< orphan*/ exit(int);
char *malloc(int);
int /*<<< orphan*/ write(int, char *, size_t);
int main(int argc, char *argv[]) {
  char *path;
  size_t len;
  len = confstr(_CS_PATH, (char *)NULL, 0);
  if (!(path = malloc(1 + len)))
    do {
      write(2, "malloc...\n", sizeof("malloc...\n") - 1);
      exit(1);
    } while (0);
  path[0] = ':';
  confstr(_CS_PATH, path + 1, len);
  write(1, path, len);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1050 <confstr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11b1 <main+0x71>
jmp    1191 <main+0x51>
mov    $0x2,%edi
lea    0xe63(%rip),%rsi
mov    $0xa,%edx
call   1030 <write@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x18(%rbp),%rax
movb   $0x3a,(%rax)
mov    0x2e29(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rsi
add    $0x1,%rsi
mov    -0x20(%rbp),%rdx
call   1050 <confstr@plt>
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    $0x1,%edi
call   1030 <write@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    0x2e9c(%rip),%r15
mov    (%r15),%edi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <confstr@plt>
mov    %rax,%r14
lea    0x1(%rax),%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1198 <main+0x58>
mov    %rax,%rbx
movb   $0x3a,(%rax)
mov    (%r15),%edi
mov    %rax,%rsi
add    $0x1,%rsi
mov    %r14,%rdx
call   1050 <confstr@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <write@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe61(%rip),%rsi
mov    $0xa,%edx
mov    $0x2,%edi
call   1030 <write@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@_CS_PATH = global i32 0
@.str = [11 x i8] c"malloc...\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* @_CS_PATH
%9 = call i64 @confstr(i32 %8, i8* null, i64 0)
store i64 %9, i64* %7
%10 = load i64, i64* %7
%11 = add i64 1, %10
%12 = trunc i64 %11 to i32
%13 = call i8* @malloc(i32 %12)
store i8* %13, i8** %6
%14 = icmp ne i8* %13, null
br i1 %14, label %20, label %15
15: ; preds = %2
br label %16
16: ; preds = %15
%17 = call i32 @write(i32 2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64 10)
%18 = call i32 @exit(i32 1)
unreachable
19: ; No predecessors!
br label %20
20: ; preds = %19, %2
%21 = load i8*, i8** %6
%22 = getelementptr inbounds i8, i8* %21, i64 0
store i8 58, i8* %22
%23 = load i32, i32* @_CS_PATH
%24 = load i8*, i8** %6
%25 = getelementptr inbounds i8, i8* %24, i64 1
%26 = load i64, i64* %7
%27 = call i64 @confstr(i32 %23, i8* %25, i64 %26)
%28 = load i8*, i8** %6
%29 = load i64, i64* %7
%30 = call i32 @write(i32 1, i8* %28, i64 %29)
ret i32 0
}

LLVM IR (-O2):
@_CS_PATH = global i32 0
@.str = [11 x i8] c"malloc...\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @_CS_PATH
%4 = tail call i64 @confstr(i32 %3, i8* null, i64 0)
%5 = trunc i64 %4 to i32
%6 = add i32 %5, 1
%7 = tail call i8* @malloc(i32 %6)
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = tail call i32 @write(i32 2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64 10)
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %2
store i8 58, i8* %7
%13 = load i32, i32* @_CS_PATH
%14 = getelementptr inbounds i8, i8* %7, i64 1
%15 = tail call i64 @confstr(i32 %13, i8* %14, i64 %4)
%16 = tail call i32 @write(i32 1, i8* %7, i64 %4)
ret i32 0
}