#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 get_tz_dst();
int get_tz_min();
int ksft_exit_fail();
int ksft_exit_pass();
int /*<<< orphan*/ printf(char *, ...);
int set_tz(int, int);
int main(int argc, char **argv) {
  int i, ret;
  int min, dst;
  min = get_tz_min();
  dst = get_tz_dst();
  printf("tz_minuteswest started at %i, dst at %i\n", min, dst);
  printf("Checking tz_minuteswest can be properly set: ");
  for (i = -15 * 60; i < 15 * 60; i += 30) {
    ret = set_tz(i, dst);
    ret = get_tz_min();
    if (ret != i) {
      printf("[FAILED] expected: %i got %i\n", i, ret);
      goto err;
    }
  }
  printf("[OK]\n");
  printf("Checking invalid tz_minuteswest values are caught: ");
  if (!set_tz(-15 * 60 - 1, dst)) {
    printf("[FAILED] %i didn't return failure!\n", -15 * 60 - 1);
    goto err;
  }
  if (!set_tz(15 * 60 + 1, dst)) {
    printf("[FAILED] %i didn't return failure!\n", 15 * 60 + 1);
    goto err;
  }
  if (!set_tz(-24 * 60, dst)) {
    printf("[FAILED] %i didn't return failure!\n", -24 * 60);
    goto err;
  }
  if (!set_tz(24 * 60, dst)) {
    printf("[FAILED] %i didn't return failure!\n", 24 * 60);
    goto err;
  }
  printf("[OK]\n");
  set_tz(min, dst);
  return ksft_exit_pass();
err:
  set_tz(min, dst);
  return ksft_exit_fail();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1070 <get_tz_min@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1080 <get_tz_dst@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xfffffc7c,-0x14(%rbp)
cmpl   $0x384,-0x14(%rbp)
jge    1210 <main+0xb0>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1030 <set_tz@plt>
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1070 <get_tz_min@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     11fd <main+0x9d>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    130c <main+0x1ac>
jmp    1202 <main+0xa2>
mov    -0x14(%rbp),%eax
add    $0x1e,%eax
mov    %eax,-0x14(%rbp)
jmp    11b3 <main+0x53>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%esi
mov    $0xfffffc7b,%edi
call   1030 <set_tz@plt>
cmp    $0x0,%eax
jne    125a <main+0xfa>
lea    0xe66(%rip),%rdi
mov    $0xfffffc7b,%esi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    130c <main+0x1ac>
mov    -0x20(%rbp),%esi
mov    $0x385,%edi
call   1030 <set_tz@plt>
cmp    $0x0,%eax
jne    1288 <main+0x128>
lea    0xe38(%rip),%rdi
mov    $0x385,%esi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    130c <main+0x1ac>
mov    -0x20(%rbp),%esi
mov    $0xfffffa60,%edi
call   1030 <set_tz@plt>
cmp    $0x0,%eax
jne    12b6 <main+0x156>
lea    0xe0a(%rip),%rdi
mov    $0xfffffa60,%esi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    130c <main+0x1ac>
mov    -0x20(%rbp),%esi
mov    $0x5a0,%edi
call   1030 <set_tz@plt>
cmp    $0x0,%eax
jne    12e4 <main+0x184>
lea    0xddc(%rip),%rdi
mov    $0x5a0,%esi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    130c <main+0x1ac>
lea    0xd8a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1030 <set_tz@plt>
mov    $0x0,%al
call   1040 <ksft_exit_pass@plt>
mov    %eax,-0x4(%rbp)
jmp    1321 <main+0x1c1>
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1030 <set_tz@plt>
mov    $0x0,%al
call   1050 <ksft_exit_fail@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1080 <get_tz_min@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1090 <get_tz_dst@plt>
mov    %eax,%ebp
lea    0xe72(%rip),%rdi
mov    %r14d,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe88(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xfffffc5e,%ebx
nopl   (%rax)
add    $0x1e,%ebx
mov    %ebx,%edi
mov    %ebp,%esi
call   1030 <set_tz@plt>
xor    %eax,%eax
call   1080 <get_tz_min@plt>
cmp    %eax,%ebx
jne    124e <main+0xde>
cmp    $0x366,%ebx
jl     11b0 <main+0x40>
lea    0xef3(%rip),%rdi
call   1040 <puts@plt>
lea    0xe8f(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xfffffc7b,%edi
mov    %ebp,%esi
call   1030 <set_tz@plt>
test   %eax,%eax
je     1262 <main+0xf2>
mov    $0x385,%edi
mov    %ebp,%esi
call   1030 <set_tz@plt>
test   %eax,%eax
je     1270 <main+0x100>
mov    $0xfffffa60,%edi
mov    %ebp,%esi
call   1030 <set_tz@plt>
test   %eax,%eax
je     127e <main+0x10e>
mov    $0x5a0,%edi
mov    %ebp,%esi
call   1030 <set_tz@plt>
test   %eax,%eax
je     128c <main+0x11c>
lea    0xe99(%rip),%rdi
call   1040 <puts@plt>
mov    %r14d,%edi
mov    %ebp,%esi
call   1030 <set_tz@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <ksft_exit_pass@plt>
lea    0xe02(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1070 <printf@plt>
jmp    129f <main+0x12f>
lea    0xe40(%rip),%rdi
mov    $0xfffffc7b,%esi
jmp    1298 <main+0x128>
lea    0xe32(%rip),%rdi
mov    $0x385,%esi
jmp    1298 <main+0x128>
lea    0xe24(%rip),%rdi
mov    $0xfffffa60,%esi
jmp    1298 <main+0x128>
lea    0xe16(%rip),%rdi
mov    $0x5a0,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r14d,%edi
mov    %ebp,%esi
call   1030 <set_tz@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <ksft_exit_fail@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"tz_minuteswest started at %i, dst at %i\0A\00"
@.str.1 = [46 x i8] c"Checking tz_minuteswest can be properly set: \00"
@.str.2 = [30 x i8] c"[FAILED] expected: %i got %i\0A\00"
@.str.3 = [6 x i8] c"[OK]\0A\00"
@.str.4 = [52 x i8] c"Checking invalid tz_minuteswest values are caught: \00"
@.str.5 = [36 x i8] c"[FAILED] %i didn't return failure!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 (...) @get_tz_min()
store i32 %10, i32* %8
%11 = call i32 (...) @get_tz_dst()
store i32 %11, i32* %9
%12 = load i32, i32* %8
%13 = load i32, i32* %9
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
store i32 -900, i32* %6
br label %16
16: ; preds = %32, %2
%17 = load i32, i32* %6
%18 = icmp slt i32 %17, 900
br i1 %18, label %19, label %35
19: ; preds = %16
%20 = load i32, i32* %6
%21 = load i32, i32* %9
%22 = call i32 @set_tz(i32 %20, i32 %21)
store i32 %22, i32* %7
%23 = call i32 (...) @get_tz_min()
store i32 %23, i32* %7
%24 = load i32, i32* %7
%25 = load i32, i32* %6
%26 = icmp ne i32 %24, %25
br i1 %26, label %27, label %31
27: ; preds = %19
%28 = load i32, i32* %6
%29 = load i32, i32* %7
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %28, i32 %29)
br label %67
31: ; preds = %19
br label %32
32: ; preds = %31
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 30
store i32 %34, i32* %6
br label %16
35: ; preds = %16
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0))
%38 = load i32, i32* %9
%39 = call i32 @set_tz(i32 -901, i32 %38)
%40 = icmp ne i32 %39, 0
br i1 %40, label %43, label %41
41: ; preds = %35
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 -901)
br label %67
43: ; preds = %35
%44 = load i32, i32* %9
%45 = call i32 @set_tz(i32 901, i32 %44)
%46 = icmp ne i32 %45, 0
br i1 %46, label %49, label %47
47: ; preds = %43
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 901)
br label %67
49: ; preds = %43
%50 = load i32, i32* %9
%51 = call i32 @set_tz(i32 -1440, i32 %50)
%52 = icmp ne i32 %51, 0
br i1 %52, label %55, label %53
53: ; preds = %49
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 -1440)
br label %67
55: ; preds = %49
%56 = load i32, i32* %9
%57 = call i32 @set_tz(i32 1440, i32 %56)
%58 = icmp ne i32 %57, 0
br i1 %58, label %61, label %59
59: ; preds = %55
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 1440)
br label %67
61: ; preds = %55
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%63 = load i32, i32* %8
%64 = load i32, i32* %9
%65 = call i32 @set_tz(i32 %63, i32 %64)
%66 = call i32 (...) @ksft_exit_pass()
store i32 %66, i32* %3
br label %72
67: ; preds = %59, %53, %47, %41, %27
%68 = load i32, i32* %8
%69 = load i32, i32* %9
%70 = call i32 @set_tz(i32 %68, i32 %69)
%71 = call i32 (...) @ksft_exit_fail()
store i32 %71, i32* %3
br label %72
72: ; preds = %67, %61
%73 = load i32, i32* %3
ret i32 %73
}

