#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*/ printf(char *, char *, char *);
char *revrot(char *, size_t);
scalar_t__ strcmp(char *, char *);
void dotest(char *s, size_t sz, char *expr) {
  char *act = revrot(s, sz);
  if (strcmp(act, expr) != 0)
    printf("Error. Expected %s but got %s\n", expr, act);
  assert(strcmp(act, expr) == 0);
}


x86 assembly (clang, -O0):
<dotest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <revrot@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     1190 <dotest+0x50>
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dotest>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
call   1040 <revrot@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1171 <dotest+0x31>
lea    0xe9a(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <assert@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"Error. Expected %s but got %s\0A\00"
define void @dotest(i8* %0, i64 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
store i8* %2, i8** %6
%8 = load i8*, i8** %4
%9 = load i64, i64* %5
%10 = call i8* @revrot(i8* %8, i64 %9)
store i8* %10, i8** %7
%11 = load i8*, i8** %7
%12 = load i8*, i8** %6
%13 = call i64 @strcmp(i8* %11, i8* %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %3
%16 = load i8*, i8** %6
%17 = load i8*, i8** %7
%18 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %16, i8* %17)
br label %19
19: ; preds = %15, %3
%20 = load i8*, i8** %7
%21 = load i8*, i8** %6
%22 = call i64 @strcmp(i8* %20, i8* %21)
%23 = icmp eq i64 %22, 0
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"Error. Expected %s but got %s\0A\00"
define void @dotest(i8* %0, i64 %1, i8* %2) {
%4 = tail call i8* @revrot(i8* %0, i64 %1)
%5 = tail call i64 @strcmp(i8* %4, i8* %2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %4)
br label %9
9: ; preds = %7, %3
%10 = tail call i64 @strcmp(i8* %4, i8* %2)
%11 = icmp eq i64 %10, 0
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
ret void
}