#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 atoi(char *);
char *getenv(char *);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/, char *, int);
int timezone;
int /*<<< orphan*/ *tzname;
void tzset(void) {
  char *tz = getenv("TZ");
  if (tz == NULL) {
    memcpy(tzname[1], "GMT", 3);
    timezone = 0 * 60 * 60L;
  } else {
    int v;
    memcpy(tzname[1], tz, 3);
    v = atoi(tz + 3);
    timezone = -((v / 100) * 60 + (v % 100)) * 60L;
  }
}


x86 assembly (clang, -O0):
<tzset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1183 <tzset+0x53>
mov    0x2e7e(%rip),%rax
mov    (%rax),%rax
mov    0x4(%rax),%edi
lea    0xe9c(%rip),%rsi
mov    $0x3,%edx
call   1040 <memcpy@plt>
mov    0x2e68(%rip),%rax
movl   $0x0,(%rax)
jmp    11de <tzset+0xae>
mov    0x2e4e(%rip),%rax
mov    (%rax),%rax
mov    0x4(%rax),%edi
mov    -0x8(%rbp),%rsi
mov    $0x3,%edx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rdi
add    $0x3,%rdi
call   1050 <atoi@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
imul   $0x3c,%eax,%ecx
mov    -0xc(%rbp),%eax
mov    $0x64,%esi
cltd
idiv   %esi
add    %edx,%ecx
xor    %eax,%eax
sub    %ecx,%eax
cltq
imul   $0x3c,%rax,%rax
mov    %eax,%ecx
mov    0x2e04(%rip),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tzset>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
mov    0x2e91(%rip),%rax
mov    (%rax),%rax
mov    0x4(%rax),%edi
test   %rbx,%rbx
je     1190 <tzset+0x60>
mov    %rbx,%rsi
mov    $0x3,%edx
call   1040 <memcpy@plt>
add    $0x3,%rbx
mov    %rbx,%rdi
call   1050 <atoi@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0xffffffc4,%ecx,%edx
imul   $0x64,%ecx,%ecx
sub    %eax,%ecx
add    %edx,%ecx
imul   $0x3c,%ecx,%eax
jmp    11a3 <tzset+0x73>
lea    0xe6c(%rip),%rsi
mov    $0x3,%edx
call   1040 <memcpy@plt>
xor    %eax,%eax
mov    0x2e36(%rip),%rcx
mov    %eax,(%rcx)
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"TZ\00"
@tzname = global i32* null
@.str.1 = [4 x i8] c"GMT\00"
@timezone = global i32 0
define void @tzset() {
%1 = alloca i8*
%2 = alloca i32
%3 = call i8* @getenv(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %11
6: ; preds = %0
%7 = load i32*, i32** @tzname
%8 = getelementptr inbounds i32, i32* %7, i64 1
%9 = load i32, i32* %8
%10 = call i32 @memcpy(i32 %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
store i32 0, i32* @timezone
br label %30
11: ; preds = %0
%12 = load i32*, i32** @tzname
%13 = getelementptr inbounds i32, i32* %12, i64 1
%14 = load i32, i32* %13
%15 = load i8*, i8** %1
%16 = call i32 @memcpy(i32 %14, i8* %15, i32 3)
%17 = load i8*, i8** %1
%18 = getelementptr inbounds i8, i8* %17, i64 3
%19 = call i32 @atoi(i8* %18)
store i32 %19, i32* %2
%20 = load i32, i32* %2
%21 = sdiv i32 %20, 100
%22 = mul nsw i32 %21, 60
%23 = load i32, i32* %2
%24 = srem i32 %23, 100
%25 = add nsw i32 %22, %24
%26 = sub nsw i32 0, %25
%27 = sext i32 %26 to i64
%28 = mul nsw i64 %27, 60
%29 = trunc i64 %28 to i32
store i32 %29, i32* @timezone
br label %30
30: ; preds = %11, %6
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"TZ\00"
@tzname = global i32* null
@.str.1 = [4 x i8] c"GMT\00"
@timezone = global i32 0
define void @tzset() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
%3 = load i32*, i32** @tzname
%4 = getelementptr inbounds i32, i32* %3, i64 1
%5 = load i32, i32* %4
br i1 %2, label %6, label %8
6: ; preds = %0
%7 = tail call i32 @memcpy(i32 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
br label %17
8: ; preds = %0
%9 = tail call i32 @memcpy(i32 %5, i8* %1, i32 3)
%10 = getelementptr inbounds i8, i8* %1, i64 3
%11 = tail call i32 @atoi(i8* %10)
%12 = sdiv i32 %11, 100
%13 = mul nsw i32 %12, -60
%14 = srem i32 %11, 100
%15 = sub nsw i32 %13, %14
%16 = mul i32 %15, 60
br label %17
17: ; preds = %8, %6
%18 = phi i32 [ %16, %8 ], [ 0, %6 ]
store i32 %18, i32* @timezone
ret void
}