#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 /*<<< orphan*/ state1;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
long fromBaseNum10(char *);
long getTime();
int /*<<< orphan*/ initstate(int /*<<< orphan*/, char *, int);
int random();
int /*<<< orphan*/ setstate(char *);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ toBaseNum10(int, char *);
int shorturl_number_plus_localtime(int argc, const char *argv[]) {
  char szBase10[7] = {
      0x00,
  };
  long dec = 0;
  long timeInput = 0;
  char state1[32];
  initstate(time(NULL), state1, sizeof(state1));
  setstate(state1);
  timeInput = getTime();
  toBaseNum10(random() % 99999, szBase10);
  dec = fromBaseNum10(szBase10);
  fprintf(stdout, "%s", szBase10);
  return 0;
}


x86 assembly (clang, -O0):
<shorturl_number_plus_localtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x17(%rbp),%rdi
xor    %esi,%esi
mov    $0x7,%edx
call   1050 <memset@plt>
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
mov    %eax,%edi
lea    -0x50(%rbp),%rsi
mov    $0x20,%edx
call   1030 <initstate@plt>
lea    -0x50(%rbp),%rdi
call   10b0 <setstate@plt>
mov    $0x0,%al
call   1040 <getTime@plt>
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   10a0 <random@plt>
mov    $0x1869f,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
lea    -0x17(%rbp),%rsi
call   1080 <toBaseNum10@plt>
lea    -0x17(%rbp),%rdi
call   1060 <fromBaseNum10@plt>
mov    %rax,-0x20(%rbp)
mov    0x2dc6(%rip),%rax
mov    (%rax),%edi
lea    -0x17(%rbp),%rdx
lea    0xdd9(%rip),%rsi
call   1070 <fprintf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shorturl_number_plus_localtime>:
push   %rbx
sub    $0x30,%rsp
movl   $0x0,0xb(%rsp)
movl   $0x0,0x8(%rsp)
xor    %edi,%edi
call   1080 <time@plt>
lea    0x10(%rsp),%rbx
mov    %eax,%edi
mov    %rbx,%rsi
mov    $0x20,%edx
call   1030 <initstate@plt>
mov    %rbx,%rdi
call   10a0 <setstate@plt>
xor    %eax,%eax
call   1040 <getTime@plt>
xor    %eax,%eax
call   1090 <random@plt>
movslq %eax,%rdi
imul   $0x29f1868f,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x2e,%rax
add    %ecx,%eax
imul   $0x1869f,%eax,%eax
sub    %eax,%edi
lea    0x8(%rsp),%rbx
mov    %rbx,%rsi
call   1070 <toBaseNum10@plt>
mov    %rbx,%rdi
call   1050 <fromBaseNum10@plt>
mov    0x2ddf(%rip),%rax
mov    (%rax),%edi
lea    0xdf6(%rip),%rsi
mov    %rbx,%rdx
call   1060 <fprintf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @shorturl_number_plus_localtime(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [7 x i8]
%6 = alloca i64
%7 = alloca i64
%8 = alloca [32 x i8]
store i32 %0, i32* %3
store i8** %1, i8*** %4
%9 = bitcast [7 x i8]* %5 to i8*
store i64 0, i64* %6
store i64 0, i64* %7
%10 = call i32 @time(i32* null)
%11 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%12 = call i32 @initstate(i32 %10, i8* %11, i32 32)
%13 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%14 = call i32 @setstate(i8* %13)
%15 = call i64 (...) @getTime()
store i64 %15, i64* %7
%16 = call i32 (...) @random()
%17 = srem i32 %16, 99999
%18 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%19 = call i32 @toBaseNum10(i32 %17, i8* %18)
%20 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%21 = call i64 @fromBaseNum10(i8* %20)
store i64 %21, i64* %6
%22 = load i32, i32* @stdout
%23 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%24 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %23)
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @shorturl_number_plus_localtime(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [7 x i8]
%4 = alloca [32 x i8]
%5 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%7 = tail call i32 @time(i32* null)
%8 = call i32 @initstate(i32 %7, i8* %6, i32 32)
%9 = call i32 @setstate(i8* %6)
%10 = call i64 (...) @getTime()
%11 = call i32 (...) @random()
%12 = srem i32 %11, 99999
%13 = call i32 @toBaseNum10(i32 %12, i8* %5)
%14 = call i64 @fromBaseNum10(i8* %5)
%15 = load i32, i32* @stdout
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
ret i32 0
}