#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 */
struct tm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ memmove(char *, char *, scalar_t__);
scalar_t__ strlen(char *);
char *strstr(char *, char *);
int irvtojan(char *buffer, struct tm *thetime) {
  char *monthstart;
  if (monthstart = strstr(buffer, "Irvember")) {
    memmove(monthstart, monthstart + 1, strlen(monthstart) + 1);
    *monthstart = 'J';
    *(monthstart + 1) = 'a';
    *(monthstart + 2) = 'n';
    *(monthstart + 3) = 'u';
    *(monthstart + 4) = 'a';
    *(monthstart + 5) = 'r';
    *(monthstart + 6) = 'y';
  } else if (monthstart = strstr(buffer, "Irv")) {
    *monthstart = 'J';
    *(monthstart + 1) = 'a';
    *(monthstart + 2) = 'n';
  }
  return 0;
}


x86 assembly (clang, -O0):
<irvtojan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   1050 <strstr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     11cb <irvtojan+0x9b>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1040 <memmove@plt>
mov    -0x18(%rbp),%rax
movb   $0x4a,(%rax)
mov    -0x18(%rbp),%rax
movb   $0x61,0x1(%rax)
mov    -0x18(%rbp),%rax
movb   $0x6e,0x2(%rax)
mov    -0x18(%rbp),%rax
movb   $0x75,0x3(%rax)
mov    -0x18(%rbp),%rax
movb   $0x61,0x4(%rax)
mov    -0x18(%rbp),%rax
movb   $0x72,0x5(%rax)
mov    -0x18(%rbp),%rax
movb   $0x79,0x6(%rax)
jmp    1205 <irvtojan+0xd5>
mov    -0x8(%rbp),%rdi
lea    0xe33(%rip),%rsi
call   1050 <strstr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1200 <irvtojan+0xd0>
mov    -0x18(%rbp),%rax
movb   $0x4a,(%rax)
mov    -0x18(%rbp),%rax
movb   $0x61,0x1(%rax)
mov    -0x18(%rbp),%rax
movb   $0x6e,0x2(%rax)
jmp    1205 <irvtojan+0xd5>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irvtojan>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xec2(%rip),%rsi
call   1050 <strstr@plt>
test   %rax,%rax
je     117b <irvtojan+0x4b>
mov    %rax,%rbx
mov    %rax,%r14
add    $0x1,%r14
mov    %rax,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <memmove@plt>
movl   $0x756e614a,(%rbx)
movw   $0x7261,0x4(%rbx)
movb   $0x79,0x6(%rbx)
jmp    1198 <irvtojan+0x68>
lea    0xe87(%rip),%rsi
mov    %r14,%rdi
call   1050 <strstr@plt>
test   %rax,%rax
je     1198 <irvtojan+0x68>
movw   $0x614a,(%rax)
movb   $0x6e,0x2(%rax)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [9 x i8] c"Irvember\00"
@.str.1 = [4 x i8] c"Irv\00"
define i32 @irvtojan(i8* %0, %struct.tm* %1) {
%3 = alloca i8*
%4 = alloca %struct.tm*
%5 = alloca i8*
store i8* %0, i8** %3
store %struct.tm* %1, %struct.tm** %4
%6 = load i8*, i8** %3
%7 = call i8* @strstr(i8* %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i8* %7, i8** %5
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %30
9: ; preds = %2
%10 = load i8*, i8** %5
%11 = load i8*, i8** %5
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = load i8*, i8** %5
%14 = call i64 @strlen(i8* %13)
%15 = add nsw i64 %14, 1
%16 = call i32 @memmove(i8* %10, i8* %12, i64 %15)
%17 = load i8*, i8** %5
store i8 74, i8* %17
%18 = load i8*, i8** %5
%19 = getelementptr inbounds i8, i8* %18, i64 1
store i8 97, i8* %19
%20 = load i8*, i8** %5
%21 = getelementptr inbounds i8, i8* %20, i64 2
store i8 110, i8* %21
%22 = load i8*, i8** %5
%23 = getelementptr inbounds i8, i8* %22, i64 3
store i8 117, i8* %23
%24 = load i8*, i8** %5
%25 = getelementptr inbounds i8, i8* %24, i64 4
store i8 97, i8* %25
%26 = load i8*, i8** %5
%27 = getelementptr inbounds i8, i8* %26, i64 5
store i8 114, i8* %27
%28 = load i8*, i8** %5
%29 = getelementptr inbounds i8, i8* %28, i64 6
store i8 121, i8* %29
br label %41
30: ; preds = %2
%31 = load i8*, i8** %3
%32 = call i8* @strstr(i8* %31, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i8* %32, i8** %5
%33 = icmp ne i8* %32, null
br i1 %33, label %34, label %40
34: ; preds = %30
%35 = load i8*, i8** %5
store i8 74, i8* %35
%36 = load i8*, i8** %5
%37 = getelementptr inbounds i8, i8* %36, i64 1
store i8 97, i8* %37
%38 = load i8*, i8** %5
%39 = getelementptr inbounds i8, i8* %38, i64 2
store i8 110, i8* %39
br label %40
40: ; preds = %34, %30
br label %41
41: ; preds = %40, %9
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [9 x i8] c"Irvember\00"
@.str.1 = [4 x i8] c"Irv\00"
define i32 @irvtojan(i8* %0, %struct.tm* nocapture readnone %1) {
%3 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i8* %3, null
br i1 %4, label %15, label %5
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
%7 = tail call i64 @strlen(i8* %3)
%8 = add nsw i64 %7, 1
%9 = tail call i32 @memmove(i8* %3, i8* %6, i64 %8)
store i8 74, i8* %3
store i8 97, i8* %6
%10 = getelementptr inbounds i8, i8* %3, i64 2
store i8 110, i8* %10
%11 = getelementptr inbounds i8, i8* %3, i64 3
store i8 117, i8* %11
%12 = getelementptr inbounds i8, i8* %3, i64 4
store i8 97, i8* %12
%13 = getelementptr inbounds i8, i8* %3, i64 5
store i8 114, i8* %13
%14 = getelementptr inbounds i8, i8* %3, i64 6
store i8 121, i8* %14
br label %21
15: ; preds = %2
%16 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i8* %16, null
br i1 %17, label %21, label %18
18: ; preds = %15
store i8 74, i8* %16
%19 = getelementptr inbounds i8, i8* %16, i64 1
store i8 97, i8* %19
%20 = getelementptr inbounds i8, i8* %16, i64 2
store i8 110, i8* %20
br label %21
21: ; preds = %15, %18, %5
ret i32 0
}