#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*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ sscanf(char *, char *, unsigned int *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
void unixtime2string(char *int_part, char *out_time) {
  unsigned int nutime;
  struct tm *nts;
  char buf1[100];
  char buf2[50];
  sscanf(int_part, "%u", &nutime);
  nts = localtime((time_t *)&nutime);
  strftime(buf1, 100, "%H:%M:%S", nts);
  strcpy(out_time, buf1);
}


x86 assembly (clang, -O0):
<unixtime2string>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea2(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1050 <sscanf@plt>
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x64,%esi
lea    0xe78(%rip),%rdx
call   1060 <strftime@plt>
mov    -0x10(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1040 <strcpy@plt>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unixtime2string>:
push   %r14
push   %rbx
sub    $0x78,%rsp
mov    %rsi,%r14
lea    0xeaf(%rip),%rsi
lea    0xc(%rsp),%rbx
mov    %rbx,%rdx
call   1050 <sscanf@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
lea    0xe96(%rip),%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %rax,%rcx
call   1060 <strftime@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [3 x i8] c"%u\00"
@.str.1 = [9 x i8] c"%H:%M:%S\00"
define void @unixtime2string(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca %struct.tm*
%7 = alloca [100 x i8]
%8 = alloca [50 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%9 = load i8*, i8** %3
%10 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%11 = call %struct.tm* @localtime(i32* %5)
store %struct.tm* %11, %struct.tm** %6
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%13 = load %struct.tm*, %struct.tm** %6
%14 = call i32 @strftime(i8* %12, i32 100, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %13)
%15 = load i8*, i8** %4
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%17 = call i32 @strcpy(i8* %15, i8* %16)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [3 x i8] c"%u\00"
@.str.1 = [9 x i8] c"%H:%M:%S\00"
define void @unixtime2string(i8* nocapture %0, i8* %1) {
%3 = alloca i32
%4 = alloca [100 x i8]
%5 = bitcast i32* %3 to i8*
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%7 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = call %struct.tm* @localtime(i32* %3)
%9 = call i32 @strftime(i8* %6, i32 100, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %8)
%10 = call i32 @strcpy(i8* %1, i8* %6)
ret void
}