#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 {
  scalar_t__ tv_sec;
  scalar_t__ tv_usec;
};

/* Variables and functions */
struct timeval *timermin(struct timeval *a, struct timeval *b) {
  if ((a->tv_sec < b->tv_sec) ||
      ((a->tv_sec == b->tv_sec) && (a->tv_usec < b->tv_usec)))
    return a;
  else
    return b;
}


x86 assembly (clang, -O0):
<timermin>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%rax
jl     114a <timermin+0x4a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%rax
jne    1157 <timermin+0x57>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    0x8(%rcx),%rax
jge    1157 <timermin+0x57>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    115f <timermin+0x5f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<timermin>:
mov    %rdi,%rax
mov    (%rsi),%rcx
cmp    %rcx,(%rdi)
jl     111a <timermin+0x1a>
jne    1117 <timermin+0x17>
mov    0x8(%rax),%rcx
cmp    0x8(%rsi),%rcx
jl     111a <timermin+0x1a>
mov    %rsi,%rax
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define %struct.timeval* @timermin(%struct.timeval* %0, %struct.timeval* %1) {
%3 = alloca %struct.timeval*
%4 = alloca %struct.timeval*
%5 = alloca %struct.timeval*
store %struct.timeval* %0, %struct.timeval** %4
store %struct.timeval* %1, %struct.timeval** %5
%6 = load %struct.timeval*, %struct.timeval** %4
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
%8 = load i64, i64* %7
%9 = load %struct.timeval*, %struct.timeval** %5
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i32 0, i32 0
%11 = load i64, i64* %10
%12 = icmp slt i64 %8, %11
br i1 %12, label %29, label %13
13: ; preds = %2
%14 = load %struct.timeval*, %struct.timeval** %4
%15 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i32 0, i32 0
%16 = load i64, i64* %15
%17 = load %struct.timeval*, %struct.timeval** %5
%18 = getelementptr inbounds %struct.timeval, %struct.timeval* %17, i32 0, i32 0
%19 = load i64, i64* %18
%20 = icmp eq i64 %16, %19
br i1 %20, label %21, label %31
21: ; preds = %13
%22 = load %struct.timeval*, %struct.timeval** %4
%23 = getelementptr inbounds %struct.timeval, %struct.timeval* %22, i32 0, i32 1
%24 = load i64, i64* %23
%25 = load %struct.timeval*, %struct.timeval** %5
%26 = getelementptr inbounds %struct.timeval, %struct.timeval* %25, i32 0, i32 1
%27 = load i64, i64* %26
%28 = icmp slt i64 %24, %27
br i1 %28, label %29, label %31
29: ; preds = %21, %2
%30 = load %struct.timeval*, %struct.timeval** %4
store %struct.timeval* %30, %struct.timeval** %3
br label %33
31: ; preds = %21, %13
%32 = load %struct.timeval*, %struct.timeval** %5
store %struct.timeval* %32, %struct.timeval** %3
br label %33
33: ; preds = %31, %29
%34 = load %struct.timeval*, %struct.timeval** %3
ret %struct.timeval* %34
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define %struct.timeval* @timermin(%struct.timeval* %0, %struct.timeval* %1) {
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%4 = load i64, i64* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%6 = load i64, i64* %5
%7 = icmp slt i64 %4, %6
br i1 %7, label %17, label %8
8: ; preds = %2
%9 = icmp eq i64 %4, %6
br i1 %9, label %10, label %16
10: ; preds = %8
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%12 = load i64, i64* %11
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%14 = load i64, i64* %13
%15 = icmp slt i64 %12, %14
br i1 %15, label %17, label %16
16: ; preds = %10, %8
br label %17
17: ; preds = %2, %10, %16
%18 = phi %struct.timeval* [ %1, %16 ], [ %0, %10 ], [ %0, %2 ]
ret %struct.timeval* %18
}