#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 */
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int i, j, gevonden;
  char s1[25];
  char s2[25];
  printf(" geef s1: ");
  for (i = 0; (s1[i] = getchar()) != '\n'; i++)
    ;
  s1[i] = '\0';
  printf(" geef s2: ");
  for (j = 0; (s2[j] = getchar()) != '\n'; j++)
    ;
  s2[j] = '\0';
  gevonden = 0;
  for (i = 0; s1[i] != '\0'; i++) {
    for (j = 0; (s2[j] != '\0') && gevonden == 0; j++) {
      if (s1[i] == s2[j]) {
        printf("De letter %c in string s1 ", s1[i]);
        printf("komt voor het eerst voor op positie %d in string s2.\n", j + 1);
        gevonden = 1;
      }
    }
    if (gevonden == 0) {
      printf("De letter %c in string s1 komt niet voor in string s2.\n", s1[i]);
    } else
      gevonden = 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
movslq -0x8(%rbp),%rcx
mov    %al,-0x30(%rbp,%rcx,1)
movsbl %al,%eax
cmp    $0xa,%eax
je     1172 <main+0x52>
jmp    1164 <main+0x44>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1144 <main+0x24>
movslq -0x8(%rbp),%rax
movb   $0x0,-0x30(%rbp,%rax,1)
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
movslq -0xc(%rbp),%rcx
mov    %al,-0x50(%rbp,%rcx,1)
movsbl %al,%eax
cmp    $0xa,%eax
je     11be <main+0x9e>
jmp    11b0 <main+0x90>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1190 <main+0x70>
movslq -0xc(%rbp),%rax
movb   $0x0,-0x50(%rbp,%rax,1)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
movslq -0x8(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     12be <main+0x19e>
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rax
movsbl -0x50(%rbp,%rax,1),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x51(%rbp)
je     120f <main+0xef>
cmpl   $0x0,-0x10(%rbp)
sete   %al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
test   $0x1,%al
jne    121f <main+0xff>
jmp    127e <main+0x15e>
movslq -0x8(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
movslq -0xc(%rbp),%rcx
movsbl -0x50(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    126b <main+0x14b>
movslq -0x8(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%esi
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
lea    0xdd4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x10(%rbp)
jmp    1270 <main+0x150>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ee <main+0xce>
cmpl   $0x0,-0x10(%rbp)
jne    12a4 <main+0x184>
movslq -0x8(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%esi
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12ab <main+0x18b>
movl   $0x0,-0x10(%rbp)
jmp    12b0 <main+0x190>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11d5 <main+0xb5>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xffffffffffffffff,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %al,0x21(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0xa,%al
jne    1150 <main+0x30>
mov    %ebx,%eax
movb   $0x0,0x20(%rsp,%rax,1)
lea    0xe9a(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xffffffffffffffff,%rbx
nop
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %al,0x1(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0xa,%al
jne    1180 <main+0x60>
mov    %ebx,%eax
movb   $0x0,(%rsp,%rax,1)
mov    0x20(%rsp),%al
test   %al,%al
je     1231 <main+0x111>
mov    (%rsp),%r13b
lea    0xeb7(%rip),%r12
lea    0xe5f(%rip),%r14
lea    0xe73(%rip),%r15
xor    %ebp,%ebp
jmp    11e6 <main+0xc6>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x21(%rsp,%rbp,1),%al
add    $0x1,%rbp
test   %al,%al
je     1231 <main+0x111>
movsbl %al,%esi
test   %r13b,%r13b
je     11d0 <main+0xb0>
mov    $0x1,%ebx
mov    %r13d,%ecx
cs nopw 0x0(%rax,%rax,1)
cmp    %cl,%al
je     1220 <main+0x100>
cmp    %cl,%al
je     11d0 <main+0xb0>
movzbl (%rsp,%rbx,1),%ecx
add    $0x1,%rbx
test   %cl,%cl
jne    1200 <main+0xe0>
jmp    11d0 <main+0xb0>
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %ebx,%esi
jmp    11d3 <main+0xb3>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c" geef s1: \00"
@.str.1 = [11 x i8] c" geef s2: \00"
@.str.2 = [27 x i8] c"De letter %c in string s1 \00"
@.str.3 = [54 x i8] c"komt voor het eerst voor op positie %d in string s2.\0A\00"
@.str.4 = [56 x i8] c"De letter %c in string s1 komt niet voor in string s2.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [25 x i8]
%6 = alloca [25 x i8]
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %8
8: ; preds = %16, %0
%9 = call signext i8 (...) @getchar()
%10 = load i32, i32* %2
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 %11
store i8 %9, i8* %12
%13 = sext i8 %9 to i32
%14 = icmp ne i32 %13, 10
br i1 %14, label %15, label %19
15: ; preds = %8
br label %16
16: ; preds = %15
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %8
19: ; preds = %8
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 %21
store i8 0, i8* %22
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %24
24: ; preds = %32, %19
%25 = call signext i8 (...) @getchar()
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [25 x i8], [25 x i8]* %6, i64 0, i64 %27
store i8 %25, i8* %28
%29 = sext i8 %25 to i32
%30 = icmp ne i32 %29, 10
br i1 %30, label %31, label %35
31: ; preds = %24
br label %32
32: ; preds = %31
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %24
35: ; preds = %24
%36 = load i32, i32* %3
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [25 x i8], [25 x i8]* %6, i64 0, i64 %37
store i8 0, i8* %38
store i32 0, i32* %4
store i32 0, i32* %2
br label %39
39: ; preds = %97, %35
%40 = load i32, i32* %2
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %100
46: ; preds = %39
store i32 0, i32* %3
br label %47
47: ; preds = %82, %46
%48 = load i32, i32* %3
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [25 x i8], [25 x i8]* %6, i64 0, i64 %49
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %47
%55 = load i32, i32* %4
%56 = icmp eq i32 %55, 0
br label %57
57: ; preds = %54, %47
%58 = phi i1 [ false, %47 ], [ %56, %54 ]
br i1 %58, label %59, label %85
59: ; preds = %57
%60 = load i32, i32* %2
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 %61
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = load i32, i32* %3
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [25 x i8], [25 x i8]* %6, i64 0, i64 %66
%68 = load i8, i8* %67
%69 = sext i8 %68 to i32
%70 = icmp eq i32 %64, %69
br i1 %70, label %71, label %81
71: ; preds = %59
%72 = load i32, i32* %2
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 %73
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %76)
%78 = load i32, i32* %3
%79 = add nsw i32 %78, 1
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0), i32 %79)
store i32 1, i32* %4
br label %81
81: ; preds = %71, %59
br label %82
82: ; preds = %81
%83 = load i32, i32* %3
%84 = add nsw i32 %83, 1
store i32 %84, i32* %3
br label %47
85: ; preds = %57
%86 = load i32, i32* %4
%87 = icmp eq i32 %86, 0
br i1 %87, label %88, label %95
88: ; preds = %85
%89 = load i32, i32* %2
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 %90
%92 = load i8, i8* %91
%93 = sext i8 %92 to i32
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0), i32 %93)
br label %96
95: ; preds = %85
store i32 0, i32* %4
br label %96
96: ; preds = %95, %88
br label %97
97: ; preds = %96
%98 = load i32, i32* %2
%99 = add nsw i32 %98, 1
store i32 %99, i32* %2
br label %39
100: ; preds = %39
%101 = load i32, i32* %1
ret i32 %101
}

LLVM IR (-O2):
@.str = [11 x i8] c" geef s1: \00"
@.str.1 = [11 x i8] c" geef s2: \00"
@.str.2 = [27 x i8] c"De letter %c in string s1 \00"
@.str.3 = [54 x i8] c"komt voor het eerst voor op positie %d in string s2.\0A\00"
@.str.4 = [56 x i8] c"De letter %c in string s1 komt niet voor in string s2.\0A\00"
define i32 @main() {
%1 = alloca [25 x i8]
%2 = alloca [25 x i8]
%3 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %6, %0
%7 = phi i64 [ %11, %6 ], [ 0, %0 ]
%8 = tail call signext i8 (...) @getchar()
%9 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 %7
store i8 %8, i8* %9
%10 = icmp eq i8 %8, 10
%11 = add nuw i64 %7, 1
br i1 %10, label %12, label %6
12: ; preds = %6
%13 = and i64 %7, 4294967295
%14 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 %13
store i8 0, i8* %14
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %16, %12
%17 = phi i64 [ %21, %16 ], [ 0, %12 ]
%18 = tail call signext i8 (...) @getchar()
%19 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 %17
store i8 %18, i8* %19
%20 = icmp eq i8 %18, 10
%21 = add nuw i64 %17, 1
br i1 %20, label %22, label %16
22: ; preds = %16
%23 = and i64 %17, 4294967295
%24 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 %23
store i8 0, i8* %24
%25 = load i8, i8* %3
%26 = icmp eq i8 %25, 0
br i1 %26, label %56, label %27
27: ; preds = %22
%28 = load i8, i8* %4
%29 = icmp eq i8 %28, 0
br label %30
30: ; preds = %27, %51
%31 = phi i64 [ 0, %27 ], [ %52, %51 ]
%32 = phi i8 [ %25, %27 ], [ %54, %51 ]
%33 = sext i8 %32 to i32
br i1 %29, label %49, label %34
34: ; preds = %30, %43
%35 = phi i64 [ %44, %43 ], [ 0, %30 ]
%36 = phi i8 [ %46, %43 ], [ %28, %30 ]
%37 = icmp eq i8 %32, %36
br i1 %37, label %38, label %43
38: ; preds = %34
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %33)
%40 = trunc i64 %35 to i32
%41 = add i32 %40, 1
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0), i32 %41)
br label %51
43: ; preds = %34
%44 = add nuw i64 %35, 1
%45 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = icmp eq i8 %46, 0
%48 = or i1 %37, %47
br i1 %48, label %49, label %34
49: ; preds = %43, %30
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0), i32 %33)
br label %51
51: ; preds = %38, %49
%52 = add nuw i64 %31, 1
%53 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 %52
%54 = load i8, i8* %53
%55 = icmp eq i8 %54, 0
br i1 %55, label %56, label %30
56: ; preds = %51, %22
ret i32 0
}