#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 timeval {
  int tv_sec;
  int /*<<< orphan*/ tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int, int /*<<< orphan*/, char *);
void print_timeval(struct timeval *tval, unsigned char newline_before,
                   unsigned char newline_after) {
  printf("%s%i.%i%s", (newline_before) ? "\n" : "", tval->tv_sec, tval->tv_usec,
         (newline_after) ? "\n" : "");
}


x86 assembly (clang, -O0):
<print_timeval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0x9(%rbp),%ecx
lea    0xed9(%rip),%rsi
lea    0xed1(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%ecx
movzbl -0xa(%rbp),%edi
lea    0xeb3(%rip),%r8
lea    0xeab(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%r8
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_timeval>:
test   %esi,%esi
lea    0xef2(%rip),%r9
lea    0xeea(%rip),%r8
mov    %r8,%rsi
cmove  %r9,%rsi
mov    (%rdi),%eax
mov    0x4(%rdi),%ecx
test   %edx,%edx
cmove  %r9,%r8
lea    0xec7(%rip),%rdi
mov    %eax,%edx
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
@.str = [10 x i8] c"%s%i.%i%s\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [1 x i8] zeroinitializer
define void @print_timeval(%struct.timeval* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca %struct.timeval*
%5 = alloca i8
%6 = alloca i8
store %struct.timeval* %0, %struct.timeval** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%7 = load i8, i8* %5
%8 = zext i8 %7 to i32
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%12 = load %struct.timeval*, %struct.timeval** %4
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 0
%14 = load i32, i32* %13
%15 = load %struct.timeval*, %struct.timeval** %4
%16 = getelementptr inbounds %struct.timeval, %struct.timeval* %15, i32 0, i32 1
%17 = load i32, i32* %16
%18 = load i8, i8* %6
%19 = zext i8 %18 to i32
%20 = icmp ne i32 %19, 0
%21 = zext i1 %20 to i64
%22 = select i1 %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%23 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %11, i32 %14, i32 %17, i8* %22)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
@.str = [10 x i8] c"%s%i.%i%s\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [1 x i8] zeroinitializer
define void @print_timeval(%struct.timeval* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = icmp eq i8 %1, 0
%5 = select i1 %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%7 = load i32, i32* %6
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%9 = load i32, i32* %8
%10 = icmp eq i8 %2, 0
%11 = select i1 %10, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %7, i32 %9, i8* %11)
ret void
}