#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*/ printf(char *, int, ...);
int /*<<< orphan*/ scanf(char *, char *);
scalar_t__ strcmp(char *, char *);
int main(void) {
  int i = 0;
  char s[100][128];
  for (i = 0; i < 100; i++) {
    printf("s[%d]:", i);
    scanf("%s", s[i]);
    if (strcmp(s[i], "$$$$$") == 0) {
      break;
    }
  }
  i = 0;
  while (i < 100 && strcmp(s[i], "$$$$$") != 0) {
    printf("s[%d] = \"%s\n", i, s[i]);
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3220,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    11c9 <main+0x99>
mov    -0x8(%rbp),%esi
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x8(%rbp),%rax
lea    -0x3210(%rbp),%rsi
shl    $0x7,%rax
add    %rax,%rsi
lea    0xe83(%rip),%rdi
call   1050 <scanf@plt>
movslq -0x8(%rbp),%rax
lea    -0x3210(%rbp),%rdi
shl    $0x7,%rax
add    %rax,%rdi
lea    0xe68(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11b6 <main+0x86>
jmp    11c9 <main+0x99>
jmp    11bb <main+0x8b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1150 <main+0x20>
movl   $0x0,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x64,-0x8(%rbp)
mov    %al,-0x3211(%rbp)
jge    120d <main+0xdd>
movslq -0x8(%rbp),%rax
lea    -0x3210(%rbp),%rdi
shl    $0x7,%rax
add    %rax,%rdi
lea    0xe0f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x3211(%rbp)
mov    -0x3211(%rbp),%al
test   $0x1,%al
jne    1220 <main+0xf0>
jmp    1251 <main+0x121>
mov    -0x8(%rbp),%esi
movslq -0x8(%rbp),%rax
lea    -0x3210(%rbp),%rdx
shl    $0x7,%rax
add    %rax,%rdx
lea    0xdd4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11d0 <main+0xa0>
xor    %eax,%eax
add    $0x3220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3200,%rsp
mov    %rsp,%rbx
lea    0xeb6(%rip),%r14
lea    0xeb6(%rip),%r15
lea    0xeb2(%rip),%r12
xor    %r13d,%r13d
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1199 <main+0x69>
lea    0x1(%r13),%rax
sub    $0xffffffffffffff80,%rbx
cmp    $0x63,%r13
mov    %rax,%r13
jne    1160 <main+0x30>
mov    %rsp,%r12
lea    0xe67(%rip),%r14
lea    0xe66(%rip),%r15
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11dd <main+0xad>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r12,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
sub    $0xffffffffffffff80,%r12
cmp    $0x64,%rbx
jne    11b0 <main+0x80>
xor    %eax,%eax
add    $0x3200,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"s[%d]:\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [6 x i8] c"$$$$$\00"
@.str.3 = [13 x i8] c"s[%d] = \22%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100 x [128 x i8]]
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %2
br label %4
4: ; preds = %23, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 100
br i1 %6, label %7, label %26
7: ; preds = %4
%8 = load i32, i32* %2
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %2
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [100 x [128 x i8]], [100 x [128 x i8]]* %3, i64 0, i64 %11
%13 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [100 x [128 x i8]], [100 x [128 x i8]]* %3, i64 0, i64 %16
%18 = getelementptr inbounds [128 x i8], [128 x i8]* %17, i64 0, i64 0
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %7
br label %26
22: ; preds = %7
br label %23
23: ; preds = %22
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 1
store i32 %25, i32* %2
br label %4
26: ; preds = %21, %4
store i32 0, i32* %2
br label %27
27: ; preds = %39, %26
%28 = load i32, i32* %2
%29 = icmp slt i32 %28, 100
br i1 %29, label %30, label %37
30: ; preds = %27
%31 = load i32, i32* %2
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [100 x [128 x i8]], [100 x [128 x i8]]* %3, i64 0, i64 %32
%34 = getelementptr inbounds [128 x i8], [128 x i8]* %33, i64 0, i64 0
%35 = call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%36 = icmp ne i64 %35, 0
br label %37
37: ; preds = %30, %27
%38 = phi i1 [ false, %27 ], [ %36, %30 ]
br i1 %38, label %39, label %48
39: ; preds = %37
%40 = load i32, i32* %2
%41 = load i32, i32* %2
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [100 x [128 x i8]], [100 x [128 x i8]]* %3, i64 0, i64 %42
%44 = getelementptr inbounds [128 x i8], [128 x i8]* %43, i64 0, i64 0
%45 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %40, i8* %44)
%46 = load i32, i32* %2
%47 = add nsw i32 %46, 1
store i32 %47, i32* %2
br label %27
48: ; preds = %37
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"s[%d]:\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [6 x i8] c"$$$$$\00"
@.str.3 = [13 x i8] c"s[%d] = \22%s\0A\00"
define i32 @main() {
%1 = alloca [100 x [128 x i8]]
%2 = getelementptr inbounds [100 x [128 x i8]], [100 x [128 x i8]]* %1, i64 0, i64 0, i64 0
br label %3
3: ; preds = %3, %0
%4 = phi i64 [ 0, %0 ], [ %11, %3 ]
%5 = trunc i64 %4 to i32
%6 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds [100 x [128 x i8]], [100 x [128 x i8]]* %1, i64 0, i64 %4, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
%11 = add nuw nsw i64 %4, 1
%12 = icmp eq i64 %11, 100
%13 = select i1 %10, i1 true, i1 %12
br i1 %13, label %14, label %3
14: ; preds = %3, %19
%15 = phi i64 [ %22, %19 ], [ 0, %3 ]
%16 = getelementptr inbounds [100 x [128 x i8]], [100 x [128 x i8]]* %1, i64 0, i64 %15, i64 0
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %24, label %19
19: ; preds = %14
%20 = trunc i64 %15 to i32
%21 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %20, i8* %16)
%22 = add nuw nsw i64 %15, 1
%23 = icmp eq i64 %22, 100
br i1 %23, label %24, label %14
24: ; preds = %19, %14
ret i32 0
}