#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 /*<<< orphan*/ Display;
typedef int /*<<< orphan*/ Bool;

/* Variables and functions */
int /*<<< orphan*/ False;
int /*<<< orphan*/ free(char *);
char *get_string_resource(int /*<<< orphan*/ *, char *, char *);
int parse_time(char *, int /*<<< orphan*/, int /*<<< orphan*/);
unsigned int get_time_resource(Display *dpy, char *res_name, char *res_class,
                               Bool sec_p) {
  int val;
  char *s = get_string_resource(dpy, res_name, res_class);
  if (!s)
    return 0;
  val = parse_time(s, sec_p, False);
  free(s);
  return (val < 0 ? 0 : val);
}


x86 assembly (clang, -O0):
<get_time_resource>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <get_string_resource@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1173 <get_time_resource+0x43>
movl   $0x0,-0x4(%rbp)
jmp    11b4 <get_time_resource+0x84>
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    0x2e67(%rip),%rax
mov    (%rax),%edx
call   1050 <parse_time@plt>
mov    %eax,-0x28(%rbp)
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x28(%rbp)
jge    11a8 <get_time_resource+0x78>
xor    %eax,%eax
mov    %eax,-0x34(%rbp)
jmp    11ae <get_time_resource+0x7e>
mov    -0x28(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time_resource>:
push   %rbp
push   %rbx
push   %rax
mov    %ecx,%ebp
call   1040 <get_string_resource@plt>
test   %rax,%rax
je     1168 <get_time_resource+0x38>
mov    %rax,%rbx
mov    0x2e9f(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    %ebp,%esi
call   1050 <parse_time@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
test   %ebp,%ebp
cmovns %ebp,%eax
jmp    116a <get_time_resource+0x3a>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@False = global i32 0
define i32 @get_time_resource(i32* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
store i32* %0, i32** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
%12 = load i32*, i32** %6
%13 = load i8*, i8** %7
%14 = load i8*, i8** %8
%15 = call i8* @get_string_resource(i32* %12, i8* %13, i8* %14)
store i8* %15, i8** %11
%16 = load i8*, i8** %11
%17 = icmp ne i8* %16, null
br i1 %17, label %19, label %18
18: ; preds = %4
store i32 0, i32* %5
br label %33
19: ; preds = %4
%20 = load i8*, i8** %11
%21 = load i32, i32* %9
%22 = load i32, i32* @False
%23 = call i32 @parse_time(i8* %20, i32 %21, i32 %22)
store i32 %23, i32* %10
%24 = load i8*, i8** %11
%25 = call i32 @free(i8* %24)
%26 = load i32, i32* %10
%27 = icmp slt i32 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %19
br label %31
29: ; preds = %19
%30 = load i32, i32* %10
br label %31
31: ; preds = %29, %28
%32 = phi i32 [ 0, %28 ], [ %30, %29 ]
store i32 %32, i32* %5
br label %33
33: ; preds = %31, %18
%34 = load i32, i32* %5
ret i32 %34
}

LLVM IR (-O2):
@False = global i32 0
define i32 @get_time_resource(i32* %0, i8* %1, i8* %2, i32 %3) {
%5 = tail call i8* @get_string_resource(i32* %0, i8* %1, i8* %2)
%6 = icmp eq i8* %5, null
br i1 %6, label %13, label %7
7: ; preds = %4
%8 = load i32, i32* @False
%9 = tail call i32 @parse_time(i8* %5, i32 %3, i32 %8)
%10 = tail call i32 @free(i8* %5)
%11 = icmp sgt i32 %9, 0
%12 = select i1 %11, i32 %9, i32 0
br label %13
13: ; preds = %4, %7
%14 = phi i32 [ %12, %7 ], [ 0, %4 ]
ret i32 %14
}