#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 {
  int tm_hour;
  scalar_t__ tm_sec;
  scalar_t__ tm_min;
};

/* Variables and functions */
void date_pm(struct tm *tm, struct tm *now, int *num) {
  int hour, n = *num;
  *num = 0;
  hour = tm->tm_hour;
  if (n) {
    hour = n;
    tm->tm_min = 0;
    tm->tm_sec = 0;
  }
  tm->tm_hour = (hour % 12) + 12;
}


x86 assembly (clang, -O0):
<date_pm>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     1154 <date_pm+0x54>
mov    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movq   $0x0,0x10(%rax)
mov    -0x8(%rbp),%rax
movq   $0x0,0x8(%rax)
mov    -0x1c(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
add    $0xc,%edx
mov    -0x8(%rbp),%rax
mov    %edx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<date_pm>:
mov    (%rdx),%eax
movl   $0x0,(%rdx)
test   %eax,%eax
je     1115 <date_pm+0x15>
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rdi)
jmp    1117 <date_pm+0x17>
mov    (%rdi),%eax
cltq
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x21,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,2),%ecx
neg    %ecx
add    %ecx,%eax
add    $0xc,%eax
mov    %eax,(%rdi)
ret

LLVM IR (-O0):
%struct.tm = type { i32, i64, i64 }
define void @date_pm(%struct.tm* %0, %struct.tm* %1, i32* %2) {
%4 = alloca %struct.tm*
%5 = alloca %struct.tm*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store %struct.tm* %0, %struct.tm** %4
store %struct.tm* %1, %struct.tm** %5
store i32* %2, i32** %6
%9 = load i32*, i32** %6
%10 = load i32, i32* %9
store i32 %10, i32* %8
%11 = load i32*, i32** %6
store i32 0, i32* %11
%12 = load %struct.tm*, %struct.tm** %4
%13 = getelementptr inbounds %struct.tm, %struct.tm* %12, i32 0, i32 0
%14 = load i32, i32* %13
store i32 %14, i32* %7
%15 = load i32, i32* %8
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %3
%18 = load i32, i32* %8
store i32 %18, i32* %7
%19 = load %struct.tm*, %struct.tm** %4
%20 = getelementptr inbounds %struct.tm, %struct.tm* %19, i32 0, i32 2
store i64 0, i64* %20
%21 = load %struct.tm*, %struct.tm** %4
%22 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 1
store i64 0, i64* %22
br label %23
23: ; preds = %17, %3
%24 = load i32, i32* %7
%25 = srem i32 %24, 12
%26 = add nsw i32 %25, 12
%27 = load %struct.tm*, %struct.tm** %4
%28 = getelementptr inbounds %struct.tm, %struct.tm* %27, i32 0, i32 0
store i32 %26, i32* %28
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i64, i64 }
define void @date_pm(%struct.tm* nocapture %0, %struct.tm* nocapture readnone %1, i32* nocapture %2) {
%4 = load i32, i32* %2
store i32 0, i32* %2
%5 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 0
%6 = load i32, i32* %5
%7 = icmp eq i32 %4, 0
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 1
%10 = bitcast i64* %9 to i8*
br label %11
11: ; preds = %8, %3
%12 = phi i32 [ %4, %8 ], [ %6, %3 ]
%13 = srem i32 %12, 12
%14 = add nsw i32 %13, 12
store i32 %14, i32* %5
ret void
}