#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 */
typedef int /*<<< orphan*/ line;
typedef int /*<<< orphan*/ c;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main(void) {
  char c[] = "012345";
  char line[128];
  int lcv;
  int cmp;
  printf("sizeof(c)= %d\n", sizeof(c));
  printf("sizeof(line)= %d\n", sizeof(line));
  for (lcv = 0; lcv <= strlen(c); lcv++)
    printf("c[lcv]= %d = %c\n", c[lcv], c[lcv]);
  printf("Please enter a string : ");
  scanf("%s", line);
  printf("strlen(line) = %d\n", strlen(line));
  printf("line = [%s]\n", line);
  cmp = strcmp(c, line);
  if (cmp < 0)
    printf("%s is less than %s\n", c, line);
  else if (cmp == 0)
    printf("%s is equal to %s\n", c, line);
  else
    printf("%s is greater than %s\n", c, line);
  strcpy(line, c);
  cmp = strcmp(c, line);
  if (cmp < 0)
    printf("%s is less than %s\n", c, line);
  else if (cmp == 0)
    printf("%s is equal to %s\n", c, line);
  else
    printf("%s is greater than %s\n", c, line);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe98(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xe92(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xe8a(%rip),%al
mov    %al,-0x5(%rbp)
lea    0xe81(%rip),%rdi
mov    $0x7,%esi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe7d(%rip),%rdi
mov    $0x80,%esi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x94(%rbp)
mov    -0x94(%rbp),%eax
mov    %eax,-0x9c(%rbp)
lea    -0xb(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x9c(%rbp),%eax
cmp    %ecx,%eax
jg     120e <main+0xbe>
movslq -0x94(%rbp),%rax
movsbl -0xb(%rbp,%rax,1),%esi
movslq -0x94(%rbp),%rax
movsbl -0xb(%rbp,%rax,1),%edx
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    11af <main+0x5f>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x90(%rbp),%rsi
lea    0xe28(%rip),%rdi
call   1070 <scanf@plt>
lea    -0x90(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%esi
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x90(%rbp),%rsi
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xb(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1060 <strcmp@plt>
mov    %eax,-0x98(%rbp)
cmpl   $0x0,-0x98(%rbp)
jge    12a1 <main+0x151>
lea    -0xb(%rbp),%rsi
lea    -0x90(%rbp),%rdx
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12ea <main+0x19a>
cmpl   $0x0,-0x98(%rbp)
jne    12cc <main+0x17c>
lea    -0xb(%rbp),%rsi
lea    -0x90(%rbp),%rdx
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12e5 <main+0x195>
lea    -0xb(%rbp),%rsi
lea    -0x90(%rbp),%rdx
lea    0xdbe(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12ea <main+0x19a>
lea    -0x90(%rbp),%rdi
lea    -0xb(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0xb(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1060 <strcmp@plt>
mov    %eax,-0x98(%rbp)
cmpl   $0x0,-0x98(%rbp)
jge    133b <main+0x1eb>
lea    -0xb(%rbp),%rsi
lea    -0x90(%rbp),%rdx
lea    0xd46(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1384 <main+0x234>
cmpl   $0x0,-0x98(%rbp)
jne    1366 <main+0x216>
lea    -0xb(%rbp),%rsi
lea    -0x90(%rbp),%rdx
lea    0xd2f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    137f <main+0x22f>
lea    -0xb(%rbp),%rsi
lea    -0x90(%rbp),%rdx
lea    0xd24(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1384 <main+0x234>
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x90,%rsp
movl   $0x353433,0xb(%rsp)
movl   $0x33323130,0x8(%rsp)
33
lea    0xe90(%rip),%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe8c(%rip),%rdi
mov    $0x80,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x8(%rsp),%rdi
call   1040 <strlen@plt>
test   %eax,%eax
js     11e4 <main+0x94>
mov    $0xffffffffffffffff,%rbx
lea    0xe76(%rip),%r14
lea    0x8(%rsp),%r15
nopw   0x0(%rax,%rax,1)
movsbl 0x9(%rsp,%rbx,1),%edx
mov    %r14,%rdi
mov    %edx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
cltq
add    $0x1,%rbx
cmp    %rax,%rbx
jl     11c0 <main+0x70>
lea    0xe4e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe59(%rip),%rdi
lea    0x10(%rsp),%r15
mov    %r15,%rsi
call   1070 <scanf@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
lea    0xe40(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe43(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x8(%rsp),%r14
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
lea    0xe41(%rip),%r12
lea    0xe4d(%rip),%rbx
mov    %rbx,%rdi
cmove  %r12,%rdi
lea    0xe18(%rip),%r13
cmovs  %r13,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
cmove  %r12,%rbx
cmovs  %r13,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.c = [7 x i8] c"012345\00"
@.str = [15 x i8] c"sizeof(c)= %d\0A\00"
@.str.1 = [18 x i8] c"sizeof(line)= %d\0A\00"
@.str.2 = [17 x i8] c"c[lcv]= %d = %c\0A\00"
@.str.3 = [25 x i8] c"Please enter a string : \00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [19 x i8] c"strlen(line) = %d\0A\00"
@.str.6 = [13 x i8] c"line = [%s]\0A\00"
@.str.7 = [20 x i8] c"%s is less than %s\0A\00"
@.str.8 = [19 x i8] c"%s is equal to %s\0A\00"
@.str.9 = [23 x i8] c"%s is greater than %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i8]
%3 = alloca [128 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [7 x i8]* %2 to i8*
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i64 7)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i64 128)
store i32 0, i32* %4
br label %9
9: ; preds = %26, %0
%10 = load i32, i32* %4
%11 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%12 = call i32 @strlen(i8* %11)
%13 = icmp sle i32 %10, %12
br i1 %13, label %14, label %29
14: ; preds = %9
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %19, i32 %24)
br label %26
26: ; preds = %14
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %9
29: ; preds = %9
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%31 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %31)
%33 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%34 = call i32 @strlen(i8* %33)
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %34)
%36 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* %36)
%38 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%39 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%40 = call i32 @strcmp(i8* %38, i8* %39)
store i32 %40, i32* %5
%41 = load i32, i32* %5
%42 = icmp slt i32 %41, 0
br i1 %42, label %43, label %47
43: ; preds = %29
%44 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%45 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i8* %44, i8* %45)
br label %59
47: ; preds = %29
%48 = load i32, i32* %5
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %54
50: ; preds = %47
%51 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%52 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i8* %51, i8* %52)
br label %58
54: ; preds = %47
%55 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%56 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i8* %55, i8* %56)
br label %58
58: ; preds = %54, %50
br label %59
59: ; preds = %58, %43
%60 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%61 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%62 = call i32 @strcpy(i8* %60, i8* %61)
%63 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%64 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%65 = call i32 @strcmp(i8* %63, i8* %64)
store i32 %65, i32* %5
%66 = load i32, i32* %5
%67 = icmp slt i32 %66, 0
br i1 %67, label %68, label %72
68: ; preds = %59
%69 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%70 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i8* %69, i8* %70)
br label %84
72: ; preds = %59
%73 = load i32, i32* %5
%74 = icmp eq i32 %73, 0
br i1 %74, label %75, label %79
75: ; preds = %72
%76 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%77 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i8* %76, i8* %77)
br label %83
79: ; preds = %72
%80 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%81 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i8* %80, i8* %81)
br label %83
83: ; preds = %79, %75
br label %84
84: ; preds = %83, %68
%85 = load i32, i32* %1
ret i32 %85
}

LLVM IR (-O2):
@__const.main.c = [7 x i8] c"012345\00"
@.str = [15 x i8] c"sizeof(c)= %d\0A\00"
@.str.1 = [18 x i8] c"sizeof(line)= %d\0A\00"
@.str.2 = [17 x i8] c"c[lcv]= %d = %c\0A\00"
@.str.3 = [25 x i8] c"Please enter a string : \00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [19 x i8] c"strlen(line) = %d\0A\00"
@.str.6 = [13 x i8] c"line = [%s]\0A\00"
@.str.7 = [20 x i8] c"%s is less than %s\0A\00"
@.str.8 = [19 x i8] c"%s is equal to %s\0A\00"
@.str.9 = [23 x i8] c"%s is greater than %s\0A\00"
define i32 @main() {
%1 = alloca [7 x i8]
%2 = alloca [128 x i8]
%3 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i64 7)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i64 128)
%7 = call i32 @strlen(i8* %3)
%8 = icmp slt i32 %7, 0
br i1 %8, label %19, label %9
9: ; preds = %0, %9
%10 = phi i64 [ %15, %9 ], [ 0, %0 ]
%11 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %13, i32 %13)
%15 = add nuw nsw i64 %10, 1
%16 = call i32 @strlen(i8* %3)
%17 = sext i32 %16 to i64
%18 = icmp slt i64 %10, %17
br i1 %18, label %9, label %19
19: ; preds = %9, %0
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%22 = call i32 @strlen(i8* %4)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %22)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* %4)
%25 = call i32 @strcmp(i8* %3, i8* %4)
%26 = icmp slt i32 %25, 0
%27 = icmp eq i32 %25, 0
%28 = select i1 %27, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0)
%29 = select i1 %26, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i8* %28
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %29, i8* %3, i8* %4)
%31 = call i32 @strcpy(i8* %4, i8* %3)
%32 = call i32 @strcmp(i8* %3, i8* %4)
%33 = icmp slt i32 %32, 0
%34 = icmp eq i32 %32, 0
%35 = select i1 %34, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0)
%36 = select i1 %33, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i8* %35
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %36, i8* %3, i8* %4)
ret i32 0
}