#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 uint16_t;
typedef int int32_t;

/* Variables and functions */
int /*<<< orphan*/ utc_offset_hour_min_pos_parse(char const *, int *, int *,
                                                 int *);
int32_t utc_offset_parse(const char *utc_offset_str) {
  uint16_t hours = 0;
  uint16_t minutes = 0;
  bool positive_offset = false;
  int32_t absolute_seconds_offset = 0;
  utc_offset_hour_min_pos_parse(utc_offset_str, &hours, &minutes,
                                &positive_offset);
  absolute_seconds_offset = (hours * 60 * 60) + (minutes * 60);
  if (positive_offset) {
    return +absolute_seconds_offset;
  } else {
    return -absolute_seconds_offset;
  }
  return 0;
}


x86 assembly (clang, -O0):
<utc_offset_parse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x1c(%rbp),%rcx
call   1030 <utc_offset_hour_min_pos_parse@plt>
imul   $0x3c,-0x14(%rbp),%eax
imul   $0x3c,%eax,%eax
imul   $0x3c,-0x18(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1172 <utc_offset_parse+0x62>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117a <utc_offset_parse+0x6a>
xor    %eax,%eax
sub    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utc_offset_parse>:
sub    $0x18,%rsp
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1030 <utc_offset_hour_min_pos_parse@plt>
imul   $0xe10,0x14(%rsp),%eax
imul   $0x3c,0x10(%rsp),%ecx
add    %eax,%ecx
mov    %ecx,%eax
neg    %eax
cmpl   $0x0,0xc(%rsp)
cmovne %ecx,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @utc_offset_parse(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
%8 = load i8*, i8** %3
%9 = call i32 @utc_offset_hour_min_pos_parse(i8* %8, i32* %4, i32* %5, i32* %6)
%10 = load i32, i32* %4
%11 = mul nsw i32 %10, 60
%12 = mul nsw i32 %11, 60
%13 = load i32, i32* %5
%14 = mul nsw i32 %13, 60
%15 = add nsw i32 %12, %14
store i32 %15, i32* %7
%16 = load i32, i32* %6
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %1
%19 = load i32, i32* %7
store i32 %19, i32* %2
br label %23
20: ; preds = %1
%21 = load i32, i32* %7
%22 = sub nsw i32 0, %21
store i32 %22, i32* %2
br label %23
23: ; preds = %20, %18
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @utc_offset_parse(i8* %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%8 = call i32 @utc_offset_hour_min_pos_parse(i8* %0, i32* %2, i32* %3, i32* %4)
%9 = load i32, i32* %2
%10 = mul i32 %9, 3600
%11 = load i32, i32* %3
%12 = mul nsw i32 %11, 60
%13 = add nsw i32 %12, %10
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 0
%16 = sub nsw i32 0, %13
%17 = select i1 %15, i32 %16, i32 %13
ret i32 %17
}