#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
unsigned int strlen(char *);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    printf("Usage: prints changed version of input string.\n");
    exit(EXIT_FAILURE);
  }
  int i;
  unsigned sl = strlen(argv[1]);
  printf("%s\n", argv[1]);
  printf("Conv:\n");
  printf("%i", 79);
  for (i = sl - 1; i >= sl - 6; --i) {
    if (argv[1][i] == 'e')
      putchar('_');
    else if (i / 2)
      putchar(argv[1][i] - 32);
    else
      putchar(argv[1][i] + 1);
  }
  printf("%i", 91);
  putchar('\n');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     117c <main+0x3c>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe84(%rip),%rdi
mov    $0x4f,%esi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x6,%ecx
cmp    %ecx,%eax
jb     126c <main+0x12c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x65,%eax
jne    1205 <main+0xc5>
mov    $0x5f,%edi
call   1030 <putchar@plt>
jmp    1259 <main+0x119>
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%eax
je     1239 <main+0xf9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x20,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    1254 <main+0x114>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
add    $0x1,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    1259 <main+0x119>
jmp    125e <main+0x11e>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    11cc <main+0x8c>
lea    0xdc8(%rip),%rdi
mov    $0x5b,%esi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    1203 <main+0xb3>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
mov    0x8(%r14),%rdi
call   1040 <puts@plt>
lea    0xe85(%rip),%rdi
call   1040 <puts@plt>
lea    0xe76(%rip),%rdi
mov    $0x4f,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    -0x6(%rbp),%r15d
lea    -0x1(%rbp),%eax
cmp    %r15d,%eax
jae    11e4 <main+0x94>
lea    0xe57(%rip),%rdi
mov    $0x5b,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
nopl   0x0(%rax)
add    $0x1,%al
mov    %eax,%ecx
movsbl %cl,%edi
call   1030 <putchar@plt>
add    $0xfffffffe,%ebx
cmp    %r15d,%ebx
jb     11a2 <main+0x52>
mov    %ebp,%ebx
lea    -0x1(%rbx),%ebp
mov    0x8(%r14),%rax
movslq %ebp,%rcx
movzbl (%rax,%rcx,1),%eax
mov    $0x5f,%cl
cmp    $0x65,%al
je     11d4 <main+0x84>
cmp    $0x3,%ebx
jb     11d0 <main+0x80>
add    $0xe0,%al
jmp    11d2 <main+0x82>
lea    0xdff(%rip),%rdi
call   1040 <puts@plt>
mov    0x2dca(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [48 x i8] c"Usage: prints changed version of input string.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [7 x i8] c"Conv:\0A\00"
@.str.3 = [3 x i8] c"%i\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @strlen(i8* %17)
store i32 %18, i32* %7
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 79)
%25 = load i32, i32* %7
%26 = sub i32 %25, 1
store i32 %26, i32* %6
br label %27
27: ; preds = %74, %14
%28 = load i32, i32* %6
%29 = load i32, i32* %7
%30 = sub i32 %29, 6
%31 = icmp uge i32 %28, %30
br i1 %31, label %32, label %77
32: ; preds = %27
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = load i32, i32* %6
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %35, i64 %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 101
br i1 %41, label %42, label %44
42: ; preds = %32
%43 = call i32 @putchar(i8 signext 95)
br label %73
44: ; preds = %32
%45 = load i32, i32* %6
%46 = sdiv i32 %45, 2
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %60
48: ; preds = %44
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 1
%51 = load i8*, i8** %50
%52 = load i32, i32* %6
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %51, i64 %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = sub nsw i32 %56, 32
%58 = trunc i32 %57 to i8
%59 = call i32 @putchar(i8 signext %58)
br label %72
60: ; preds = %44
%61 = load i8**, i8*** %5
%62 = getelementptr inbounds i8*, i8** %61, i64 1
%63 = load i8*, i8** %62
%64 = load i32, i32* %6
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8, i8* %63, i64 %65
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
%69 = add nsw i32 %68, 1
%70 = trunc i32 %69 to i8
%71 = call i32 @putchar(i8 signext %70)
br label %72
72: ; preds = %60, %48
br label %73
73: ; preds = %72, %42
br label %74
74: ; preds = %73
%75 = load i32, i32* %6
%76 = add nsw i32 %75, -1
store i32 %76, i32* %6
br label %27
77: ; preds = %27
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 91)
%79 = call i32 @putchar(i8 signext 10)
ret i32 0
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str.3 = [3 x i8] c"%i\00"
@str = [6 x i8] c"Conv:\00"
@str.4 = [47 x i8] c"Usage: prints changed version of input string.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.4, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @strlen(i8* %10)
%12 = load i8*, i8** %9
%13 = tail call i32 @puts(i8* dereferenceable(1) %12)
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 79)
%16 = add i32 %11, -6
%17 = add i32 %11, -1
%18 = icmp ult i32 %17, %16
br i1 %18, label %38, label %19
19: ; preds = %8, %33
%20 = phi i32 [ %36, %33 ], [ %17, %8 ]
%21 = phi i32 [ %20, %33 ], [ %11, %8 ]
%22 = load i8*, i8** %9
%23 = sext i32 %20 to i64
%24 = getelementptr inbounds i8, i8* %22, i64 %23
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 101
br i1 %26, label %33, label %27
27: ; preds = %19
%28 = icmp ult i32 %21, 3
br i1 %28, label %31, label %29
29: ; preds = %27
%30 = add i8 %25, -32
br label %33
31: ; preds = %27
%32 = add i8 %25, 1
br label %33
33: ; preds = %19, %31, %29
%34 = phi i8 [ %32, %31 ], [ %30, %29 ], [ 95, %19 ]
%35 = tail call i32 @putchar(i8 signext %34)
%36 = add i32 %20, -1
%37 = icmp ult i32 %36, %16
br i1 %37, label %38, label %19
38: ; preds = %33, %8
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 91)
%40 = tail call i32 @putchar(i8 signext 10)
ret i32 0
}