#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 /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *shef_upload_datatype_get_key(char *datatype_name, char *measurement_date,
                                   char *measurement_time) {
  static char key[128];
  char hour[3] = {0};
  strncpy(hour, measurement_time, 2);
  sprintf(key, "%s^%s^%s", datatype_name, measurement_date, hour);
  return key;
}


x86 assembly (clang, -O0):
<shef_upload_datatype_get_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x1b(%rbp),%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1040 <memset@plt>
lea    -0x1b(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    -0x1b(%rbp),%r8
lea    0x2ed7(%rip),%rdi
lea    0xe80(%rip),%rsi
call   1050 <sprintf@plt>
lea    0x2ec4(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shef_upload_datatype_get_key>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
movb   $0x0,0x6(%rsp)
movw   $0x0,0x4(%rsp)
lea    0x4(%rsp),%r15
mov    %r15,%rdi
mov    %rdx,%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
lea    0x2eea(%rip),%r12
lea    0xea3(%rip),%rsi
mov    %r12,%rdi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    %r15,%r8
call   1040 <sprintf@plt>
mov    %r12,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@shef_upload_datatype_get_key.key = internal global [128 x i8] zeroinitializer
@.str = [9 x i8] c"%s^%s^%s\00"
define i8* @shef_upload_datatype_get_key(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [3 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = bitcast [3 x i8]* %7 to i8*
%9 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 0, i64 0
%10 = load i8*, i8** %6
%11 = call i32 @strncpy(i8* %9, i8* %10, i32 2)
%12 = load i8*, i8** %4
%13 = load i8*, i8** %5
%14 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 0, i64 0
%15 = call i32 @sprintf(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @shef_upload_datatype_get_key.key, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %13, i8* %14)
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @shef_upload_datatype_get_key.key, i64 0, i64 0)
}

LLVM IR (-O2):
@shef_upload_datatype_get_key.key = internal global [128 x i8] zeroinitializer
@.str = [9 x i8] c"%s^%s^%s\00"
define i8* @shef_upload_datatype_get_key(i8* %0, i8* %1, i8* %2) {
%4 = alloca [3 x i8]
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%6 = call i32 @strncpy(i8* %5, i8* %2, i32 2)
%7 = call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([128 x i8], [128 x i8]* @shef_upload_datatype_get_key.key, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i8* %5)
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @shef_upload_datatype_get_key.key, i64 0, i64 0)
}