char *id_format_and_copy(struct dm_pool *mem, const struct id *id) {
  char *repstr = ((void *)0);
  if (!(repstr = dm_pool_alloc(mem, 40))) {
    print_log(3, "uuid/uuid.c", 216, -1, "dm_pool_alloc failed");
    return ((void *)0);
  }
  if (!id_write_format(id, repstr, 40))
    do {
      print_log(7, "uuid/uuid.c", 221, 0, "<backtrace>");
      return ((void *)0);
    } while (0);
  return repstr;
}


x86 assembly (clang, -O0):
<id_format_and_copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x28,%esi
mov    $0x0,%al
call   1040 <dm_pool_alloc@plt>
cltq
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1199 <id_format_and_copy+0x69>
mov    $0x3,%edi
lea    0xe8c(%rip),%rsi
mov    $0xd8,%edx
mov    $0xffffffff,%ecx
lea    0xe87(%rip),%r8
mov    $0x0,%al
call   1030 <print_log@plt>
movq   $0x0,-0x8(%rbp)
jmp    11f1 <id_format_and_copy+0xc1>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x28,%edx
mov    $0x0,%al
call   1050 <id_write_format@plt>
cmp    $0x0,%eax
jne    11e9 <id_format_and_copy+0xb9>
jmp    11bb <id_format_and_copy+0x8b>
mov    $0x7,%edi
lea    0xe39(%rip),%rsi
mov    $0xdd,%edx
xor    %ecx,%ecx
lea    0xe4c(%rip),%r8
mov    $0x0,%al
call   1030 <print_log@plt>
movq   $0x0,-0x8(%rbp)
jmp    11f1 <id_format_and_copy+0xc1>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<id_format_and_copy>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    $0x28,%esi
xor    %eax,%eax
call   1040 <dm_pool_alloc@plt>
test   %eax,%eax
je     117e <id_format_and_copy+0x4e>
movslq %eax,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x28,%edx
xor    %eax,%eax
call   1050 <id_write_format@plt>
test   %eax,%eax
jne    11a4 <id_format_and_copy+0x74>
lea    0xe99(%rip),%rsi
lea    0xeb3(%rip),%r8
xor    %ebx,%ebx
mov    $0x7,%edi
mov    $0xdd,%edx
xor    %ecx,%ecx
jmp    119d <id_format_and_copy+0x6d>
lea    0xe7b(%rip),%rsi
lea    0xe80(%rip),%r8
xor    %ebx,%ebx
mov    $0x3,%edi
mov    $0xd8,%edx
mov    $0xffffffff,%ecx
xor    %eax,%eax
call   1030 <print_log@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.dm_pool = type opaque
%struct.id = type opaque
@.str = [12 x i8] c"uuid/uuid.c\00"
@.str.1 = [21 x i8] c"dm_pool_alloc failed\00"
@.str.2 = [12 x i8] c"<backtrace>\00"
define i8* @id_format_and_copy(%struct.dm_pool* %0, %struct.id* %1) {
%3 = alloca i8*
%4 = alloca %struct.dm_pool*
%5 = alloca %struct.id*
%6 = alloca i8*
store %struct.dm_pool* %0, %struct.dm_pool** %4
store %struct.id* %1, %struct.id** %5
store i8* null, i8** %6
%7 = load %struct.dm_pool*, %struct.dm_pool** %4
%8 = call i32 (%struct.dm_pool*, i32, ...) bitcast (i32 (...)* @dm_pool_alloc to i32 (%struct.dm_pool*, i32, ...)*)(%struct.dm_pool* %7, i32 40)
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %6
%11 = icmp ne i8* %10, null
br i1 %11, label %14, label %12
12: ; preds = %2
%13 = call i32 (i32, i8*, i32, i32, i8*, ...) bitcast (i32 (...)* @print_log to i32 (i32, i8*, i32, i32, i8*, ...)*)(i32 3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 216, i32 -1, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
store i8* null, i8** %3
br label %25
14: ; preds = %2
%15 = load %struct.id*, %struct.id** %5
%16 = load i8*, i8** %6
%17 = call i32 (%struct.id*, i8*, i32, ...) bitcast (i32 (...)* @id_write_format to i32 (%struct.id*, i8*, i32, ...)*)(%struct.id* %15, i8* %16, i32 40)
%18 = icmp ne i32 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %14
br label %20
20: ; preds = %19
%21 = call i32 (i32, i8*, i32, i32, i8*, ...) bitcast (i32 (...)* @print_log to i32 (i32, i8*, i32, i32, i8*, ...)*)(i32 7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 221, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
store i8* null, i8** %3
br label %25
22: ; No predecessors!
br label %23
23: ; preds = %22, %14
%24 = load i8*, i8** %6
store i8* %24, i8** %3
br label %25
25: ; preds = %23, %20, %12
%26 = load i8*, i8** %3
ret i8* %26
}

LLVM IR (-O2):
%struct.dm_pool = type opaque
%struct.id = type opaque
@.str = [12 x i8] c"uuid/uuid.c\00"
@.str.1 = [21 x i8] c"dm_pool_alloc failed\00"
@.str.2 = [12 x i8] c"<backtrace>\00"
define i8* @id_format_and_copy(%struct.dm_pool* %0, %struct.id* %1) {
%3 = tail call i32 (%struct.dm_pool*, i32, ...) bitcast (i32 (...)* @dm_pool_alloc to i32 (%struct.dm_pool*, i32, ...)*)(%struct.dm_pool* %0, i32 40)
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
%6 = icmp eq i32 %3, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 (i32, i8*, i32, i32, i8*, ...) bitcast (i32 (...)* @print_log to i32 (i32, i8*, i32, i32, i8*, ...)*)(i32 3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 216, i32 -1, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %14
9: ; preds = %2
%10 = tail call i32 (%struct.id*, i8*, i32, ...) bitcast (i32 (...)* @id_write_format to i32 (%struct.id*, i8*, i32, ...)*)(%struct.id* %1, i8* %5, i32 40)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = tail call i32 (i32, i8*, i32, i32, i8*, ...) bitcast (i32 (...)* @print_log to i32 (i32, i8*, i32, i32, i8*, ...)*)(i32 7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 221, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %14
14: ; preds = %9, %12, %7
%15 = phi i8* [ null, %12 ], [ null, %7 ], [ %5, %9 ]
ret i8* %15
}