#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 tcb {
  int dummy;
};
struct rtc_wkalrm {
  int /*<<< orphan*/ time;
  int /*<<< orphan*/ pending;
  int /*<<< orphan*/ enabled;
};

/* Variables and functions */
int /*<<< orphan*/ print_rtc_time(struct tcb *, int /*<<< orphan*/ *);
int /*<<< orphan*/ tprintf(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ tprints(char *);
int /*<<< orphan*/ umoven_or_printaddr(struct tcb *, long const, int, void *);
void decode_rtc_wkalrm(struct tcb *tcp, const long addr) {
  struct rtc_wkalrm wk;
  tprints(", ");
  if (!umoven_or_printaddr((tcp), (addr), sizeof(*(&wk)), (void *)(&wk))) {
    tprintf("{enabled=%d, pending=%d, ", wk.enabled, wk.pending);
    print_rtc_time(tcp, &wk.time);
    tprints("}");
  }
}


x86 assembly (clang, -O0):
<decode_rtc_wkalrm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec0(%rip),%rdi
call   1060 <tprints@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x20(%rbp),%rcx
mov    $0xc,%edx
call   1040 <umoven_or_printaddr@plt>
cmp    $0x0,%eax
jne    11a6 <decode_rtc_wkalrm+0x66>
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xe78(%rip),%rdi
call   1050 <tprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <print_rtc_time@plt>
lea    0xe79(%rip),%rdi
call   1060 <tprints@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_rtc_wkalrm>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xec3(%rip),%rdi
call   1060 <tprints@plt>
lea    0x8(%rsp),%rcx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0xc,%edx
call   1040 <umoven_or_printaddr@plt>
test   %eax,%eax
jne    119f <decode_rtc_wkalrm+0x5f>
mov    0xc(%rsp),%edx
mov    0x10(%rsp),%esi
lea    0xe7f(%rip),%rdi
call   1050 <tprintf@plt>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1030 <print_rtc_time@plt>
lea    0xe80(%rip),%rdi
call   1060 <tprints@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tcb = type { i32 }
%struct.rtc_wkalrm = type { i32, i32, i32 }
@.str = [3 x i8] c", \00"
@.str.1 = [26 x i8] c"{enabled=%d, pending=%d, \00"
@.str.2 = [2 x i8] c"}\00"
define void @decode_rtc_wkalrm(%struct.tcb* %0, i64 %1) {
%3 = alloca %struct.tcb*
%4 = alloca i64
%5 = alloca %struct.rtc_wkalrm
store %struct.tcb* %0, %struct.tcb** %3
store i64 %1, i64* %4
%6 = call i32 @tprints(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = load %struct.tcb*, %struct.tcb** %3
%8 = load i64, i64* %4
%9 = bitcast %struct.rtc_wkalrm* %5 to i8*
%10 = call i32 @umoven_or_printaddr(%struct.tcb* %7, i64 %8, i32 12, i8* %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %22, label %12
12: ; preds = %2
%13 = getelementptr inbounds %struct.rtc_wkalrm, %struct.rtc_wkalrm* %5, i32 0, i32 2
%14 = load i32, i32* %13
%15 = getelementptr inbounds %struct.rtc_wkalrm, %struct.rtc_wkalrm* %5, i32 0, i32 1
%16 = load i32, i32* %15
%17 = call i32 @tprintf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %14, i32 %16)
%18 = load %struct.tcb*, %struct.tcb** %3
%19 = getelementptr inbounds %struct.rtc_wkalrm, %struct.rtc_wkalrm* %5, i32 0, i32 0
%20 = call i32 @print_rtc_time(%struct.tcb* %18, i32* %19)
%21 = call i32 @tprints(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %12, %2
ret void
}

LLVM IR (-O2):
%struct.tcb = type { i32 }
%struct.rtc_wkalrm = type { i32, i32, i32 }
@.str = [3 x i8] c", \00"
@.str.1 = [26 x i8] c"{enabled=%d, pending=%d, \00"
@.str.2 = [2 x i8] c"}\00"
define void @decode_rtc_wkalrm(%struct.tcb* %0, i64 %1) {
%3 = alloca %struct.rtc_wkalrm
%4 = bitcast %struct.rtc_wkalrm* %3 to i8*
%5 = tail call i32 @tprints(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @umoven_or_printaddr(%struct.tcb* %0, i64 %1, i32 12, i8* %4)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %17
8: ; preds = %2
%9 = getelementptr inbounds %struct.rtc_wkalrm, %struct.rtc_wkalrm* %3, i64 0, i32 2
%10 = load i32, i32* %9
%11 = getelementptr inbounds %struct.rtc_wkalrm, %struct.rtc_wkalrm* %3, i64 0, i32 1
%12 = load i32, i32* %11
%13 = call i32 @tprintf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %12)
%14 = getelementptr inbounds %struct.rtc_wkalrm, %struct.rtc_wkalrm* %3, i64 0, i32 0
%15 = call i32 @print_rtc_time(%struct.tcb* %0, i32* %14)
%16 = call i32 @tprints(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %8, %2
ret void
}