#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 tm {
  unsigned long tm_year;
  scalar_t__ tm_sec;
  scalar_t__ tm_min;
  scalar_t__ tm_hour;
  scalar_t__ tm_mday;
  scalar_t__ tm_mon;
};

/* Variables and functions */
unsigned long convert_time(struct tm *time) {
  unsigned long value;
  value = time->tm_year;
  value *= 12;
  value += time->tm_mon;
  value *= 31;
  value += time->tm_mday;
  value *= 24;
  value += time->tm_hour;
  value *= 60;
  value += time->tm_min;
  value *= 60;
  value += time->tm_sec;
  return value;
}


x86 assembly (clang, -O0):
<convert_time>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
imul   $0xc,-0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x28(%rax),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
imul   $0x1f,-0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x20(%rax),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
imul   $0x18,-0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
imul   $0x3c,-0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
imul   $0x3c,-0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_time>:
mov    (%rdi),%rax
lea    (%rax,%rax,2),%rax
shl    $0x2,%rax
add    0x28(%rdi),%rax
mov    %rax,%rcx
shl    $0x5,%rcx
sub    %rax,%rcx
add    0x20(%rdi),%rcx
lea    (%rcx,%rcx,2),%rax
shl    $0x3,%rax
add    0x18(%rdi),%rax
imul   $0x3c,%rax,%rax
add    0x10(%rdi),%rax
imul   $0x3c,%rax,%rax
add    0x8(%rdi),%rax
ret

LLVM IR (-O0):
%struct.tm = type { i64, i64, i64, i64, i64, i64 }
define i64 @convert_time(%struct.tm* %0) {
%2 = alloca %struct.tm*
%3 = alloca i64
store %struct.tm* %0, %struct.tm** %2
%4 = load %struct.tm*, %struct.tm** %2
%5 = getelementptr inbounds %struct.tm, %struct.tm* %4, i32 0, i32 0
%6 = load i64, i64* %5
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = mul i64 %7, 12
store i64 %8, i64* %3
%9 = load %struct.tm*, %struct.tm** %2
%10 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 5
%11 = load i64, i64* %10
%12 = load i64, i64* %3
%13 = add i64 %12, %11
store i64 %13, i64* %3
%14 = load i64, i64* %3
%15 = mul i64 %14, 31
store i64 %15, i64* %3
%16 = load %struct.tm*, %struct.tm** %2
%17 = getelementptr inbounds %struct.tm, %struct.tm* %16, i32 0, i32 4
%18 = load i64, i64* %17
%19 = load i64, i64* %3
%20 = add i64 %19, %18
store i64 %20, i64* %3
%21 = load i64, i64* %3
%22 = mul i64 %21, 24
store i64 %22, i64* %3
%23 = load %struct.tm*, %struct.tm** %2
%24 = getelementptr inbounds %struct.tm, %struct.tm* %23, i32 0, i32 3
%25 = load i64, i64* %24
%26 = load i64, i64* %3
%27 = add i64 %26, %25
store i64 %27, i64* %3
%28 = load i64, i64* %3
%29 = mul i64 %28, 60
store i64 %29, i64* %3
%30 = load %struct.tm*, %struct.tm** %2
%31 = getelementptr inbounds %struct.tm, %struct.tm* %30, i32 0, i32 2
%32 = load i64, i64* %31
%33 = load i64, i64* %3
%34 = add i64 %33, %32
store i64 %34, i64* %3
%35 = load i64, i64* %3
%36 = mul i64 %35, 60
store i64 %36, i64* %3
%37 = load %struct.tm*, %struct.tm** %2
%38 = getelementptr inbounds %struct.tm, %struct.tm* %37, i32 0, i32 1
%39 = load i64, i64* %38
%40 = load i64, i64* %3
%41 = add i64 %40, %39
store i64 %41, i64* %3
%42 = load i64, i64* %3
ret i64 %42
}

LLVM IR (-O2):
%struct.tm = type { i64, i64, i64, i64, i64, i64 }
define i64 @convert_time(%struct.tm* nocapture %0) {
%2 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 0
%3 = load i64, i64* %2
%4 = mul i64 %3, 12
%5 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 5
%6 = load i64, i64* %5
%7 = add i64 %4, %6
%8 = mul i64 %7, 31
%9 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 4
%10 = load i64, i64* %9
%11 = add i64 %8, %10
%12 = mul i64 %11, 24
%13 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 3
%14 = load i64, i64* %13
%15 = add i64 %12, %14
%16 = mul i64 %15, 60
%17 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 2
%18 = load i64, i64* %17
%19 = add i64 %16, %18
%20 = mul i64 %19, 60
%21 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 1
%22 = load i64, i64* %21
%23 = add i64 %20, %22
ret i64 %23
}