#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 timespec {
  long long tv_sec;
  scalar_t__ tv_nsec;
};

/* Variables and functions */
char *flu_tstamp(struct timespec *, int, char);
char *flu_sstamp(long long s, int utc, char format) {
  if (s == 0)
    return flu_tstamp(NULL, utc, format);
  struct timespec ts;
  ts.tv_sec = s;
  ts.tv_nsec = 0;
  return flu_tstamp(&ts, utc, format);
}


x86 assembly (clang, -O0):
<flu_sstamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dl,%al
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %al,-0x15(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1148 <flu_sstamp+0x38>
mov    -0x14(%rbp),%esi
xor    %eax,%eax
mov    %eax,%edi
movsbl -0x15(%rbp),%edx
call   1030 <flu_tstamp@plt>
mov    %rax,-0x8(%rbp)
jmp    116c <flu_sstamp+0x5c>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x14(%rbp),%esi
lea    -0x28(%rbp),%rdi
movsbl -0x15(%rbp),%edx
call   1030 <flu_tstamp@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flu_sstamp>:
test   %rdi,%rdi
je     1139 <flu_sstamp+0x29>
sub    $0x18,%rsp
mov    %rdi,0x8(%rsp)
movq   $0x0,0x10(%rsp)
movsbl %dl,%edx
lea    0x8(%rsp),%rdi
call   1030 <flu_tstamp@plt>
add    $0x18,%rsp
ret
movsbl %dl,%edx
xor    %edi,%edi
jmp    1030 <flu_tstamp@plt>

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
define i8* @flu_sstamp(i64 %0, i32 %1, i8 signext %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
%7 = alloca i8
%8 = alloca %struct.timespec
store i64 %0, i64* %5
store i32 %1, i32* %6
store i8 %2, i8* %7
%9 = load i64, i64* %5
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %3
%12 = load i32, i32* %6
%13 = load i8, i8* %7
%14 = call i8* @flu_tstamp(%struct.timespec* null, i32 %12, i8 signext %13)
store i8* %14, i8** %4
br label %22
15: ; preds = %3
%16 = load i64, i64* %5
%17 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 0
store i64 %16, i64* %17
%18 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 1
store i64 0, i64* %18
%19 = load i32, i32* %6
%20 = load i8, i8* %7
%21 = call i8* @flu_tstamp(%struct.timespec* %8, i32 %19, i8 signext %20)
store i8* %21, i8** %4
br label %22
22: ; preds = %15, %11
%23 = load i8*, i8** %4
ret i8* %23
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
define i8* @flu_sstamp(i64 %0, i32 %1, i8 signext %2) {
%4 = alloca %struct.timespec
%5 = icmp eq i64 %0, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i8* @flu_tstamp(%struct.timespec* null, i32 %1, i8 signext %2)
br label %13
8: ; preds = %3
%9 = bitcast %struct.timespec* %4 to i8*
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i64 0, i32 0
store i64 %0, i64* %10
%11 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i64 0, i32 1
store i64 0, i64* %11
%12 = call i8* @flu_tstamp(%struct.timespec* %4, i32 %1, i8 signext %2)
br label %13
13: ; preds = %8, %6
%14 = phi i8* [ %7, %6 ], [ %12, %8 ]
ret i8* %14
}