#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 */

/* Variables and functions */
int snprintf(char *, int, char *, unsigned int);
int pmom_waketime_parse(char *in_buf, size_t len, char *out_buf,
                        unsigned int *out_ptr) {
  int data_len = 0;
  unsigned int *interval = (unsigned int *)in_buf;
  if (len != sizeof(*interval)) {
    return (int)(-1);
  }
  data_len = snprintf(&out_buf[*out_ptr], ((4096)),
                      "wake_acore_interval=%dsec\n", *interval);
  *out_ptr = *out_ptr + data_len;
  return (int)(0);
}


x86 assembly (clang, -O0):
<pmom_waketime_parse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
cmpq   $0x4,-0x18(%rbp)
je     114e <pmom_waketime_parse+0x3e>
movl   $0xffffffff,-0x4(%rbp)
jmp    118b <pmom_waketime_parse+0x7b>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
add    %rax,%rdi
mov    -0x38(%rbp),%rax
mov    (%rax),%ecx
mov    $0x1000,%esi
lea    0xe93(%rip),%rdx
call   1030 <snprintf@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
add    -0x2c(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pmom_waketime_parse>:
mov    $0xffffffff,%eax
cmp    $0x4,%rsi
jne    1142 <pmom_waketime_parse+0x32>
push   %rbx
mov    %rcx,%rbx
mov    (%rcx),%eax
add    %rax,%rdx
mov    (%rdi),%ecx
lea    0xed3(%rip),%rax
mov    %rdx,%rdi
mov    $0x1000,%esi
mov    %rax,%rdx
call   1030 <snprintf@plt>
add    %eax,(%rbx)
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"wake_acore_interval=%dsec\0A\00"
define i32 @pmom_waketime_parse(i8* %0, i64 %1, i8* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32*
store i8* %0, i8** %6
store i64 %1, i64* %7
store i8* %2, i8** %8
store i32* %3, i32** %9
store i32 0, i32* %10
%12 = load i8*, i8** %6
%13 = bitcast i8* %12 to i32*
store i32* %13, i32** %11
%14 = load i64, i64* %7
%15 = icmp ne i64 %14, 4
br i1 %15, label %16, label %17
16: ; preds = %4
store i32 -1, i32* %5
br label %31
17: ; preds = %4
%18 = load i8*, i8** %8
%19 = load i32*, i32** %9
%20 = load i32, i32* %19
%21 = zext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %18, i64 %21
%23 = load i32*, i32** %11
%24 = load i32, i32* %23
%25 = call i32 @snprintf(i8* %22, i32 4096, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %24)
store i32 %25, i32* %10
%26 = load i32*, i32** %9
%27 = load i32, i32* %26
%28 = load i32, i32* %10
%29 = add i32 %27, %28
%30 = load i32*, i32** %9
store i32 %29, i32* %30
store i32 0, i32* %5
br label %31
31: ; preds = %17, %16
%32 = load i32, i32* %5
ret i32 %32
}

LLVM IR (-O2):
@.str = [27 x i8] c"wake_acore_interval=%dsec\0A\00"
define i32 @pmom_waketime_parse(i8* nocapture %0, i64 %1, i8* %2, i32* nocapture %3) {
%5 = icmp eq i64 %1, 4
br i1 %5, label %6, label %15
6: ; preds = %4
%7 = bitcast i8* %0 to i32*
%8 = load i32, i32* %3
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %2, i64 %9
%11 = load i32, i32* %7
%12 = tail call i32 @snprintf(i8* %10, i32 4096, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %3
%14 = add i32 %13, %12
store i32 %14, i32* %3
br label %15
15: ; preds = %4, %6
%16 = phi i32 [ 0, %6 ], [ -1, %4 ]
ret i32 %16
}