LLVM IR (-O2):
@.str = [41 x i8] c"tz_minuteswest started at %i, dst at %i\0A\00"
@.str.1 = [46 x i8] c"Checking tz_minuteswest can be properly set: \00"
@.str.2 = [30 x i8] c"[FAILED] expected: %i got %i\0A\00"
@.str.4 = [52 x i8] c"Checking invalid tz_minuteswest values are caught: \00"
@.str.5 = [36 x i8] c"[FAILED] %i didn't return failure!\0A\00"
@str.6 = [5 x i8] c"[OK]\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @get_tz_min()
%4 = tail call i32 (...) @get_tz_dst()
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %2, %14
%8 = phi i32 [ -900, %2 ], [ %15, %14 ]
%9 = tail call i32 @set_tz(i32 %8, i32 %4)
%10 = tail call i32 (...) @get_tz_min()
%11 = icmp eq i32 %10, %8
br i1 %11, label %14, label %12
12: ; preds = %7
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %8, i32 %10)
br label %43
14: ; preds = %7
%15 = add nsw i32 %8, 30
%16 = icmp slt i32 %8, 870
br i1 %16, label %7, label %17
17: ; preds = %14
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.6, i64 0, i64 0))
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0))
%20 = tail call i32 @set_tz(i32 -901, i32 %4)
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %17
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 -901)
br label %43
24: ; preds = %17
%25 = tail call i32 @set_tz(i32 901, i32 %4)
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 901)
br label %43
29: ; preds = %24
%30 = tail call i32 @set_tz(i32 -1440, i32 %4)
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 -1440)
br label %43
34: ; preds = %29
%35 = tail call i32 @set_tz(i32 1440, i32 %4)
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 1440)
br label %43
39: ; preds = %34
%40 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.6, i64 0, i64 0))
%41 = tail call i32 @set_tz(i32 %3, i32 %4)
%42 = tail call i32 (...) @ksft_exit_pass()
br label %46
43: ; preds = %37, %32, %27, %22, %12
%44 = tail call i32 @set_tz(i32 %3, i32 %4)
%45 = tail call i32 (...) @ksft_exit_fail()
br label %46
46: ; preds = %43, %39
%47 = phi i32 [ %45, %43 ], [ %42, %39 ]
ret i32 %47
}