#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(char *, int);
scalar_t__ strcmp(int /*<<< orphan*/, char *);
int main(int argc, char **argv) {
  assert(strcmp(convert("A", 0), "A") == 0);
  assert(strcmp(convert("A", 1), "A") == 0);
  assert(strcmp(convert("ABCD", 2), "ACBD") == 0);
  assert(strcmp(convert("PAYPALISHIRING", 3), "PAHNAPLSIIGYIR") == 0);
  assert(strcmp(convert("PAYPALISHIRING", 4), "PINALSIGYAHRPI") == 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
xor    %esi,%esi
call   1030 <convert@plt>
mov    %eax,%edi
lea    0xea3(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xe86(%rip),%rdi
mov    $0x1,%esi
call   1030 <convert@plt>
mov    %eax,%edi
lea    0xe73(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xe58(%rip),%rdi
mov    $0x2,%esi
call   1030 <convert@plt>
mov    %eax,%edi
lea    0xe4a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xe32(%rip),%rdi
mov    $0x3,%esi
call   1030 <convert@plt>
mov    %eax,%edi
lea    0xe2e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xe02(%rip),%rdi
mov    $0x4,%esi
call   1030 <convert@plt>
mov    %eax,%edi
lea    0xe0d(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <convert@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <convert@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
lea    0xe7c(%rip),%rdi
mov    $0x2,%esi
call   1030 <convert@plt>
lea    0xe70(%rip),%rsi
mov    %eax,%edi
call   1040 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
lea    0xe59(%rip),%rbx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <convert@plt>
lea    0xe54(%rip),%rsi
mov    %eax,%edi
call   1040 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <convert@plt>
lea    0xe3a(%rip),%rsi
mov    %eax,%edi
call   1040 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"A\00"
@.str.1 = [5 x i8] c"ABCD\00"
@.str.2 = [5 x i8] c"ACBD\00"
@.str.3 = [15 x i8] c"PAYPALISHIRING\00"
@.str.4 = [15 x i8] c"PAHNAPLSIIGYIR\00"
@.str.5 = [15 x i8] c"PINALSIGYAHRPI\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @convert(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 0)
%7 = call i64 @strcmp(i32 %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = call i32 @convert(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%12 = call i64 @strcmp(i32 %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = call i32 @convert(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 2)
%17 = call i64 @strcmp(i32 %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = call i32 @convert(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 3)
%22 = call i64 @strcmp(i32 %21, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = call i32 @convert(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 4)
%27 = call i64 @strcmp(i32 %26, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"A\00"
@.str.1 = [5 x i8] c"ABCD\00"
@.str.2 = [5 x i8] c"ACBD\00"
@.str.3 = [15 x i8] c"PAYPALISHIRING\00"
@.str.4 = [15 x i8] c"PAHNAPLSIIGYIR\00"
@.str.5 = [15 x i8] c"PINALSIGYAHRPI\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @convert(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 0)
%4 = tail call i64 @strcmp(i32 %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = tail call i32 @convert(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%9 = tail call i64 @strcmp(i32 %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i32 @convert(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 2)
%14 = tail call i64 @strcmp(i32 %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
%16 = zext i1 %15 to i32
%17 = tail call i32 @assert(i32 %16)
%18 = tail call i32 @convert(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 3)
%19 = tail call i64 @strcmp(i32 %18, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
%21 = zext i1 %20 to i32
%22 = tail call i32 @assert(i32 %21)
%23 = tail call i32 @convert(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 4)
%24 = tail call i64 @strcmp(i32 %23, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
%26 = zext i1 %25 to i32
%27 = tail call i32 @assert(i32 %26)
ret i32 0
}