#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 format_int(int, char *, int);
int /*<<< orphan*/ memset(char *, int, int);
int strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int /*<<< orphan*/ strrev(char *, int);
int /*<<< orphan*/ strrevcpy(char *, char *);
void testString() {
  int c = strcmp("hello1", "hello");
  "";
  c = strcmp("hello", "hello");
  "";
  c = strcmp("", "\0");
  "";
  c = strcmp("a", "bb");
  "";
  int len = strlen("");
  "";
  len = strlen("1234");
  "";
  char buf[8];
  strcpy(buf, "1234");
  "";
  strcpy(buf, "");
  "";
  "";
  strncpy(buf, "12345678", 4);
  "";
  strncpy(buf, "123", 8);
  "";
  memset(buf, 8, 5);
  for (int i = 0; i < 8; i++) {
    "";
  }
  strrevcpy("1234", buf);
  "";
  strrevcpy("", buf);
  "";
  strcpy(buf, "1234");
  strrev(buf, 4);
  "";
  strcpy(buf, "12345");
  strrev(buf, strlen(buf));
  "";
  int length = 0;
  length = format_int(10, buf, 8);
  "";
  "";
  length = format_int(-10, buf, 8);
  "";
  "";
}


x86 assembly (clang, -O0):
<testString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xe71(%rip),%rdi
lea    0xe71(%rip),%rsi
call   1080 <strcmp@plt>
mov    %eax,-0x4(%rbp)
lea    0xe62(%rip),%rsi
mov    %rsi,%rdi
call   1080 <strcmp@plt>
mov    %eax,-0x4(%rbp)
lea    0xe4f(%rip),%rdi
lea    0xe6c(%rip),%rsi
call   1080 <strcmp@plt>
mov    %eax,-0x4(%rbp)
lea    0xe40(%rip),%rdi
lea    0xe3b(%rip),%rsi
call   1080 <strcmp@plt>
mov    %eax,-0x4(%rbp)
lea    0xe23(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x8(%rbp)
lea    0xe20(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
lea    0xe0d(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x10(%rbp),%rdi
lea    0xdf1(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x10(%rbp),%rdi
lea    0xdf2(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
lea    -0x10(%rbp),%rdi
lea    0xde6(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncpy@plt>
lea    -0x10(%rbp),%rdi
mov    $0x8,%esi
mov    $0x5,%edx
call   1070 <memset@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    127b <testString+0xfb>
jmp    126d <testString+0xed>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    125e <testString+0xde>
lea    -0x10(%rbp),%rsi
lea    0xd8c(%rip),%rdi
call   1060 <strrevcpy@plt>
lea    -0x10(%rbp),%rsi
lea    0xd70(%rip),%rdi
call   1060 <strrevcpy@plt>
lea    -0x10(%rbp),%rdi
lea    0xd6c(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   10a0 <strrev@plt>
lea    -0x10(%rbp),%rdi
lea    0xd60(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   10a0 <strrev@plt>
movl   $0x0,-0x18(%rbp)
lea    -0x10(%rbp),%rsi
mov    $0xa,%edi
mov    $0x8,%edx
call   1090 <format_int@plt>
mov    %eax,-0x18(%rbp)
lea    -0x10(%rbp),%rsi
mov    $0xfffffff6,%edi
mov    $0x8,%edx
call   1090 <format_int@plt>
mov    %eax,-0x18(%rbp)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testString>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xe91(%rip),%r15
mov    %r15,%rdi
call   1050 <strlen@plt>
lea    0xe71(%rip),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcpy@plt>
lea    0xe4c(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <strncpy@plt>
lea    0xe41(%rip),%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
call   1030 <strncpy@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
mov    $0x5,%edx
call   1070 <memset@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strrevcpy@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <strrevcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1090 <strrev@plt>
lea    0xdf1(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1090 <strrev@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
mov    $0x8,%edx
call   1080 <format_int@plt>
mov    $0xfffffff6,%edi
mov    %rbx,%rsi
mov    $0x8,%edx
call   1080 <format_int@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"hello1\00"
@.str.1 = [6 x i8] c"hello\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [2 x i8] zeroinitializer
@.str.4 = [2 x i8] c"a\00"
@.str.5 = [3 x i8] c"bb\00"
@.str.6 = [5 x i8] c"1234\00"
@.str.7 = [9 x i8] c"12345678\00"
@.str.8 = [4 x i8] c"123\00"
@.str.9 = [6 x i8] c"12345\00"
define void @testString() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [8 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = call i32 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
store i32 %6, i32* %1
%7 = call i32 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
store i32 %7, i32* %1
%8 = call i32 @strcmp(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32 %8, i32* %1
%9 = call i32 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store i32 %9, i32* %1
%10 = call i32 @strlen(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
store i32 %10, i32* %2
%11 = call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
store i32 %11, i32* %2
%12 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%13 = call i32 @strcpy(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%14 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%15 = call i32 @strcpy(i8* %14, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%16 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%17 = call i32 @strncpy(i8* %16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 4)
%18 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%19 = call i32 @strncpy(i8* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 8)
%20 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%21 = call i32 @memset(i8* %20, i32 8, i32 5)
store i32 0, i32* %4
br label %22
22: ; preds = %26, %0
%23 = load i32, i32* %4
%24 = icmp slt i32 %23, 8
br i1 %24, label %25, label %29
25: ; preds = %22
br label %26
26: ; preds = %25
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %22
29: ; preds = %22
%30 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%31 = call i32 @strrevcpy(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* %30)
%32 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%33 = call i32 @strrevcpy(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* %32)
%34 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%35 = call i32 @strcpy(i8* %34, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%36 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%37 = call i32 @strrev(i8* %36, i32 4)
%38 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%39 = call i32 @strcpy(i8* %38, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%40 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%41 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%42 = call i32 @strlen(i8* %41)
%43 = call i32 @strrev(i8* %40, i32 %42)
store i32 0, i32* %5
%44 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%45 = call i32 @format_int(i32 10, i8* %44, i32 8)
store i32 %45, i32* %5
%46 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%47 = call i32 @format_int(i32 -10, i8* %46, i32 8)
store i32 %47, i32* %5
ret void
}

LLVM IR (-O2):
@.str.2 = [1 x i8] zeroinitializer
@.str.6 = [5 x i8] c"1234\00"
@.str.7 = [9 x i8] c"12345678\00"
@.str.8 = [4 x i8] c"123\00"
@.str.9 = [6 x i8] c"12345\00"
define void @testString() {
%1 = alloca [8 x i8]
%2 = tail call i32 @strlen(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%3 = tail call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%4 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%6 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @strncpy(i8* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 4)
%8 = call i32 @strncpy(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 8)
%9 = call i32 @memset(i8* %4, i32 8, i32 5)
%10 = call i32 @strrevcpy(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* %4)
%11 = call i32 @strrevcpy(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%12 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%13 = call i32 @strrev(i8* %4, i32 4)
%14 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%15 = call i32 @strlen(i8* %4)
%16 = call i32 @strrev(i8* %4, i32 %15)
%17 = call i32 @format_int(i32 10, i8* %4, i32 8)
%18 = call i32 @format_int(i32 -10, i8* %4, i32 8)
ret void
}