#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 /*<<< orphan*/ sprintf(char *, char *, int, int, int);
double wsys_utc_offset();
char *wsys_utc_string(void) {
  double tz;
  int c, hr, min;
  static char buf[8];
  tz = wsys_utc_offset();
  if (tz < 0) {
    tz = -tz;
    c = '-';
  } else
    c = '+';
  hr = (int)(tz + 1e-6);
  min = (tz - hr) * 60;
  min = (min + 8) / 15;
  min *= 15;
  sprintf(buf, "%c%02d'%02d", c, hr % 24, min);
  return (buf);
}


x86 assembly (clang, -O0):
<wsys_utc_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1030 <wsys_utc_offset@plt>
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    116f <wsys_utc_string+0x4f>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movl   $0x2d,-0xc(%rbp)
jmp    1176 <wsys_utc_string+0x56>
movl   $0x2b,-0xc(%rbp)
movsd  0xe8a(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
cvtsi2sdl -0x10(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe60(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x8,%eax
mov    $0xf,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
imul   $0xf,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x18,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%r8d
lea    0x2e4d(%rip),%rdi
lea    0xe25(%rip),%rsi
call   1040 <sprintf@plt>
lea    0x2e3a(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wsys_utc_string>:
push   %rbx
xor    %eax,%eax
call   1030 <wsys_utc_offset@plt>
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
seta   %al
lea    0x2b(%rax,%rax,1),%edx
jbe    1143 <wsys_utc_string+0x23>
xorpd  0xebd(%rip),%xmm0
movsd  0xec5(%rip),%xmm1
addsd  %xmm0,%xmm1
cvttsd2si %xmm1,%eax
cvttpd2dq %xmm1,%xmm1
cvtdq2pd %xmm1,%xmm1
subsd  %xmm1,%xmm0
mulsd  0xeb1(%rip),%xmm0
cvttsd2si %xmm0,%ecx
mov    %ecx,%esi
add    $0x8,%esi
movslq %esi,%rsi
imul   $0xffffffff88888889,%rsi,%rsi
shr    $0x20,%rsi
add    %esi,%ecx
add    $0x8,%ecx
mov    %ecx,%esi
shr    $0x1f,%esi
sar    $0x3,%ecx
add    %esi,%ecx
lea    (%rcx,%rcx,4),%ecx
lea    (%rcx,%rcx,2),%r8d
movslq %eax,%rcx
imul   $0x2aaaaaab,%rcx,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
shr    $0x22,%rax
add    %esi,%eax
shl    $0x3,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%ecx
lea    0x2e77(%rip),%rbx
lea    0xe5f(%rip),%rsi
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@wsys_utc_string.buf = internal global [8 x i8] zeroinitializer
@.str = [12 x i8] c"%c%02d'%02d\00"
define i8* @wsys_utc_string() {
%1 = alloca double
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call double (...) @wsys_utc_offset()
store double %5, double* %1
%6 = load double, double* %1
%7 = fcmp olt double %6, 0.000000e+00
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = load double, double* %1
%10 = fneg double %9
store double %10, double* %1
store i32 45, i32* %2
br label %12
11: ; preds = %0
store i32 43, i32* %2
br label %12
12: ; preds = %11, %8
%13 = load double, double* %1
%14 = fadd double %13, 0x3EB0C6F7A0B5ED8D
%15 = fptosi double %14 to i32
store i32 %15, i32* %3
%16 = load double, double* %1
%17 = load i32, i32* %3
%18 = sitofp i32 %17 to double
%19 = fsub double %16, %18
%20 = fmul double %19, 6.000000e+01
%21 = fptosi double %20 to i32
store i32 %21, i32* %4
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 8
%24 = sdiv i32 %23, 15
store i32 %24, i32* %4
%25 = load i32, i32* %4
%26 = mul nsw i32 %25, 15
store i32 %26, i32* %4
%27 = load i32, i32* %2
%28 = load i32, i32* %3
%29 = srem i32 %28, 24
%30 = load i32, i32* %4
%31 = call i32 @sprintf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @wsys_utc_string.buf, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %27, i32 %29, i32 %30)
ret i8* getelementptr inbounds ([8 x i8], [8 x i8]* @wsys_utc_string.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@wsys_utc_string.buf = internal global [8 x i8] zeroinitializer
@.str = [12 x i8] c"%c%02d'%02d\00"
define i8* @wsys_utc_string() {
%1 = tail call double (...) @wsys_utc_offset()
%2 = fcmp olt double %1, 0.000000e+00
%3 = fneg double %1
%4 = select i1 %2, i32 45, i32 43
%5 = select i1 %2, double %3, double %1
%6 = fadd double %5, 0x3EB0C6F7A0B5ED8D
%7 = fptosi double %6 to i32
%8 = sitofp i32 %7 to double
%9 = fsub double %5, %8
%10 = fmul double %9, 6.000000e+01
%11 = fptosi double %10 to i32
%12 = add nsw i32 %11, 8
%13 = srem i32 %12, 15
%14 = sub i32 %12, %13
%15 = srem i32 %7, 24
%16 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @wsys_utc_string.buf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %15, i32 %14)
ret i8* getelementptr inbounds ([8 x i8], [8 x i8]* @wsys_utc_string.buf, i64 0, i64 0)
}