#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 *, ...);
scalar_t__ strncmp(char *, char *, int);
int main() {
  char *list[5] = {"astronomy", "astounding", "astrophysics", "ostracize",
                   "asterism"};
  int count = 0;
  int i;
  for (i = 0; i < 5; i++)
    if (strncmp(list[i], "astro", 5) == 0) {
      printf("Found: %s\n", list[i]);
      count++;
    }
  printf("The list contained %d words beginning"
         " with astro.\n",
         count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
lea    0xeaa(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xea9(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xea9(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xeab(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xeaa(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
cmpl   $0x5,-0x38(%rbp)
jge    11f5 <main+0xc5>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
lea    0xe87(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11e2 <main+0xb2>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rsi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11e7 <main+0xb7>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1194 <main+0x64>
mov    -0x34(%rbp),%esi
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rdi
lea    0xf06(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
xor    %ebx,%ebx
test   %rax,%rax
jne    115a <main+0x3a>
lea    0xef4(%rip),%rdi
lea    0xeb2(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebx
lea    0xea9(%rip),%rdi
lea    0xecd(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    118f <main+0x6f>
lea    0xebd(%rip),%rdi
lea    0xe85(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
lea    0xe7f(%rip),%rdi
lea    0xe98(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    11c4 <main+0xa4>
lea    0xe88(%rip),%rdi
lea    0xe5b(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
lea    0xe57(%rip),%rdi
lea    0xe63(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    11f9 <main+0xd9>
lea    0xe53(%rip),%rdi
lea    0xe33(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
lea    0xe2c(%rip),%rdi
lea    0xe2e(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    122e <main+0x10e>
lea    0xe1e(%rip),%rdi
lea    0xe08(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
lea    0xe11(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"astronomy\00"
@.str.1 = [11 x i8] c"astounding\00"
@.str.2 = [13 x i8] c"astrophysics\00"
@.str.3 = [10 x i8] c"ostracize\00"
@.str.4 = [9 x i8] c"asterism\00"
@.str.5 = [6 x i8] c"astro\00"
@.str.6 = [11 x i8] c"Found: %s\0A\00"
@.str.7 = [51 x i8] c"The list contained %d words beginning with astro.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i8*]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [5 x i8*]* %2 to i8*
%6 = bitcast i8* %5 to [5 x i8*]*
%7 = getelementptr inbounds [5 x i8*], [5 x i8*]* %6, i32 0, i32 0
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i32 0, i32 0), i8** %7
%8 = getelementptr inbounds [5 x i8*], [5 x i8*]* %6, i32 0, i32 1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i32 0, i32 0), i8** %8
%9 = getelementptr inbounds [5 x i8*], [5 x i8*]* %6, i32 0, i32 2
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i32 0, i32 0), i8** %9
%10 = getelementptr inbounds [5 x i8*], [5 x i8*]* %6, i32 0, i32 3
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i32 0, i32 0), i8** %10
%11 = getelementptr inbounds [5 x i8*], [5 x i8*]* %6, i32 0, i32 4
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0), i8** %11
store i32 0, i32* %3
store i32 0, i32* %4
br label %12
12: ; preds = %31, %0
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 5
br i1 %14, label %15, label %34
15: ; preds = %12
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 %17
%19 = load i8*, i8** %18
%20 = call i64 @strncmp(i8* %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 5)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %30
22: ; preds = %15
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 %24
%26 = load i8*, i8** %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* %26)
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %30
30: ; preds = %22, %15
br label %31
31: ; preds = %30
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %12
34: ; preds = %12
%35 = load i32, i32* %3
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.7, i64 0, i64 0), i32 %35)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"astronomy\00"
@.str.1 = [11 x i8] c"astounding\00"
@.str.2 = [13 x i8] c"astrophysics\00"
@.str.3 = [10 x i8] c"ostracize\00"
@.str.4 = [9 x i8] c"asterism\00"
@.str.5 = [6 x i8] c"astro\00"
@.str.6 = [11 x i8] c"Found: %s\0A\00"
@.str.7 = [51 x i8] c"The list contained %d words beginning with astro.\0A\00"
define i32 @main() {
%1 = tail call i64 @strncmp(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 5)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %0, %3
%6 = phi i32 [ 1, %3 ], [ 0, %0 ]
%7 = tail call i64 @strncmp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 5)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%11 = add nuw nsw i32 %6, 1
br label %12
12: ; preds = %9, %5
%13 = phi i32 [ %11, %9 ], [ %6, %5 ]
%14 = tail call i64 @strncmp(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 5)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%18 = add nuw nsw i32 %13, 1
br label %19
19: ; preds = %16, %12
%20 = phi i32 [ %18, %16 ], [ %13, %12 ]
%21 = tail call i64 @strncmp(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 5)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%25 = add nuw nsw i32 %20, 1
br label %26
26: ; preds = %23, %19
%27 = phi i32 [ %25, %23 ], [ %20, %19 ]
%28 = tail call i64 @strncmp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 5)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %26
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%32 = add nuw nsw i32 %27, 1
br label %33
33: ; preds = %30, %26
%34 = phi i32 [ %32, %30 ], [ %27, %26 ]
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.7, i64 0, i64 0), i32 %34)
ret i32 0
}