#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*/ *s_gets(char *, int);
scalar_t__ strcmp(char *, char *);
int main(void) {
  char input[10][80];
  int ct = 0;
  printf("Enter up to %d lines (type quit to quit):\n", 10);
  while (ct < 10 && s_gets(input[ct], 80) != NULL &&
         strcmp(input[ct], "quit") != 0) {
    ct++;
  }
  printf("%d strings entered\n", ct);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x334(%rbp)
lea    0xead(%rip),%rdi
mov    $0xa,%esi
call   1040 <printf@plt>
xor    %eax,%eax
cmpl   $0xa,-0x334(%rbp)
mov    %al,-0x335(%rbp)
jge    11d4 <main+0xa4>
movslq -0x334(%rbp),%rax
lea    -0x330(%rbp),%rdi
imul   $0x50,%rax,%rax
add    %rax,%rdi
mov    $0x50,%esi
call   1030 <s_gets@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x335(%rbp)
je     11d4 <main+0xa4>
movslq -0x334(%rbp),%rax
lea    -0x330(%rbp),%rdi
imul   $0x50,%rax,%rax
add    %rax,%rdi
lea    0xe69(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x335(%rbp)
mov    -0x335(%rbp),%al
test   $0x1,%al
jne    11e7 <main+0xb7>
jmp    11fb <main+0xcb>
mov    -0x334(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x334(%rbp)
jmp    115d <main+0x2d>
mov    -0x334(%rbp),%esi
lea    0xe28(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x340,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x328,%rsp
lea    0xebf(%rip),%rdi
mov    $0xa,%esi
call   1040 <printf@plt>
mov    %rsp,%rdi
mov    $0x50,%esi
call   1030 <s_gets@plt>
xor    %ebx,%ebx
test   %rax,%rax
je     1380 <main+0x250>
lea    0xec1(%rip),%rsi
mov    %rsp,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1380 <main+0x250>
lea    0x50(%rsp),%r14
mov    %r14,%rdi
mov    $0x50,%esi
call   1030 <s_gets@plt>
mov    $0x1,%ebx
test   %rax,%rax
je     1380 <main+0x250>
lea    0xe89(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1380 <main+0x250>
lea    0xa0(%rsp),%r14
mov    %r14,%rdi
mov    $0x50,%esi
call   1030 <s_gets@plt>
mov    $0x2,%ebx
test   %rax,%rax
je     1380 <main+0x250>
lea    0xe4e(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1380 <main+0x250>
lea    0xf0(%rsp),%r14
mov    %r14,%rdi
mov    $0x50,%esi
call   1030 <s_gets@plt>
mov    $0x3,%ebx
test   %rax,%rax
je     1380 <main+0x250>
lea    0xe13(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1380 <main+0x250>
lea    0x140(%rsp),%r14
mov    %r14,%rdi
mov    $0x50,%esi
call   1030 <s_gets@plt>
mov    $0x4,%ebx
test   %rax,%rax
je     1380 <main+0x250>
lea    0xdd8(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1380 <main+0x250>
lea    0x190(%rsp),%r14
mov    %r14,%rdi
mov    $0x50,%esi
call   1030 <s_gets@plt>
mov    $0x5,%ebx
test   %rax,%rax
je     1380 <main+0x250>
lea    0xd9d(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1380 <main+0x250>
lea    0x1e0(%rsp),%r14
mov    %r14,%rdi
mov    $0x50,%esi
call   1030 <s_gets@plt>
mov    $0x6,%ebx
test   %rax,%rax
je     1380 <main+0x250>
lea    0xd62(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1380 <main+0x250>
lea    0x230(%rsp),%r14
mov    %r14,%rdi
mov    $0x50,%esi
call   1030 <s_gets@plt>
mov    $0x7,%ebx
test   %rax,%rax
je     1380 <main+0x250>
lea    0xd27(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1380 <main+0x250>
lea    0x280(%rsp),%r14
mov    %r14,%rdi
mov    $0x50,%esi
call   1030 <s_gets@plt>
mov    $0x8,%ebx
test   %rax,%rax
je     1380 <main+0x250>
lea    0xcf4(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1380 <main+0x250>
lea    0x2d0(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1030 <s_gets@plt>
test   %rax,%rax
je     137b <main+0x24b>
lea    0xcc6(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
cmp    $0x1,%rax
mov    $0xa,%ebx
sbb    $0x0,%ebx
jmp    1380 <main+0x250>
mov    $0x9,%ebx
lea    0xca9(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x328,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Enter up to %d lines (type quit to quit):\0A\00"
@.str.1 = [5 x i8] c"quit\00"
@.str.2 = [20 x i8] c"%d strings entered\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x [80 x i8]]
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%4 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 10)
br label %5
5: ; preds = %24, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %22
8: ; preds = %5
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [10 x [80 x i8]], [10 x [80 x i8]]* %2, i64 0, i64 %10
%12 = getelementptr inbounds [80 x i8], [80 x i8]* %11, i64 0, i64 0
%13 = call i32* @s_gets(i8* %12, i32 80)
%14 = icmp ne i32* %13, null
br i1 %14, label %15, label %22
15: ; preds = %8
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [10 x [80 x i8]], [10 x [80 x i8]]* %2, i64 0, i64 %17
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %18, i64 0, i64 0
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp ne i64 %20, 0
br label %22
22: ; preds = %15, %8, %5
%23 = phi i1 [ false, %8 ], [ false, %5 ], [ %21, %15 ]
br i1 %23, label %24, label %27
24: ; preds = %22
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %5
27: ; preds = %22
%28 = load i32, i32* %3
%29 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %28)
ret i32 0
}

LLVM IR (-O2):
@.str = [43 x i8] c"Enter up to %d lines (type quit to quit):\0A\00"
@.str.1 = [5 x i8] c"quit\00"
@.str.2 = [20 x i8] c"%d strings entered\0A\00"
define i32 @main() {
%1 = alloca [10 x [80 x i8]]
%2 = getelementptr inbounds [10 x [80 x i8]], [10 x [80 x i8]]* %1, i64 0, i64 0, i64 0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 10)
%4 = call i32* @s_gets(i8* %2, i32 80)
%5 = icmp eq i32* %4, null
br i1 %5, label %73, label %6
6: ; preds = %0
%7 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %73, label %9
9: ; preds = %6
%10 = getelementptr inbounds [10 x [80 x i8]], [10 x [80 x i8]]* %1, i64 0, i64 1, i64 0
%11 = call i32* @s_gets(i8* %10, i32 80)
%12 = icmp eq i32* %11, null
br i1 %12, label %73, label %13
13: ; preds = %9
%14 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %73, label %16
16: ; preds = %13
%17 = getelementptr inbounds [10 x [80 x i8]], [10 x [80 x i8]]* %1, i64 0, i64 2, i64 0
%18 = call i32* @s_gets(i8* %17, i32 80)
%19 = icmp eq i32* %18, null
br i1 %19, label %73, label %20
20: ; preds = %16
%21 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %73, label %23
23: ; preds = %20
%24 = getelementptr inbounds [10 x [80 x i8]], [10 x [80 x i8]]* %1, i64 0, i64 3, i64 0
%25 = call i32* @s_gets(i8* %24, i32 80)
%26 = icmp eq i32* %25, null
br i1 %26, label %73, label %27
27: ; preds = %23
%28 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %73, label %30
30: ; preds = %27
%31 = getelementptr inbounds [10 x [80 x i8]], [10 x [80 x i8]]* %1, i64 0, i64 4, i64 0
%32 = call i32* @s_gets(i8* %31, i32 80)
%33 = icmp eq i32* %32, null
br i1 %33, label %73, label %34
34: ; preds = %30
%35 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %73, label %37
37: ; preds = %34
%38 = getelementptr inbounds [10 x [80 x i8]], [10 x [80 x i8]]* %1, i64 0, i64 5, i64 0
%39 = call i32* @s_gets(i8* %38, i32 80)
%40 = icmp eq i32* %39, null
br i1 %40, label %73, label %41
41: ; preds = %37
%42 = call i64 @strcmp(i8* %38, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %73, label %44
44: ; preds = %41
%45 = getelementptr inbounds [10 x [80 x i8]], [10 x [80 x i8]]* %1, i64 0, i64 6, i64 0
%46 = call i32* @s_gets(i8* %45, i32 80)
%47 = icmp eq i32* %46, null
br i1 %47, label %73, label %48
48: ; preds = %44
%49 = call i64 @strcmp(i8* %45, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%50 = icmp eq i64 %49, 0
br i1 %50, label %73, label %51
51: ; preds = %48
%52 = getelementptr inbounds [10 x [80 x i8]], [10 x [80 x i8]]* %1, i64 0, i64 7, i64 0
%53 = call i32* @s_gets(i8* %52, i32 80)
%54 = icmp eq i32* %53, null
br i1 %54, label %73, label %55
55: ; preds = %51
%56 = call i64 @strcmp(i8* %52, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%57 = icmp eq i64 %56, 0
br i1 %57, label %73, label %58
58: ; preds = %55
%59 = getelementptr inbounds [10 x [80 x i8]], [10 x [80 x i8]]* %1, i64 0, i64 8, i64 0
%60 = call i32* @s_gets(i8* %59, i32 80)
%61 = icmp eq i32* %60, null
br i1 %61, label %73, label %62
62: ; preds = %58
%63 = call i64 @strcmp(i8* %59, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%64 = icmp eq i64 %63, 0
br i1 %64, label %73, label %65
65: ; preds = %62
%66 = getelementptr inbounds [10 x [80 x i8]], [10 x [80 x i8]]* %1, i64 0, i64 9, i64 0
%67 = call i32* @s_gets(i8* %66, i32 80)
%68 = icmp eq i32* %67, null
br i1 %68, label %73, label %69
69: ; preds = %65
%70 = call i64 @strcmp(i8* %66, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%71 = icmp eq i64 %70, 0
%72 = select i1 %71, i32 9, i32 10
br label %73
73: ; preds = %69, %65, %62, %58, %55, %51, %48, %44, %41, %37, %34, %30, %27, %23, %20, %16, %13, %9, %0, %6
%74 = phi i32 [ 0, %0 ], [ 0, %6 ], [ 1, %9 ], [ 1, %13 ], [ 2, %16 ], [ 2, %20 ], [ 3, %23 ], [ 3, %27 ], [ 4, %30 ], [ 4, %34 ], [ 5, %37 ], [ 5, %41 ], [ 6, %44 ], [ 6, %48 ], [ 7, %51 ], [ 7, %55 ], [ 8, %58 ], [ 8, %62 ], [ 9, %65 ], [ %72, %69 ]
%75 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %74)
ret i32 0
}