#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 date_dos2unix(unsigned short, unsigned short);
int /*<<< orphan*/ isxdigit(char);
int strlen(char *);
unsigned short strtoul(char *, char **, int);
int yapp2unix(char *ytime) {
  int i;
  unsigned short time, date;
  if (strlen(ytime) != 8)
    return 0;
  for (i = 0; i < 8; i++)
    if (!isxdigit(ytime[i]))
      return 0;
  time = strtoul(ytime + 4, (char **)NULL, 16);
  ytime[4] = 0;
  date = strtoul(ytime, (char **)NULL, 16);
  return (date_dos2unix(time, date));
}


x86 assembly (clang, -O0):
<yapp2unix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x8,%eax
je     116a <yapp2unix+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    11ff <yapp2unix+0xbf>
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    11b4 <yapp2unix+0x74>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1060 <isxdigit@plt>
cmp    $0x0,%eax
jne    11a1 <yapp2unix+0x61>
movl   $0x0,-0x4(%rbp)
jmp    11ff <yapp2unix+0xbf>
jmp    11a6 <yapp2unix+0x66>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1171 <yapp2unix+0x31>
mov    -0x10(%rbp),%rdi
add    $0x4,%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1040 <strtoul@plt>
mov    %ax,-0x16(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,0x4(%rax)
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1040 <strtoul@plt>
mov    %ax,-0x18(%rbp)
mov    -0x16(%rbp),%ax
movzwl %ax,%edi
movzwl -0x18(%rbp),%esi
call   1050 <date_dos2unix@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yapp2unix>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    $0x8,%eax
jne    11f9 <yapp2unix+0xb9>
movsbl (%rbx),%edi
call   1060 <isxdigit@plt>
test   %eax,%eax
je     11f9 <yapp2unix+0xb9>
movsbl 0x1(%rbx),%edi
call   1060 <isxdigit@plt>
test   %eax,%eax
je     11f9 <yapp2unix+0xb9>
movsbl 0x2(%rbx),%edi
call   1060 <isxdigit@plt>
test   %eax,%eax
je     11f9 <yapp2unix+0xb9>
movsbl 0x3(%rbx),%edi
call   1060 <isxdigit@plt>
test   %eax,%eax
je     11f9 <yapp2unix+0xb9>
movsbl 0x4(%rbx),%edi
call   1060 <isxdigit@plt>
test   %eax,%eax
je     11f9 <yapp2unix+0xb9>
movsbl 0x5(%rbx),%edi
call   1060 <isxdigit@plt>
test   %eax,%eax
je     11f9 <yapp2unix+0xb9>
movsbl 0x6(%rbx),%edi
call   1060 <isxdigit@plt>
test   %eax,%eax
je     11f9 <yapp2unix+0xb9>
movsbl 0x7(%rbx),%edi
call   1060 <isxdigit@plt>
test   %eax,%eax
je     11f9 <yapp2unix+0xb9>
lea    0x4(%rbx),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <strtoul@plt>
mov    %eax,%ebp
movb   $0x0,0x4(%rbx)
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <strtoul@plt>
movzwl %bp,%edi
movzwl %ax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <date_dos2unix@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @yapp2unix(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i16
%6 = alloca i16
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
%9 = icmp ne i32 %8, 8
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 0, i32* %2
br label %39
11: ; preds = %1
store i32 0, i32* %4
br label %12
12: ; preds = %25, %11
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 8
br i1 %14, label %15, label %28
15: ; preds = %12
%16 = load i8*, i8** %3
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8, i8* %19
%21 = call i32 @isxdigit(i8 signext %20)
%22 = icmp ne i32 %21, 0
br i1 %22, label %24, label %23
23: ; preds = %15
store i32 0, i32* %2
br label %39
24: ; preds = %15
br label %25
25: ; preds = %24
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
br label %12
28: ; preds = %12
%29 = load i8*, i8** %3
%30 = getelementptr inbounds i8, i8* %29, i64 4
%31 = call zeroext i16 @strtoul(i8* %30, i8** null, i32 16)
store i16 %31, i16* %5
%32 = load i8*, i8** %3
%33 = getelementptr inbounds i8, i8* %32, i64 4
store i8 0, i8* %33
%34 = load i8*, i8** %3
%35 = call zeroext i16 @strtoul(i8* %34, i8** null, i32 16)
store i16 %35, i16* %6
%36 = load i16, i16* %5
%37 = load i16, i16* %6
%38 = call i32 @date_dos2unix(i16 zeroext %36, i16 zeroext %37)
store i32 %38, i32* %2
br label %39
39: ; preds = %28, %23, %10
%40 = load i32, i32* %2
ret i32 %40
}

LLVM IR (-O2):
define i32 @yapp2unix(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp eq i32 %2, 8
br i1 %3, label %4, label %47
4: ; preds = %1
%5 = load i8, i8* %0
%6 = tail call i32 @isxdigit(i8 signext %5)
%7 = icmp eq i32 %6, 0
br i1 %7, label %47, label %8
8: ; preds = %4
%9 = getelementptr inbounds i8, i8* %0, i64 1
%10 = load i8, i8* %9
%11 = tail call i32 @isxdigit(i8 signext %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %47, label %13
13: ; preds = %8
%14 = getelementptr inbounds i8, i8* %0, i64 2
%15 = load i8, i8* %14
%16 = tail call i32 @isxdigit(i8 signext %15)
%17 = icmp eq i32 %16, 0
br i1 %17, label %47, label %18
18: ; preds = %13
%19 = getelementptr inbounds i8, i8* %0, i64 3
%20 = load i8, i8* %19
%21 = tail call i32 @isxdigit(i8 signext %20)
%22 = icmp eq i32 %21, 0
br i1 %22, label %47, label %23
23: ; preds = %18
%24 = getelementptr inbounds i8, i8* %0, i64 4
%25 = load i8, i8* %24
%26 = tail call i32 @isxdigit(i8 signext %25)
%27 = icmp eq i32 %26, 0
br i1 %27, label %47, label %28
28: ; preds = %23
%29 = getelementptr inbounds i8, i8* %0, i64 5
%30 = load i8, i8* %29
%31 = tail call i32 @isxdigit(i8 signext %30)
%32 = icmp eq i32 %31, 0
br i1 %32, label %47, label %33
33: ; preds = %28
%34 = getelementptr inbounds i8, i8* %0, i64 6
%35 = load i8, i8* %34
%36 = tail call i32 @isxdigit(i8 signext %35)
%37 = icmp eq i32 %36, 0
br i1 %37, label %47, label %38
38: ; preds = %33
%39 = getelementptr inbounds i8, i8* %0, i64 7
%40 = load i8, i8* %39
%41 = tail call i32 @isxdigit(i8 signext %40)
%42 = icmp eq i32 %41, 0
br i1 %42, label %47, label %43
43: ; preds = %38
%44 = tail call zeroext i16 @strtoul(i8* nocapture %24, i8** null, i32 16)
store i8 0, i8* %24
%45 = tail call zeroext i16 @strtoul(i8* nocapture %0, i8** null, i32 16)
%46 = tail call i32 @date_dos2unix(i16 zeroext %44, i16 zeroext %45)
br label %47
47: ; preds = %4, %8, %13, %18, %23, %28, %33, %38, %1, %43
%48 = phi i32 [ %46, %43 ], [ 0, %1 ], [ 0, %38 ], [ 0, %33 ], [ 0, %28 ], [ 0, %23 ], [ 0, %18 ], [ 0, %13 ], [ 0, %8 ], [ 0, %4 ]
ret i32 %48
}