#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 */
struct dbt {
  int dummy;
};

/* Variables and functions */
struct dbt *dbtgetnewest();
int /*<<< orphan*/ error(int, char *, ...);
struct dbt *timeparse(char const *);
struct dbt *timenewest(const char *stime) {
  struct dbt *dt;
  if (!stime || !stime[0]) {
    if (!(dt = dbtgetnewest()))
      error(1, "no time found in db");
  } else if (!(dt = timeparse(stime)))
    error(1, "unkown time: '%s'", stime);
  return dt;
}


x86 assembly (clang, -O0):
<timenewest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1154 <timenewest+0x24>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1181 <timenewest+0x51>
mov    $0x0,%al
call   1030 <dbtgetnewest@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    117c <timenewest+0x4c>
mov    $0x1,%edi
lea    0xe8b(%rip),%rsi
mov    $0x0,%al
call   1050 <error@plt>
jmp    11b4 <timenewest+0x84>
mov    -0x8(%rbp),%rdi
call   1040 <timeparse@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    11af <timenewest+0x7f>
mov    -0x8(%rbp),%rdx
mov    $0x1,%edi
lea    0xe6c(%rip),%rsi
mov    $0x0,%al
call   1050 <error@plt>
jmp    11b4 <timenewest+0x84>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timenewest>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     116c <timenewest+0x3c>
mov    %rdi,%rbx
cmpb   $0x0,(%rdi)
je     116c <timenewest+0x3c>
mov    %rbx,%rdi
call   1040 <timeparse@plt>
mov    %rax,%r14
test   %rax,%rax
jne    1191 <timenewest+0x61>
lea    0xebc(%rip),%rsi
xor    %r14d,%r14d
mov    $0x1,%edi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <error@plt>
jmp    1191 <timenewest+0x61>
xor    %eax,%eax
call   1030 <dbtgetnewest@plt>
mov    %rax,%r14
test   %rax,%rax
jne    1191 <timenewest+0x61>
lea    0xe7e(%rip),%rsi
xor    %r14d,%r14d
mov    $0x1,%edi
xor    %eax,%eax
call   1050 <error@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.dbt = type { i32 }
@.str = [20 x i8] c"no time found in db\00"
@.str.1 = [18 x i8] c"unkown time: '%s'\00"
define %struct.dbt* @timenewest(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.dbt*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %17, label %11
11: ; preds = %6, %1
%12 = call %struct.dbt* (...) @dbtgetnewest()
store %struct.dbt* %12, %struct.dbt** %3
%13 = icmp ne %struct.dbt* %12, null
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = call i32 (i32, i8*, ...) @error(i32 1, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14, %11
br label %25
17: ; preds = %6
%18 = load i8*, i8** %2
%19 = call %struct.dbt* @timeparse(i8* %18)
store %struct.dbt* %19, %struct.dbt** %3
%20 = icmp ne %struct.dbt* %19, null
br i1 %20, label %24, label %21
21: ; preds = %17
%22 = load i8*, i8** %2
%23 = call i32 (i32, i8*, ...) @error(i32 1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %22)
br label %24
24: ; preds = %21, %17
br label %25
25: ; preds = %24, %16
%26 = load %struct.dbt*, %struct.dbt** %3
ret %struct.dbt* %26
}

LLVM IR (-O2):
%struct.dbt = type { i32 }
@.str = [20 x i8] c"no time found in db\00"
@.str.1 = [18 x i8] c"unkown time: '%s'\00"
define %struct.dbt* @timenewest(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %3, %1
%7 = tail call %struct.dbt* (...) @dbtgetnewest()
%8 = icmp eq %struct.dbt* %7, null
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = tail call i32 (i32, i8*, ...) @error(i32 1, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %16
11: ; preds = %3
%12 = tail call %struct.dbt* @timeparse(i8* %0)
%13 = icmp eq %struct.dbt* %12, null
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = tail call i32 (i32, i8*, ...) @error(i32 1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %16
16: ; preds = %11, %14, %6, %9
%17 = phi %struct.dbt* [ %12, %11 ], [ null, %14 ], [ %7, %6 ], [ null, %9 ]
ret %struct.dbt* %17
}