#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 parse(char *, char **);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
char *format_time_string(char *buf, char *input) {
  int argc;
  char locbuf[100];
  char *argv[50];
  strcpy(locbuf, input);
  argc = parse(locbuf, argv);
  sprintf(buf, input);
  sprintf(buf, "%s%s%s@%s", argv[2], argv[1], &argv[4][2], argv[3]);
  return buf;
}


x86 assembly (clang, -O0):
<format_time_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x80(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   1040 <parse@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x200(%rbp),%rdx
mov    -0x208(%rbp),%rcx
mov    -0x1f0(%rbp),%r8
add    $0x2,%r8
mov    -0x1f8(%rbp),%r9
lea    0xe63(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<format_time_string>:
push   %r15
push   %r14
push   %rbx
sub    $0x200,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0x190(%rsp),%r15
mov    %r15,%rdi
call   1030 <strcpy@plt>
mov    %rsp,%rsi
mov    %r15,%rdi
call   1040 <parse@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    0x8(%rsp),%rcx
mov    0x10(%rsp),%rdx
mov    0x20(%rsp),%r8
add    $0x2,%r8
mov    0x18(%rsp),%r9
lea    0xe77(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %r14,%rax
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%s%s%s@%s\00"
define i8* @format_time_string(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [100 x i8]
%7 = alloca [50 x i8*]
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%9 = load i8*, i8** %4
%10 = call i32 @strcpy(i8* %8, i8* %9)
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [50 x i8*], [50 x i8*]* %7, i64 0, i64 0
%13 = call i32 @parse(i8* %11, i8** %12)
store i32 %13, i32* %5
%14 = load i8*, i8** %3
%15 = load i8*, i8** %4
%16 = call i32 (i8*, i8*, ...) @sprintf(i8* %14, i8* %15)
%17 = load i8*, i8** %3
%18 = getelementptr inbounds [50 x i8*], [50 x i8*]* %7, i64 0, i64 2
%19 = load i8*, i8** %18
%20 = getelementptr inbounds [50 x i8*], [50 x i8*]* %7, i64 0, i64 1
%21 = load i8*, i8** %20
%22 = getelementptr inbounds [50 x i8*], [50 x i8*]* %7, i64 0, i64 4
%23 = load i8*, i8** %22
%24 = getelementptr inbounds i8, i8* %23, i64 2
%25 = getelementptr inbounds [50 x i8*], [50 x i8*]* %7, i64 0, i64 3
%26 = load i8*, i8** %25
%27 = call i32 (i8*, i8*, ...) @sprintf(i8* %17, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %19, i8* %21, i8* %24, i8* %26)
%28 = load i8*, i8** %3
ret i8* %28
}

LLVM IR (-O2):
@.str = [10 x i8] c"%s%s%s@%s\00"
define i8* @format_time_string(i8* returned writeonly %0, i8* %1) {
%3 = alloca [100 x i8]
%4 = alloca [50 x i8*]
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = bitcast [50 x i8*]* %4 to i8*
%7 = call i32 @strcpy(i8* %5, i8* %1)
%8 = getelementptr inbounds [50 x i8*], [50 x i8*]* %4, i64 0, i64 0
%9 = call i32 @parse(i8* %5, i8** %8)
%10 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%11 = getelementptr inbounds [50 x i8*], [50 x i8*]* %4, i64 0, i64 2
%12 = load i8*, i8** %11
%13 = getelementptr inbounds [50 x i8*], [50 x i8*]* %4, i64 0, i64 1
%14 = load i8*, i8** %13
%15 = getelementptr inbounds [50 x i8*], [50 x i8*]* %4, i64 0, i64 4
%16 = load i8*, i8** %15
%17 = getelementptr inbounds i8, i8* %16, i64 2
%18 = getelementptr inbounds [50 x i8*], [50 x i8*]* %4, i64 0, i64 3
%19 = load i8*, i8** %18
%20 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %14, i8* %17, i8* %19)
ret i8* %0
}