#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 */
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char tolower(char);
int goAgain(char *s) {
  char temp[100];
  strcpy(temp, s);
  if (strlen(temp) != 4)
    return 1;
  else {
    int i;
    for (i = 0; i < 4; i++)
      temp[i] = tolower(temp[i]);
  }
  if (strcmp("exit", temp) == 0)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<goAgain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x80(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x4,%eax
je     117a <goAgain+0x3a>
movl   $0x1,-0x4(%rbp)
jmp    11f5 <goAgain+0xb5>
movl   $0x0,-0x84(%rbp)
cmpl   $0x4,-0x84(%rbp)
jge    11c3 <goAgain+0x83>
movslq -0x84(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%edi
call   1060 <tolower@plt>
mov    %al,%cl
movslq -0x84(%rbp),%rax
mov    %cl,-0x80(%rbp,%rax,1)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1184 <goAgain+0x44>
jmp    11c8 <goAgain+0x88>
lea    -0x80(%rbp),%rsi
lea    0xe2d(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11ee <goAgain+0xae>
movl   $0x0,-0x4(%rbp)
jmp    11f5 <goAgain+0xb5>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<goAgain>:
push   %rbx
sub    $0x70,%rsp
mov    %rdi,%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0x4,%ecx
jne    11b7 <goAgain+0x77>
movsbl (%rsp),%edi
call   1060 <tolower@plt>
mov    %al,(%rsp)
movsbl 0x1(%rsp),%edi
call   1060 <tolower@plt>
mov    %al,0x1(%rsp)
movsbl 0x2(%rsp),%edi
call   1060 <tolower@plt>
mov    %al,0x2(%rsp)
movsbl 0x3(%rsp),%edi
call   1060 <tolower@plt>
mov    %al,0x3(%rsp)
lea    0xe5c(%rip),%rdi
mov    %rsp,%rsi
call   1050 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"exit\00"
define i32 @goAgain(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [100 x i8]
%5 = alloca i32
store i8* %0, i8** %3
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%7 = load i8*, i8** %3
%8 = call i32 @strcpy(i8* %6, i8* %7)
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%10 = call i32 @strlen(i8* %9)
%11 = icmp ne i32 %10, 4
br i1 %11, label %12, label %13
12: ; preds = %1
store i32 1, i32* %2
br label %36
13: ; preds = %1
store i32 0, i32* %5
br label %14
14: ; preds = %26, %13
%15 = load i32, i32* %5
%16 = icmp slt i32 %15, 4
br i1 %16, label %17, label %29
17: ; preds = %14
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = call signext i8 @tolower(i8 signext %21)
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %24
store i8 %22, i8* %25
br label %26
26: ; preds = %17
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %14
29: ; preds = %14
br label %30
30: ; preds = %29
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%32 = call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %31)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %30
store i32 0, i32* %2
br label %36
35: ; preds = %30
store i32 1, i32* %2
br label %36
36: ; preds = %35, %34, %12
%37 = load i32, i32* %2
ret i32 %37
}

LLVM IR (-O2):
@.str = [5 x i8] c"exit\00"
define i32 @goAgain(i8* %0) {
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = call i32 @strcpy(i8* %3, i8* %0)
%5 = call i32 @strlen(i8* %3)
%6 = icmp eq i32 %5, 4
br i1 %6, label %7, label %22
7: ; preds = %1
%8 = load i8, i8* %3
%9 = call signext i8 @tolower(i8 signext %8)
store i8 %9, i8* %3
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 1
%11 = load i8, i8* %10
%12 = call signext i8 @tolower(i8 signext %11)
store i8 %12, i8* %10
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 2
%14 = load i8, i8* %13
%15 = call signext i8 @tolower(i8 signext %14)
store i8 %15, i8* %13
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 3
%17 = load i8, i8* %16
%18 = call signext i8 @tolower(i8 signext %17)
store i8 %18, i8* %16
%19 = call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %3)
%20 = icmp ne i64 %19, 0
%21 = zext i1 %20 to i32
br label %22
22: ; preds = %7, %1
%23 = phi i32 [ 1, %1 ], [ %21, %7 ]
ret i32 %23
}