#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 *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int getSysTime(char *recv, int len, char *result) {
  char day[3];
  if (len != 8) {
    sprintf(result, "Systemzeit: Len <>8 Bytes");
    return (0);
  }
  switch (recv[4]) {
  case 0:
    strcpy(day, "So");
    break;
  case 1:
    strcpy(day, "Mo");
    break;
  case 2:
    strcpy(day, "Di");
    break;
  case 3:
    strcpy(day, "Mi");
    break;
  case 4:
    strcpy(day, "Do");
    break;
  case 5:
    strcpy(day, "Fr");
    break;
  case 6:
    strcpy(day, "Sa");
    break;
  case 7:
    strcpy(day, "So");
    break;
  default:
    sprintf(result, "Fehler Tagwandlung: %02X", recv[4]);
    return (0);
  }
  sprintf(result, "%s,%02X.%02X.%02X%02X %02x:%02X:%02X", day, recv[3], recv[2],
          recv[0], recv[1], recv[5], recv[6], recv[7]);
  return (1);
}


x86 assembly (clang, -O0):
<getSysTime>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x58,%rsp
mov    %rdi,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
mov    %rdx,-0x28(%rbp)
cmpl   $0x8,-0x1c(%rbp)
je     115c <getSysTime+0x3c>
mov    -0x28(%rbp),%rdi
lea    0xed7(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
movl   $0x0,-0xc(%rbp)
jmp    12be <getSysTime+0x19e>
mov    -0x18(%rbp),%rax
movsbl 0x4(%rax),%eax
mov    %eax,%ecx
mov    %rcx,-0x38(%rbp)
sub    $0x7,%eax
ja     122f <getSysTime+0x10f>
mov    -0x38(%rbp),%rax
lea    0xe82(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    -0x2b(%rbp),%rdi
lea    0xea8(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1255 <getSysTime+0x135>
lea    -0x2b(%rbp),%rdi
lea    0xe96(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1255 <getSysTime+0x135>
lea    -0x2b(%rbp),%rdi
lea    0xe84(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1255 <getSysTime+0x135>
lea    -0x2b(%rbp),%rdi
lea    0xe72(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1255 <getSysTime+0x135>
lea    -0x2b(%rbp),%rdi
lea    0xe60(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1255 <getSysTime+0x135>
lea    -0x2b(%rbp),%rdi
lea    0xe4e(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1255 <getSysTime+0x135>
lea    -0x2b(%rbp),%rdi
lea    0xe3c(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1255 <getSysTime+0x135>
lea    -0x2b(%rbp),%rdi
lea    0xe15(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1255 <getSysTime+0x135>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rax
movsbl 0x4(%rax),%edx
lea    0xe0d(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
movl   $0x0,-0xc(%rbp)
jmp    12be <getSysTime+0x19e>
mov    -0x28(%rbp),%rdi
lea    -0x2b(%rbp),%rdx
mov    -0x18(%rbp),%rax
movsbl 0x3(%rax),%ecx
mov    -0x18(%rbp),%rax
movsbl 0x2(%rax),%r8d
mov    -0x18(%rbp),%rax
movsbl (%rax),%r9d
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%ebx
mov    -0x18(%rbp),%rax
movsbl 0x5(%rax),%r11d
mov    -0x18(%rbp),%rax
movsbl 0x6(%rax),%r10d
mov    -0x18(%rbp),%rax
movsbl 0x7(%rax),%eax
lea    0xdc9(%rip),%rsi
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
mov    $0x0,%al
call   1040 <sprintf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x58,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<getSysTime>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
cmp    $0x8,%esi
jne    11a0 <getSysTime+0x80>
mov    %rdi,%rbx
movsbl 0x4(%rdi),%edx
cmp    $0x8,%edx
jae    11bb <getSysTime+0x9b>
movslq %edx,%rax
lea    0xf2a(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
lea    0x5(%rsp),%r15
mov    %r15,%rdi
call   1030 <strcpy@plt>
movsbl 0x3(%rbx),%ecx
movsbl 0x2(%rbx),%r8d
movsbl (%rbx),%r9d
movsbl 0x1(%rbx),%r10d
movsbl 0x5(%rbx),%r11d
movsbl 0x6(%rbx),%r12d
movsbl 0x7(%rbx),%ebx
lea    0xec7(%rip),%rsi
mov    %r14,%rdi
mov    %r15,%rdx
xor    %eax,%eax
push   %rbx
push   %r12
push   %r11
push   %r10
call   1040 <sprintf@plt>
add    $0x20,%rsp
mov    $0x1,%ebx
jmp    11ce <getSysTime+0xae>
movups 0xe63(%rip),%xmm0
movups %xmm0,0xa(%r14)
movups 0xe4d(%rip),%xmm0
movups %xmm0,(%r14)
xor    %ebx,%ebx
jmp    11ce <getSysTime+0xae>
lea    0xe6d(%rip),%rsi
xor    %ebx,%ebx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Systemzeit: Len <>8 Bytes\00"
@.str.1 = [3 x i8] c"So\00"
@.str.2 = [3 x i8] c"Mo\00"
@.str.3 = [3 x i8] c"Di\00"
@.str.4 = [3 x i8] c"Mi\00"
@.str.5 = [3 x i8] c"Do\00"
@.str.6 = [3 x i8] c"Fr\00"
@.str.7 = [3 x i8] c"Sa\00"
@.str.8 = [25 x i8] c"Fehler Tagwandlung: %02X\00"
@.str.9 = [37 x i8] c"%s,%02X.%02X.%02X%02X %02x:%02X:%02X\00"
define i32 @getSysTime(i8* %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca [3 x i8]
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
%9 = load i32, i32* %6
%10 = icmp ne i32 %9, 8
br i1 %10, label %11, label %14
11: ; preds = %3
%12 = load i8*, i8** %7
%13 = call i32 (i8*, i8*, ...) @sprintf(i8* %12, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %82
14: ; preds = %3
%15 = load i8*, i8** %5
%16 = getelementptr inbounds i8, i8* %15, i64 4
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
switch i32 %18, label %43 [
i32 0, label %19
i32 1, label %22
i32 2, label %25
i32 3, label %28
i32 4, label %31
i32 5, label %34
i32 6, label %37
i32 7, label %40
]
19: ; preds = %14
%20 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%21 = call i32 @strcpy(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %50
22: ; preds = %14
%23 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%24 = call i32 @strcpy(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %50
25: ; preds = %14
%26 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%27 = call i32 @strcpy(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %50
28: ; preds = %14
%29 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%30 = call i32 @strcpy(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %50
31: ; preds = %14
%32 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%33 = call i32 @strcpy(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %50
34: ; preds = %14
%35 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%36 = call i32 @strcpy(i8* %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %50
37: ; preds = %14
%38 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%39 = call i32 @strcpy(i8* %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
br label %50
40: ; preds = %14
%41 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%42 = call i32 @strcpy(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %50
43: ; preds = %14
%44 = load i8*, i8** %7
%45 = load i8*, i8** %5
%46 = getelementptr inbounds i8, i8* %45, i64 4
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = call i32 (i8*, i8*, ...) @sprintf(i8* %44, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %48)
store i32 0, i32* %4
br label %82
50: ; preds = %40, %37, %34, %31, %28, %25, %22, %19
%51 = load i8*, i8** %7
%52 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%53 = load i8*, i8** %5
%54 = getelementptr inbounds i8, i8* %53, i64 3
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = load i8*, i8** %5
%58 = getelementptr inbounds i8, i8* %57, i64 2
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = load i8*, i8** %5
%62 = getelementptr inbounds i8, i8* %61, i64 0
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = load i8*, i8** %5
%66 = getelementptr inbounds i8, i8* %65, i64 1
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
%69 = load i8*, i8** %5
%70 = getelementptr inbounds i8, i8* %69, i64 5
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = load i8*, i8** %5
%74 = getelementptr inbounds i8, i8* %73, i64 6
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = load i8*, i8** %5
%78 = getelementptr inbounds i8, i8* %77, i64 7
%79 = load i8, i8* %78
%80 = sext i8 %79 to i32
%81 = call i32 (i8*, i8*, ...) @sprintf(i8* %51, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.9, i64 0, i64 0), i8* %52, i32 %56, i32 %60, i32 %64, i32 %68, i32 %72, i32 %76, i32 %80)
store i32 1, i32* %4
br label %82
82: ; preds = %50, %43, %11
%83 = load i32, i32* %4
ret i32 %83
}

LLVM IR (-O2):
@.str = [26 x i8] c"Systemzeit: Len <>8 Bytes\00"
@.str.1 = [3 x i8] c"So\00"
@.str.2 = [3 x i8] c"Mo\00"
@.str.3 = [3 x i8] c"Di\00"
@.str.4 = [3 x i8] c"Mi\00"
@.str.5 = [3 x i8] c"Do\00"
@.str.6 = [3 x i8] c"Fr\00"
@.str.7 = [3 x i8] c"Sa\00"
@.str.8 = [25 x i8] c"Fehler Tagwandlung: %02X\00"
@.str.9 = [37 x i8] c"%s,%02X.%02X.%02X%02X %02x:%02X:%02X\00"
@reltable.getSysTime = [8 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.1 to i64), i64 ptrtoint ([8 x i32]* @reltable.getSysTime to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.2 to i64), i64 ptrtoint ([8 x i32]* @reltable.getSysTime to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.3 to i64), i64 ptrtoint ([8 x i32]* @reltable.getSysTime to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.4 to i64), i64 ptrtoint ([8 x i32]* @reltable.getSysTime to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.5 to i64), i64 ptrtoint ([8 x i32]* @reltable.getSysTime to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.6 to i64), i64 ptrtoint ([8 x i32]* @reltable.getSysTime to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.7 to i64), i64 ptrtoint ([8 x i32]* @reltable.getSysTime to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.1 to i64), i64 ptrtoint ([8 x i32]* @reltable.getSysTime to i64)) to i32)]
define i32 @getSysTime(i8* nocapture %0, i32 %1, i8* nocapture writeonly %2) {
%4 = alloca [3 x i8]
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%6 = icmp eq i32 %1, 8
br i1 %6, label %8, label %7
7: ; preds = %3
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(26) %2, i8* align 1 dereferenceable(26) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i64 26, i1 false)
br label %41
8: ; preds = %3
%9 = getelementptr inbounds i8, i8* %0, i64 4
%10 = load i8, i8* %9
%11 = icmp ult i8 %10, 8
br i1 %11, label %15, label %12
12: ; preds = %8
%13 = sext i8 %10 to i32
%14 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %13)
br label %41
15: ; preds = %8
%16 = sext i8 %10 to i64
%17 = shl i64 %16, 2
%18 = call i8* @llvm.load.relative.i64(i8* bitcast ([8 x i32]* @reltable.getSysTime to i8*), i64 %17)
%19 = call i32 @strcpy(i8* %5, i8* %18)
%20 = getelementptr inbounds i8, i8* %0, i64 3
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = getelementptr inbounds i8, i8* %0, i64 2
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = load i8, i8* %0
%27 = sext i8 %26 to i32
%28 = getelementptr inbounds i8, i8* %0, i64 1
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = getelementptr inbounds i8, i8* %0, i64 5
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = getelementptr inbounds i8, i8* %0, i64 6
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = getelementptr inbounds i8, i8* %0, i64 7
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.9, i64 0, i64 0), i8* %5, i32 %22, i32 %25, i32 %27, i32 %30, i32 %33, i32 %36, i32 %39)
br label %41
41: ; preds = %15, %12, %7
%42 = phi i32 [ 0, %7 ], [ 0, %12 ], [ 1, %15 ]
ret i32 %42
}