#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 */
typedef int uint32_t;
struct tm {
  int tm_year;
  int tm_mon;
  int tm_mday;
  int tm_hour;
  int tm_min;
  int tm_sec;
};

/* Variables and functions */
int /*<<< orphan*/ xerr(char *);
uint32_t msdos_time(struct tm *t) {
  if (!t)
    xerr("time not set");
  return (((((t->tm_year - 80) << 4 ^ (t->tm_mon + 1)) << 5 ^ (t->tm_mday))
               << 5 ^
           (t->tm_hour))
              << 6 ^
          (t->tm_min))
             << 5 ^
         (t->tm_sec / 2);
}


x86 assembly (clang, -O0):
<msdos_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1133 <msdos_time+0x23>
lea    0xed2(%rip),%rdi
call   1030 <xerr@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
sub    $0x50,%eax
shl    $0x4,%eax
mov    -0x8(%rbp),%rcx
mov    0x4(%rcx),%ecx
add    $0x1,%ecx
xor    %ecx,%eax
shl    $0x5,%eax
mov    -0x8(%rbp),%rcx
xor    0x8(%rcx),%eax
shl    $0x5,%eax
mov    -0x8(%rbp),%rcx
xor    0xc(%rcx),%eax
shl    $0x6,%eax
mov    -0x8(%rbp),%rcx
xor    0x10(%rcx),%eax
shl    $0x5,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
xor    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<msdos_time>:
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
jne    1125 <msdos_time+0x15>
lea    0xee0(%rip),%rdi
call   1030 <xerr@plt>
mov    (%rbx),%eax
mov    0x4(%rbx),%ecx
shl    $0x4,%eax
add    $0x300,%eax
add    $0x1,%ecx
xor    %eax,%ecx
mov    0x8(%rbx),%eax
mov    0xc(%rbx),%edx
mov    0x10(%rbx),%esi
shl    $0x15,%ecx
shl    $0x10,%eax
shl    $0xb,%edx
xor    %eax,%edx
xor    %ecx,%edx
shl    $0x5,%esi
mov    0x14(%rbx),%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
sar    %eax
xor    %esi,%eax
xor    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [13 x i8] c"time not set\00"
define i32 @msdos_time(%struct.tm* %0) {
%2 = alloca %struct.tm*
store %struct.tm* %0, %struct.tm** %2
%3 = load %struct.tm*, %struct.tm** %2
%4 = icmp ne %struct.tm* %3, null
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = call i32 @xerr(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
%8 = load %struct.tm*, %struct.tm** %2
%9 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 0
%10 = load i32, i32* %9
%11 = sub nsw i32 %10, 80
%12 = shl i32 %11, 4
%13 = load %struct.tm*, %struct.tm** %2
%14 = getelementptr inbounds %struct.tm, %struct.tm* %13, i32 0, i32 1
%15 = load i32, i32* %14
%16 = add nsw i32 %15, 1
%17 = xor i32 %12, %16
%18 = shl i32 %17, 5
%19 = load %struct.tm*, %struct.tm** %2
%20 = getelementptr inbounds %struct.tm, %struct.tm* %19, i32 0, i32 2
%21 = load i32, i32* %20
%22 = xor i32 %18, %21
%23 = shl i32 %22, 5
%24 = load %struct.tm*, %struct.tm** %2
%25 = getelementptr inbounds %struct.tm, %struct.tm* %24, i32 0, i32 3
%26 = load i32, i32* %25
%27 = xor i32 %23, %26
%28 = shl i32 %27, 6
%29 = load %struct.tm*, %struct.tm** %2
%30 = getelementptr inbounds %struct.tm, %struct.tm* %29, i32 0, i32 4
%31 = load i32, i32* %30
%32 = xor i32 %28, %31
%33 = shl i32 %32, 5
%34 = load %struct.tm*, %struct.tm** %2
%35 = getelementptr inbounds %struct.tm, %struct.tm* %34, i32 0, i32 5
%36 = load i32, i32* %35
%37 = sdiv i32 %36, 2
%38 = xor i32 %33, %37
ret i32 %38
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [13 x i8] c"time not set\00"
define i32 @msdos_time(%struct.tm* %0) {
%2 = icmp eq %struct.tm* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @xerr(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %1
%6 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 0
%7 = load i32, i32* %6
%8 = shl i32 %7, 4
%9 = add i32 %8, 768
%10 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 1
%11 = load i32, i32* %10
%12 = add nsw i32 %11, 1
%13 = xor i32 %9, %12
%14 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 2
%15 = load i32, i32* %14
%16 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 3
%17 = load i32, i32* %16
%18 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 4
%19 = load i32, i32* %18
%20 = shl i32 %13, 21
%21 = shl i32 %15, 16
%22 = shl i32 %17, 11
%23 = xor i32 %21, %22
%24 = xor i32 %20, %23
%25 = shl i32 %19, 5
%26 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 5
%27 = load i32, i32* %26
%28 = sdiv i32 %27, 2
%29 = xor i32 %28, %25
%30 = xor i32 %29, %24
ret i32 %30
}