#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 uint8_t;
typedef int uint32_t;

/* Variables and functions */
int custom_str_to_int(char *, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
uint8_t custom_str_to_diff_sec(char *cur_tstamp, char *last_tstamp,
                               uint8_t size, uint32_t *diff) {
  *diff = custom_str_to_int(cur_tstamp, size) -
          custom_str_to_int(last_tstamp, size);
  if (*diff < 255) {
    return 1;
  } else if (*diff < 65535) {
    return 2;
  } else if (*diff < 86400) {
    return 3;
  } else {
    printf("Error in timestamp series EXIT \n");
    exit(0);
  }
}


x86 assembly (clang, -O0):
<custom_str_to_diff_sec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1050 <custom_str_to_int@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1050 <custom_str_to_int@plt>
mov    -0x2c(%rbp),%ecx
sub    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
cmpl   $0xff,(%rax)
jge    1189 <custom_str_to_diff_sec+0x59>
movl   $0x1,-0x4(%rbp)
jmp    11d4 <custom_str_to_diff_sec+0xa4>
mov    -0x28(%rbp),%rax
cmpl   $0xffff,(%rax)
jge    11a5 <custom_str_to_diff_sec+0x75>
movl   $0x2,-0x4(%rbp)
jmp    11d4 <custom_str_to_diff_sec+0xa4>
mov    -0x28(%rbp),%rax
cmpl   $0x15180,(%rax)
jge    11c1 <custom_str_to_diff_sec+0x91>
movl   $0x3,-0x4(%rbp)
jmp    11d4 <custom_str_to_diff_sec+0xa4>
lea    0xe38(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<custom_str_to_diff_sec>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %edx,%ebp
mov    %rsi,%r15
mov    %edx,%esi
call   1050 <custom_str_to_int@plt>
mov    %eax,%ebx
mov    %r15,%rdi
mov    %ebp,%esi
call   1050 <custom_str_to_int@plt>
sub    %eax,%ebx
mov    %ebx,(%r14)
mov    $0x1,%eax
cmp    $0xff,%ebx
jl     117e <custom_str_to_diff_sec+0x4e>
mov    $0x2,%eax
cmp    $0xffff,%ebx
jb     117e <custom_str_to_diff_sec+0x4e>
mov    $0x3,%eax
cmp    $0x15180,%ebx
jae    1189 <custom_str_to_diff_sec+0x59>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe70(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"Error in timestamp series EXIT \0A\00"
define i32 @custom_str_to_diff_sec(i8* %0, i8* %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32* %3, i32** %9
%10 = load i8*, i8** %6
%11 = load i32, i32* %8
%12 = call i32 @custom_str_to_int(i8* %10, i32 %11)
%13 = load i8*, i8** %7
%14 = load i32, i32* %8
%15 = call i32 @custom_str_to_int(i8* %13, i32 %14)
%16 = sub nsw i32 %12, %15
%17 = load i32*, i32** %9
store i32 %16, i32* %17
%18 = load i32*, i32** %9
%19 = load i32, i32* %18
%20 = icmp slt i32 %19, 255
br i1 %20, label %21, label %22
21: ; preds = %4
store i32 1, i32* %5
br label %35
22: ; preds = %4
%23 = load i32*, i32** %9
%24 = load i32, i32* %23
%25 = icmp slt i32 %24, 65535
br i1 %25, label %26, label %27
26: ; preds = %22
store i32 2, i32* %5
br label %35
27: ; preds = %22
%28 = load i32*, i32** %9
%29 = load i32, i32* %28
%30 = icmp slt i32 %29, 86400
br i1 %30, label %31, label %32
31: ; preds = %27
store i32 3, i32* %5
br label %35
32: ; preds = %27
%33 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%34 = call i32 @exit(i32 0)
unreachable
35: ; preds = %31, %26, %21
%36 = load i32, i32* %5
ret i32 %36
}

LLVM IR (-O2):
@str = [32 x i8] c"Error in timestamp series EXIT \00"
define i32 @custom_str_to_diff_sec(i8* %0, i8* %1, i32 %2, i32* nocapture writeonly %3) {
%5 = tail call i32 @custom_str_to_int(i8* %0, i32 %2)
%6 = tail call i32 @custom_str_to_int(i8* %1, i32 %2)
%7 = sub nsw i32 %5, %6
store i32 %7, i32* %3
%8 = icmp slt i32 %7, 255
br i1 %8, label %16, label %9
9: ; preds = %4
%10 = icmp ult i32 %7, 65535
br i1 %10, label %16, label %11
11: ; preds = %9
%12 = icmp ult i32 %7, 86400
br i1 %12, label %16, label %13
13: ; preds = %11
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%15 = tail call i32 @exit(i32 0)
unreachable
16: ; preds = %11, %9, %4
%17 = phi i32 [ 1, %4 ], [ 2, %9 ], [ 3, %11 ]
ret i32 %17
}