#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*/ inline_replace(char *, char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strstr(char *, char *);
char *adjust_time(char **arg, char *format) {
  if (strstr(*arg, "am") || strstr(*arg, "pm")) {
    inline_replace(format, "%H", "%I");
    strcat(format, "%p");
  }
  return format;
}


x86 assembly (clang, -O0):
<adjust_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
lea    0xeb2(%rip),%rsi
call   1050 <strstr@plt>
cmp    $0x0,%rax
jne    117a <adjust_time+0x4a>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
lea    0xe98(%rip),%rsi
call   1050 <strstr@plt>
cmp    $0x0,%rax
je     11a1 <adjust_time+0x71>
mov    -0x10(%rbp),%rdi
lea    0xe81(%rip),%rsi
lea    0xe7d(%rip),%rdx
call   1030 <inline_replace@plt>
mov    -0x10(%rbp),%rdi
lea    0xe70(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<adjust_time>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%rdi
lea    0xebc(%rip),%rsi
call   1050 <strstr@plt>
test   %rax,%rax
jne    1162 <adjust_time+0x32>
mov    (%rbx),%rdi
lea    0xeab(%rip),%rsi
call   1050 <strstr@plt>
test   %rax,%rax
je     1187 <adjust_time+0x57>
lea    0xe9d(%rip),%rsi
lea    0xe99(%rip),%rdx
mov    %r14,%rdi
call   1030 <inline_replace@plt>
lea    0xe8d(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcat@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"am\00"
@.str.1 = [3 x i8] c"pm\00"
@.str.2 = [3 x i8] c"%H\00"
@.str.3 = [3 x i8] c"%I\00"
@.str.4 = [3 x i8] c"%p\00"
define i8* @adjust_time(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
store i8** %0, i8*** %3
store i8* %1, i8** %4
%5 = load i8**, i8*** %3
%6 = load i8*, i8** %5
%7 = call i64 @strstr(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i64 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %2
%10 = load i8**, i8*** %3
%11 = load i8*, i8** %10
%12 = call i64 @strstr(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %9, %2
%15 = load i8*, i8** %4
%16 = call i32 @inline_replace(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%17 = load i8*, i8** %4
%18 = call i32 @strcat(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %19
19: ; preds = %14, %9
%20 = load i8*, i8** %4
ret i8* %20
}

LLVM IR (-O2):
@.str = [3 x i8] c"am\00"
@.str.1 = [3 x i8] c"pm\00"
@.str.2 = [3 x i8] c"%H\00"
@.str.3 = [3 x i8] c"%I\00"
@.str.4 = [3 x i8] c"%p\00"
define i8* @adjust_time(i8** nocapture %0, i8* returned %1) {
%3 = load i8*, i8** %0
%4 = tail call i64 @strstr(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = load i8*, i8** %0
%8 = tail call i64 @strstr(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %6, %2
%11 = tail call i32 @inline_replace(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%12 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %13
13: ; preds = %10, %6
ret i8* %1
}