#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*/ FILE;

/* Variables and functions */
int EOF;
int ftell(int /*<<< orphan*/ *);
int getc(int /*<<< orphan*/ *);
int move_to_configstruct(FILE *fp, char *search_string) {
  int c;
  int s = 0;
  while ((c = getc(fp)) != EOF) {
    if (c == search_string[s]) {
      s++;
    } else {
      s = 0;
    }
    if (search_string[s] == '\0') {
      while (ftell(fp) % 4)
        c = getc(fp);
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<move_to_configstruct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2e9e(%rip),%rcx
cmp    (%rcx),%eax
je     11d4 <move_to_configstruct+0xb4>
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%rcx
movslq -0x20(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    1177 <move_to_configstruct+0x57>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    117e <move_to_configstruct+0x5e>
movl   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    11cf <move_to_configstruct+0xaf>
jmp    1198 <move_to_configstruct+0x78>
mov    -0x10(%rbp),%rdi
call   1030 <ftell@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11c3 <move_to_configstruct+0xa3>
mov    -0x10(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,-0x1c(%rbp)
jmp    1198 <move_to_configstruct+0x78>
movl   $0x1,-0x4(%rbp)
jmp    11db <move_to_configstruct+0xbb>
jmp    1137 <move_to_configstruct+0x17>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<move_to_configstruct>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%rbp
mov    %rdi,%r12
xor    %r14d,%r14d
mov    0x2eb0(%rip),%r15
xor    %ebx,%ebx
jmp    114c <move_to_configstruct+0x2c>
nopl   0x0(%rax)
xor    %ebx,%ebx
movslq %ebx,%rax
cmpb   $0x0,0x0(%rbp,%rax,1)
je     116a <move_to_configstruct+0x4a>
mov    %r12,%rdi
call   1040 <getc@plt>
cmp    (%r15),%eax
je     1194 <move_to_configstruct+0x74>
movslq %ebx,%rcx
movsbl 0x0(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    1140 <move_to_configstruct+0x20>
add    $0x1,%ebx
jmp    1142 <move_to_configstruct+0x22>
mov    %r12,%rdi
call   1030 <ftell@plt>
mov    $0x1,%r14d
test   $0x3,%al
je     1194 <move_to_configstruct+0x74>
nopl   0x0(%rax)
mov    %r12,%rdi
call   1040 <getc@plt>
mov    %r12,%rdi
call   1030 <ftell@plt>
test   $0x3,%al
jne    1180 <move_to_configstruct+0x60>
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @move_to_configstruct(i32* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 0, i32* %7
br label %8
8: ; preds = %44, %2
%9 = load i32*, i32** %4
%10 = call i32 @getc(i32* %9)
store i32 %10, i32* %6
%11 = load i32, i32* @EOF
%12 = icmp ne i32 %10, %11
br i1 %12, label %13, label %45
13: ; preds = %8
%14 = load i32, i32* %6
%15 = load i8*, i8** %5
%16 = load i32, i32* %7
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %14, %20
br i1 %21, label %22, label %25
22: ; preds = %13
%23 = load i32, i32* %7
%24 = add nsw i32 %23, 1
store i32 %24, i32* %7
br label %26
25: ; preds = %13
store i32 0, i32* %7
br label %26
26: ; preds = %25, %22
%27 = load i8*, i8** %5
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %27, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %44
34: ; preds = %26
br label %35
35: ; preds = %40, %34
%36 = load i32*, i32** %4
%37 = call i32 @ftell(i32* %36)
%38 = srem i32 %37, 4
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %35
%41 = load i32*, i32** %4
%42 = call i32 @getc(i32* %41)
store i32 %42, i32* %6
br label %35
43: ; preds = %35
store i32 1, i32* %3
br label %46
44: ; preds = %26
br label %8
45: ; preds = %8
store i32 0, i32* %3
br label %46
46: ; preds = %45, %43
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @move_to_configstruct(i32* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i32 [ 0, %2 ], [ %15, %8 ]
%5 = tail call i32 @getc(i32* %0)
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %5, %6
br i1 %7, label %29, label %8
8: ; preds = %3
%9 = sext i32 %4 to i64
%10 = getelementptr inbounds i8, i8* %1, i64 %9
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %5, %12
%14 = add nsw i32 %4, 1
%15 = select i1 %13, i32 %14, i32 0
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %1, i64 %16
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %3
20: ; preds = %8
%21 = tail call i32 @ftell(i32* %0)
%22 = and i32 %21, 3
%23 = icmp eq i32 %22, 0
br i1 %23, label %29, label %24
24: ; preds = %20, %24
%25 = tail call i32 @getc(i32* %0)
%26 = tail call i32 @ftell(i32* %0)
%27 = and i32 %26, 3
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %24
29: ; preds = %3, %24, %20
%30 = phi i32 [ 1, %20 ], [ 1, %24 ], [ 0, %3 ]
ret i32 %30
}