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

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
void maketimeout(struct timespec *tsp, long minutes) {
  struct timeval now;
  gettimeofday(&now, NULL);
  tsp->tv_sec = now.tv_sec;
  tsp->tv_nsec = now.tv_usec * 1000;
  tsp->tv_sec += minutes * 60;
}


x86 assembly (clang, -O0):
<maketimeout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x20(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
imul   $0x3e8,-0x18(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
imul   $0x3c,-0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<maketimeout>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0x3e8,0x10(%rsp),%eax
imul   $0x3c,%r14,%rcx
add    0x8(%rsp),%rcx
mov    %eax,0x8(%rbx)
mov    %rcx,(%rbx)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i32 }
%struct.timeval = type { i64, i32 }
define void @maketimeout(%struct.timespec* %0, i64 %1) {
%3 = alloca %struct.timespec*
%4 = alloca i64
%5 = alloca %struct.timeval
store %struct.timespec* %0, %struct.timespec** %3
store i64 %1, i64* %4
%6 = call i32 @gettimeofday(%struct.timeval* %5, i32* null)
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
%8 = load i64, i64* %7
%9 = load %struct.timespec*, %struct.timespec** %3
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i32 0, i32 0
store i64 %8, i64* %10
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 1
%12 = load i32, i32* %11
%13 = mul nsw i32 %12, 1000
%14 = load %struct.timespec*, %struct.timespec** %3
%15 = getelementptr inbounds %struct.timespec, %struct.timespec* %14, i32 0, i32 1
store i32 %13, i32* %15
%16 = load i64, i64* %4
%17 = mul nsw i64 %16, 60
%18 = load %struct.timespec*, %struct.timespec** %3
%19 = getelementptr inbounds %struct.timespec, %struct.timespec* %18, i32 0, i32 0
%20 = load i64, i64* %19
%21 = add nsw i64 %20, %17
store i64 %21, i64* %19
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i64, i32 }
%struct.timeval = type { i64, i32 }
define void @maketimeout(%struct.timespec* nocapture %0, i64 %1) {
%3 = alloca %struct.timeval
%4 = bitcast %struct.timeval* %3 to i8*
%5 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
%7 = load i64, i64* %6
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
%10 = load i32, i32* %9
%11 = mul nsw i32 %10, 1000
%12 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
store i32 %11, i32* %12
%13 = mul nsw i64 %1, 60
%14 = add nsw i64 %7, %13
store i64 %14, i64* %8
ret void
}