#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 const *, char *, int);
int main() {
  const char *list[6] = {"astronomy", "astounding", "astrophysics",
                         "ostracize", "asterism",   "astrophobia"};
  int count = 0;
  int i;
  for (i = 0; i < 6; 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    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1050 <memset@plt>
lea    0xeaa(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xea9(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xea9(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xeab(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xeaa(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xea8(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
cmpl   $0x6,-0x48(%rbp)
jge    1200 <main+0xd0>
movslq -0x48(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdi
lea    0xe88(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11ed <main+0xbd>
movslq -0x48(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rsi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11f2 <main+0xc2>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    119f <main+0x6f>
mov    -0x44(%rbp),%esi
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rdi
lea    0xf12(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
xor    %ebx,%ebx
test   %rax,%rax
jne    115a <main+0x3a>
lea    0xf00(%rip),%rdi
lea    0xeb2(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebx
lea    0xea9(%rip),%rdi
lea    0xed9(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    118f <main+0x6f>
lea    0xec9(%rip),%rdi
lea    0xe85(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
lea    0xe7f(%rip),%rdi
lea    0xea4(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    11c4 <main+0xa4>
lea    0xe94(%rip),%rdi
lea    0xe5b(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
lea    0xe57(%rip),%rdi
lea    0xe6f(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    11f9 <main+0xd9>
lea    0xe5f(%rip),%rdi
lea    0xe33(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
lea    0xe2c(%rip),%rdi
lea    0xe3a(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    122e <main+0x10e>
lea    0xe2a(%rip),%rdi
lea    0xe08(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
lea    0xe00(%rip),%rdi
lea    0xe05(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1263 <main+0x143>
lea    0xdf5(%rip),%rdi
lea    0xddc(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
lea    0xde8(%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 = [12 x i8] c"astrophobia\00"
@.str.6 = [6 x i8] c"astro\00"
@.str.7 = [11 x i8] c"Found: %s\0A\00"
@.str.8 = [51 x i8] c"The list contained %d words beginning with astro.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i8*]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [6 x i8*]* %2 to i8*
%6 = bitcast i8* %5 to [6 x i8*]*
%7 = getelementptr inbounds [6 x i8*], [6 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 [6 x i8*], [6 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 [6 x i8*], [6 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 [6 x i8*], [6 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 [6 x i8*], [6 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
%12 = getelementptr inbounds [6 x i8*], [6 x i8*]* %6, i32 0, i32 5
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i32 0, i32 0), i8** %12
store i32 0, i32* %3
store i32 0, i32* %4
br label %13
13: ; preds = %32, %0
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 6
br i1 %15, label %16, label %35
16: ; preds = %13
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [6 x i8*], [6 x i8*]* %2, i64 0, i64 %18
%20 = load i8*, i8** %19
%21 = call i64 @strncmp(i8* %20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 5)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %31
23: ; preds = %16
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [6 x i8*], [6 x i8*]* %2, i64 0, i64 %25
%27 = load i8*, i8** %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* %27)
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
br label %31
31: ; preds = %23, %16
br label %32
32: ; preds = %31
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
br label %13
35: ; preds = %13
%36 = load i32, i32* %3
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.8, i64 0, i64 0), i32 %36)
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 = [12 x i8] c"astrophobia\00"
@.str.6 = [6 x i8] c"astro\00"
@.str.7 = [11 x i8] c"Found: %s\0A\00"
@.str.8 = [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.6, 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.7, 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.6, 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.7, 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.6, 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.7, 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.6, 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.7, 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.6, 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.7, 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 i64 @strncmp(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 5)
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %40
37: ; preds = %33
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%39 = add nuw nsw i32 %34, 1
br label %40
40: ; preds = %37, %33
%41 = phi i32 [ %39, %37 ], [ %34, %33 ]
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.8, i64 0, i64 0), i32 %41)
ret i32 0
}