#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 {
  char *tv_sec;
  char *tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void print_timespec(char *msg, struct timespec ts) {
  fprintf(stderr, "%s:\n", msg);
  fprintf(stderr, "\ttv_sec: %ld\n", ts.tv_sec);
  fprintf(stderr, "\ttv_nsec: %ld\n", ts.tv_nsec);
}


x86 assembly (clang, -O0):
<print_timespec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x8(%rbp)
mov    %rdi,-0x18(%rbp)
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xec8(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xeb4(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xea9(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_timespec>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%rdx
mov    0x2ebb(%rip),%r15
mov    (%r15),%edi
lea    0xed1(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%r15),%edi
lea    0xec7(%rip),%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    (%r15),%edi
lea    0xec3(%rip),%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
%struct.timespec = type { i8*, i8* }
@stderr = global i32 0
@.str = [5 x i8] c"%s:\0A\00"
@.str.1 = [14 x i8] c"\09tv_sec: %ld\0A\00"
@.str.2 = [15 x i8] c"\09tv_nsec: %ld\0A\00"
define void @print_timespec(i8* %0, i8* %1, i8* %2) {
%4 = alloca %struct.timespec
%5 = alloca i8*
%6 = bitcast %struct.timespec* %4 to { i8*, i8* }*
%7 = getelementptr inbounds { i8*, i8* }, { i8*, i8* }* %6, i32 0, i32 0
store i8* %1, i8** %7
%8 = getelementptr inbounds { i8*, i8* }, { i8*, i8* }* %6, i32 0, i32 1
store i8* %2, i8** %8
store i8* %0, i8** %5
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %5
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i32, i32* @stderr
%13 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i32 0, i32 0
%14 = load i8*, i8** %13
%15 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = load i32, i32* @stderr
%17 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i32 0, i32 1
%18 = load i8*, i8** %17
%19 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %18)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [5 x i8] c"%s:\0A\00"
@.str.1 = [14 x i8] c"\09tv_sec: %ld\0A\00"
@.str.2 = [15 x i8] c"\09tv_nsec: %ld\0A\00"
define void @print_timespec(i8* %0, i8* %1, i8* %2) {
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %2)
ret void
}