#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*/ assert(int);
int /*<<< orphan*/ convert_date_to_standard(char *, char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int strlen(char *);
int test_convert_date_to_standard() {
  char datestr[20], date_format[20];
  char converted[20];
  printf("test_convert_date_to_standard...");
  sprintf(date_format, "%s", "%d/%m/%Y");
  sprintf(datestr, "%s", "20/05/2017");
  convert_date_to_standard(datestr, date_format, converted);
  assert(strlen(converted) == 10);
  assert(converted[0] == '2');
  assert(converted[1] == '0');
  assert(converted[2] == '1');
  assert(converted[3] == '7');
  assert(converted[4] == '-');
  assert(converted[5] == '0');
  assert(converted[6] == '5');
  assert(converted[7] == '-');
  assert(converted[8] == '2');
  assert(converted[9] == '0');
  assert(converted[10] == 0);
  printf("ok\n");
  return 1;
}


x86 assembly (clang, -O0):
<test_convert_date_to_standard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    0xea1(%rip),%rdi
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
lea    0xeb2(%rip),%rsi
lea    0xeae(%rip),%rdx
call   1070 <sprintf@plt>
lea    -0x20(%rbp),%rdi
lea    0xe9b(%rip),%rsi
lea    0xea0(%rip),%rdx
call   1070 <sprintf@plt>
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x60(%rbp),%rdx
call   1060 <convert_date_to_standard@plt>
lea    -0x60(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0xa,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movsbl -0x60(%rbp),%eax
cmp    $0x32,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movsbl -0x5f(%rbp),%eax
cmp    $0x30,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movsbl -0x5e(%rbp),%eax
cmp    $0x31,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movsbl -0x5d(%rbp),%eax
cmp    $0x37,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movsbl -0x5c(%rbp),%eax
cmp    $0x2d,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movsbl -0x5b(%rbp),%eax
cmp    $0x30,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movsbl -0x5a(%rbp),%eax
cmp    $0x35,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movsbl -0x59(%rbp),%eax
cmp    $0x2d,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movsbl -0x58(%rbp),%eax
cmp    $0x32,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movsbl -0x57(%rbp),%eax
cmp    $0x30,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movsbl -0x56(%rbp),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xd99(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_convert_date_to_standard>:
push   %rbx
sub    $0x60,%rsp
lea    0xea4(%rip),%rdi
call   1050 <printf@plt>
movabs $0x59252f6d252f6425,%rax
2f 25 59
mov    %rax,0x20(%rsp)
movb   $0x0,0x28(%rsp)
movabs $0x30322f35302f3032,%rax
2f 32 30
mov    %rax,0x40(%rsp)
movl   $0x373130,0x47(%rsp)
lea    0x40(%rsp),%rdi
lea    0x20(%rsp),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdx
call   1070 <convert_date_to_standard@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
xor    %edi,%edi
cmp    $0xa,%eax
sete   %dil
call   1060 <assert@plt>
xor    %edi,%edi
cmpb   $0x32,(%rsp)
sete   %dil
call   1060 <assert@plt>
xor    %edi,%edi
cmpb   $0x30,0x1(%rsp)
sete   %dil
call   1060 <assert@plt>
xor    %edi,%edi
cmpb   $0x31,0x2(%rsp)
sete   %dil
call   1060 <assert@plt>
xor    %edi,%edi
cmpb   $0x37,0x3(%rsp)
sete   %dil
call   1060 <assert@plt>
xor    %edi,%edi
cmpb   $0x2d,0x4(%rsp)
sete   %dil
call   1060 <assert@plt>
xor    %edi,%edi
cmpb   $0x30,0x5(%rsp)
sete   %dil
call   1060 <assert@plt>
xor    %edi,%edi
cmpb   $0x35,0x6(%rsp)
sete   %dil
call   1060 <assert@plt>
xor    %edi,%edi
cmpb   $0x2d,0x7(%rsp)
sete   %dil
call   1060 <assert@plt>
xor    %edi,%edi
cmpb   $0x32,0x8(%rsp)
sete   %dil
call   1060 <assert@plt>
xor    %edi,%edi
cmpb   $0x30,0x9(%rsp)
sete   %dil
call   1060 <assert@plt>
xor    %edi,%edi
cmpb   $0x0,0xa(%rsp)
sete   %dil
call   1060 <assert@plt>
lea    0xdc8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"test_convert_date_to_standard...\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [9 x i8] c"%d/%m/%Y\00"
@.str.3 = [11 x i8] c"20/05/2017\00"
@.str.4 = [4 x i8] c"ok\0A\00"
define i32 @test_convert_date_to_standard() {
%1 = alloca [20 x i8]
%2 = alloca [20 x i8]
%3 = alloca [20 x i8]
%4 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%6 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%8 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%12 = call i32 @convert_date_to_standard(i8* %9, i8* %10, i8* %11)
%13 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%14 = call i32 @strlen(i8* %13)
%15 = icmp eq i32 %14, 10
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 50
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
%24 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 1
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 48
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
%30 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 2
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 49
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 3
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 55
%40 = zext i1 %39 to i32
%41 = call i32 @assert(i32 %40)
%42 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 4
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 45
%46 = zext i1 %45 to i32
%47 = call i32 @assert(i32 %46)
%48 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 5
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 48
%52 = zext i1 %51 to i32
%53 = call i32 @assert(i32 %52)
%54 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 6
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 53
%58 = zext i1 %57 to i32
%59 = call i32 @assert(i32 %58)
%60 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 7
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = icmp eq i32 %62, 45
%64 = zext i1 %63 to i32
%65 = call i32 @assert(i32 %64)
%66 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 8
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
%69 = icmp eq i32 %68, 50
%70 = zext i1 %69 to i32
%71 = call i32 @assert(i32 %70)
%72 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 9
%73 = load i8, i8* %72
%74 = sext i8 %73 to i32
%75 = icmp eq i32 %74, 48
%76 = zext i1 %75 to i32
%77 = call i32 @assert(i32 %76)
%78 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 10
%79 = load i8, i8* %78
%80 = sext i8 %79 to i32
%81 = icmp eq i32 %80, 0
%82 = zext i1 %81 to i32
%83 = call i32 @assert(i32 %82)
%84 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@.str = [33 x i8] c"test_convert_date_to_standard...\00"
@.str.2 = [9 x i8] c"%d/%m/%Y\00"
@.str.3 = [11 x i8] c"20/05/2017\00"
@str = [3 x i8] c"ok\00"
define i32 @test_convert_date_to_standard() {
%1 = alloca [20 x i8]
%2 = alloca [20 x i8]
%3 = alloca [20 x i8]
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @convert_date_to_standard(i8* %4, i8* %5, i8* %6)
%9 = call i32 @strlen(i8* %6)
%10 = icmp eq i32 %9, 10
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i8, i8* %6
%14 = icmp eq i8 %13, 50
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 1
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 48
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 2
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 49
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 3
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 55
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 4
%33 = load i8, i8* %32
%34 = icmp eq i8 %33, 45
%35 = zext i1 %34 to i32
%36 = call i32 @assert(i32 %35)
%37 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 5
%38 = load i8, i8* %37
%39 = icmp eq i8 %38, 48
%40 = zext i1 %39 to i32
%41 = call i32 @assert(i32 %40)
%42 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 6
%43 = load i8, i8* %42
%44 = icmp eq i8 %43, 53
%45 = zext i1 %44 to i32
%46 = call i32 @assert(i32 %45)
%47 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 7
%48 = load i8, i8* %47
%49 = icmp eq i8 %48, 45
%50 = zext i1 %49 to i32
%51 = call i32 @assert(i32 %50)
%52 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 8
%53 = load i8, i8* %52
%54 = icmp eq i8 %53, 50
%55 = zext i1 %54 to i32
%56 = call i32 @assert(i32 %55)
%57 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 9
%58 = load i8, i8* %57
%59 = icmp eq i8 %58, 48
%60 = zext i1 %59 to i32
%61 = call i32 @assert(i32 %60)
%62 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 10
%63 = load i8, i8* %62
%64 = icmp eq i8 %63, 0
%65 = zext i1 %64 to i32
%66 = call i32 @assert(i32 %65)
%67 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret i32 1
}