#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 *flon_conf_string(char *, int /*<<< orphan*/ *);
char *flu_sprintf(char *, char *, char *);
int /*<<< orphan*/ free(char *);
char *strdup(char *);
char *flon_conf_uid() {
  char *gid = flon_conf_string("unit.gid", NULL);
  char *uid = flon_conf_string("unit.id", NULL);
  if (gid == NULL && uid == NULL)
    return strdup("u0");
  if (gid == NULL)
    return uid;
  char *r = flu_sprintf("%s.%s", gid, uid);
  free(gid);
  free(uid);
  return r;
}


x86 assembly (clang, -O0):
<flon_conf_uid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <flon_conf_string@plt>
mov    %rax,-0x10(%rbp)
lea    0xea6(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <flon_conf_string@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    119b <flon_conf_uid+0x5b>
cmpq   $0x0,-0x18(%rbp)
jne    119b <flon_conf_uid+0x5b>
lea    0xe84(%rip),%rdi
call   1060 <strdup@plt>
mov    %rax,-0x8(%rbp)
jmp    11e5 <flon_conf_uid+0xa5>
cmpq   $0x0,-0x10(%rbp)
jne    11b3 <flon_conf_uid+0x73>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11e5 <flon_conf_uid+0xa5>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe52(%rip),%rdi
call   1040 <flu_sprintf@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flon_conf_uid>:
push   %r15
push   %r14
push   %rbx
lea    0xeb4(%rip),%rdi
xor    %esi,%esi
call   1050 <flon_conf_string@plt>
mov    %rax,%rbx
lea    0xeac(%rip),%rdi
xor    %esi,%esi
call   1050 <flon_conf_string@plt>
mov    %rax,%r14
mov    %rbx,%rax
or     %r14,%rax
jne    1180 <flon_conf_uid+0x40>
lea    0xe9b(%rip),%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1060 <strdup@plt>
test   %rbx,%rbx
je     11af <flon_conf_uid+0x6f>
lea    0xe88(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <flu_sprintf@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rax
jmp    11b2 <flon_conf_uid+0x72>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [9 x i8] c"unit.gid\00"
@.str.1 = [8 x i8] c"unit.id\00"
@.str.2 = [3 x i8] c"u0\00"
@.str.3 = [6 x i8] c"%s.%s\00"
define i8* @flon_conf_uid() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = call i8* @flon_conf_string(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* null)
store i8* %5, i8** %2
%6 = call i8* @flon_conf_string(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32* null)
store i8* %6, i8** %3
%7 = load i8*, i8** %2
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %14
9: ; preds = %0
%10 = load i8*, i8** %3
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i8* @strdup(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i8* %13, i8** %1
br label %28
14: ; preds = %9, %0
%15 = load i8*, i8** %2
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = load i8*, i8** %3
store i8* %18, i8** %1
br label %28
19: ; preds = %14
%20 = load i8*, i8** %2
%21 = load i8*, i8** %3
%22 = call i8* @flu_sprintf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %20, i8* %21)
store i8* %22, i8** %4
%23 = load i8*, i8** %2
%24 = call i32 @free(i8* %23)
%25 = load i8*, i8** %3
%26 = call i32 @free(i8* %25)
%27 = load i8*, i8** %4
store i8* %27, i8** %1
br label %28
28: ; preds = %19, %17, %12
%29 = load i8*, i8** %1
ret i8* %29
}

LLVM IR (-O2):
@.str = [9 x i8] c"unit.gid\00"
@.str.1 = [8 x i8] c"unit.id\00"
@.str.2 = [3 x i8] c"u0\00"
@.str.3 = [6 x i8] c"%s.%s\00"
define i8* @flon_conf_uid() {
%1 = tail call i8* @flon_conf_string(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* null)
%2 = tail call i8* @flon_conf_string(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32* null)
%3 = icmp eq i8* %1, null
%4 = icmp eq i8* %2, null
%5 = select i1 %3, i1 %4, i1 false
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = tail call dereferenceable_or_null(3) i8* @strdup(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %13
8: ; preds = %0
br i1 %3, label %13, label %9
9: ; preds = %8
%10 = tail call i8* @flu_sprintf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %1, i8* %2)
%11 = tail call i32 @free(i8* %1)
%12 = tail call i32 @free(i8* %2)
br label %13
13: ; preds = %8, %9, %6
%14 = phi i8* [ %7, %6 ], [ %10, %9 ], [ %2, %8 ]
ret i8* %14
}