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

/* Variables and functions */
int __infer_nondet_int();
struct tm *localtime_r(const time_t *__restrict timer,
                       struct tm *__restrict result) {
  int success;
  struct tm tmp;
  if (timer == 0)
    while (1)
      ;
  if (result == 0)
    while (1)
      ;
  success = __infer_nondet_int();
  *result = tmp;
  return (success > 0) ? result : 0;
}


x86 assembly (clang, -O0):
<localtime_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1135 <localtime_r+0x25>
jmp    1130 <localtime_r+0x20>
jmp    1130 <localtime_r+0x20>
cmpq   $0x0,-0x10(%rbp)
jne    114a <localtime_r+0x3a>
jmp    1145 <localtime_r+0x35>
jmp    1145 <localtime_r+0x35>
mov    $0x0,%al
call   1030 <__infer_nondet_int@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,(%rax)
cmpl   $0x0,-0x14(%rbp)
jle    1174 <localtime_r+0x64>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    117f <localtime_r+0x6f>
xor    %eax,%eax
mov    %rax,-0x20(%rbp)
jmp    117f <localtime_r+0x6f>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<localtime_r>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     1140 <localtime_r+0x30>
mov    %rsi,%rbx
test   %rsi,%rsi
je     1150 <localtime_r+0x40>
xor    %r14d,%r14d
xor    %eax,%eax
call   1030 <__infer_nondet_int@plt>
test   %eax,%eax
cmovg  %rbx,%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
nopl   0x0(%rax)
jmp    1140 <localtime_r+0x30>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
jmp    1150 <localtime_r+0x40>

LLVM IR (-O0):
%struct.tm = type { i32 }
define %struct.tm* @localtime_r(i32* noalias %0, %struct.tm* noalias %1) {
%3 = alloca i32*
%4 = alloca %struct.tm*
%5 = alloca i32
%6 = alloca %struct.tm
store i32* %0, i32** %3
store %struct.tm* %1, %struct.tm** %4
%7 = load i32*, i32** %3
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %11
9: ; preds = %2
br label %10
10: ; preds = %9, %10
br label %10
11: ; preds = %2
%12 = load %struct.tm*, %struct.tm** %4
%13 = icmp eq %struct.tm* %12, null
br i1 %13, label %14, label %16
14: ; preds = %11
br label %15
15: ; preds = %14, %15
br label %15
16: ; preds = %11
%17 = call i32 (...) @__infer_nondet_int()
store i32 %17, i32* %5
%18 = load %struct.tm*, %struct.tm** %4
%19 = bitcast %struct.tm* %18 to i8*
%20 = bitcast %struct.tm* %6 to i8*
%21 = load i32, i32* %5
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %16
%24 = load %struct.tm*, %struct.tm** %4
br label %26
25: ; preds = %16
br label %26
26: ; preds = %25, %23
%27 = phi %struct.tm* [ %24, %23 ], [ null, %25 ]
ret %struct.tm* %27
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define %struct.tm* @localtime_r(i32* noalias readnone %0, %struct.tm* noalias readnone %1) {
%3 = icmp eq i32* %0, null
br i1 %3, label %4, label %5
4: ; preds = %2, %4
br label %4
5: ; preds = %2
%6 = icmp eq %struct.tm* %1, null
br i1 %6, label %7, label %8
7: ; preds = %5, %7
br label %7
8: ; preds = %5
%9 = tail call i32 (...) @__infer_nondet_int()
%10 = icmp sgt i32 %9, 0
%11 = select i1 %10, %struct.tm* %1, %struct.tm* null
ret %struct.tm* %11
}