#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 dummy;
};

/* Variables and functions */
int /*<<< orphan*/ wfile_decrement_hour(struct tm *);
int /*<<< orphan*/ wfile_increment_hour(struct tm *);
void wfile_date_add_hours(struct tm *date, int nhours) {
  int i;
  if (nhours > 0)
    for (i = 0; i < nhours; i++)
      wfile_increment_hour(date);
  else
    for (i = 0; i < -nhours; i++)
      wfile_decrement_hour(date);
}


x86 assembly (clang, -O0):
<wfile_date_add_hours>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1168 <wfile_date_add_hours+0x48>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1163 <wfile_date_add_hours+0x43>
mov    -0x8(%rbp),%rdi
call   1040 <wfile_increment_hour@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1140 <wfile_date_add_hours+0x20>
jmp    119b <wfile_date_add_hours+0x7b>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
xor    %ecx,%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jge    1196 <wfile_date_add_hours+0x76>
mov    -0x8(%rbp),%rdi
call   1030 <wfile_decrement_hour@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    116f <wfile_date_add_hours+0x4f>
jmp    119b <wfile_date_add_hours+0x7b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wfile_date_add_hours>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
test   %esi,%esi
jle    113f <wfile_date_add_hours+0x1f>
nopl   (%rax)
mov    %r14,%rdi
call   1040 <wfile_increment_hour@plt>
add    $0xffffffff,%ebp
jne    1130 <wfile_date_add_hours+0x10>
jmp    115d <wfile_date_add_hours+0x3d>
jns    115d <wfile_date_add_hours+0x3d>
neg    %ebp
cmp    $0x2,%ebp
mov    $0x1,%ebx
cmovge %ebp,%ebx
xchg   %ax,%ax
mov    %r14,%rdi
call   1030 <wfile_decrement_hour@plt>
add    $0xffffffff,%ebx
jne    1150 <wfile_date_add_hours+0x30>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define void @wfile_date_add_hours(%struct.tm* %0, i32 %1) {
%3 = alloca %struct.tm*
%4 = alloca i32
%5 = alloca i32
store %struct.tm* %0, %struct.tm** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %20
8: ; preds = %2
store i32 0, i32* %5
br label %9
9: ; preds = %16, %8
%10 = load i32, i32* %5
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %19
13: ; preds = %9
%14 = load %struct.tm*, %struct.tm** %3
%15 = call i32 @wfile_increment_hour(%struct.tm* %14)
br label %16
16: ; preds = %13
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
store i32 %18, i32* %5
br label %9
19: ; preds = %9
br label %33
20: ; preds = %2
store i32 0, i32* %5
br label %21
21: ; preds = %29, %20
%22 = load i32, i32* %5
%23 = load i32, i32* %4
%24 = sub nsw i32 0, %23
%25 = icmp slt i32 %22, %24
br i1 %25, label %26, label %32
26: ; preds = %21
%27 = load %struct.tm*, %struct.tm** %3
%28 = call i32 @wfile_decrement_hour(%struct.tm* %27)
br label %29
29: ; preds = %26
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %21
32: ; preds = %21
br label %33
33: ; preds = %32, %19
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define void @wfile_date_add_hours(%struct.tm* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = icmp slt i32 %1, 0
br i1 %5, label %6, label %19
6: ; preds = %4
%7 = sub i32 0, %1
%8 = call i32 @llvm.smax.i32(i32 %7, i32 1)
br label %14
9: ; preds = %2, %9
%10 = phi i32 [ %12, %9 ], [ 0, %2 ]
%11 = tail call i32 @wfile_increment_hour(%struct.tm* %0)
%12 = add nuw nsw i32 %10, 1
%13 = icmp eq i32 %12, %1
br i1 %13, label %19, label %9
14: ; preds = %6, %14
%15 = phi i32 [ %17, %14 ], [ 0, %6 ]
%16 = tail call i32 @wfile_decrement_hour(%struct.tm* %0)
%17 = add nuw nsw i32 %15, 1
%18 = icmp eq i32 %17, %8
br i1 %18, label %19, label %14
19: ; preds = %14, %9, %4
ret void
}