#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 *ps1 = s1;
  char s2[25];
  char *ps2 = s2;
  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 (*(ps1 + i) == *(ps2 + j)) {
        printf("De letter %c in string s1 ", *(ps1 + 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",
             *(ps1 + i));
    } else
      gevonden = 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0x68(%rbp)
lea    0xeba(%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     1182 <main+0x62>
jmp    1174 <main+0x54>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1154 <main+0x34>
movslq -0x8(%rbp),%rax
movb   $0x0,-0x30(%rbp,%rax,1)
lea    0xe79(%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,-0x60(%rbp,%rcx,1)
movsbl %al,%eax
cmp    $0xa,%eax
je     11ce <main+0xae>
jmp    11c0 <main+0xa0>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a0 <main+0x80>
movslq -0xc(%rbp),%rax
movb   $0x0,-0x60(%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     12da <main+0x1ba>
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x69(%rbp)
je     121f <main+0xff>
cmpl   $0x0,-0x10(%rbp)
sete   %al
mov    %al,-0x69(%rbp)
mov    -0x69(%rbp),%al
test   $0x1,%al
jne    122f <main+0x10f>
jmp    1297 <main+0x177>
mov    -0x38(%rbp),%rax
movslq -0x8(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x68(%rbp),%rcx
movslq -0xc(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    1284 <main+0x164>
mov    -0x38(%rbp),%rax
movslq -0x8(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xdb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
lea    0xdbb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x10(%rbp)
jmp    1289 <main+0x169>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11fe <main+0xde>
cmpl   $0x0,-0x10(%rbp)
jne    12c0 <main+0x1a0>
mov    -0x38(%rbp),%rax
movslq -0x8(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12c7 <main+0x1a7>
movl   $0x0,-0x10(%rbp)
jmp    12cc <main+0x1ac>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11e5 <main+0xc5>
mov    -0x4(%rbp),%eax
add    $0x70,%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 i8*
%7 = alloca [25 x i8]
%8 = alloca i8*
store i32 0, i32* %1
%9 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
store i8* %9, i8** %6
%10 = getelementptr inbounds [25 x i8], [25 x i8]* %7, i64 0, i64 0
store i8* %10, i8** %8
%11 = 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 %12
12: ; preds = %20, %0
%13 = call signext i8 (...) @getchar()
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 %15
store i8 %13, i8* %16
%17 = sext i8 %13 to i32
%18 = icmp ne i32 %17, 10
br i1 %18, label %19, label %23
19: ; preds = %12
br label %20
20: ; preds = %19
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 1
store i32 %22, i32* %2
br label %12
23: ; preds = %12
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 %25
store i8 0, i8* %26
%27 = 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 %28
28: ; preds = %36, %23
%29 = call signext i8 (...) @getchar()
%30 = load i32, i32* %3
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [25 x i8], [25 x i8]* %7, i64 0, i64 %31
store i8 %29, i8* %32
%33 = sext i8 %29 to i32
%34 = icmp ne i32 %33, 10
br i1 %34, label %35, label %39
35: ; preds = %28
br label %36
36: ; preds = %35
%37 = load i32, i32* %3
%38 = add nsw i32 %37, 1
store i32 %38, i32* %3
br label %28
39: ; preds = %28
%40 = load i32, i32* %3
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [25 x i8], [25 x i8]* %7, i64 0, i64 %41
store i8 0, i8* %42
store i32 0, i32* %4
store i32 0, i32* %2
br label %43
43: ; preds = %105, %39
%44 = load i32, i32* %2
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 %45
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %108
50: ; preds = %43
store i32 0, i32* %3
br label %51
51: ; preds = %89, %50
%52 = load i32, i32* %3
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [25 x i8], [25 x i8]* %7, i64 0, i64 %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp ne i32 %56, 0
br i1 %57, label %58, label %61
58: ; preds = %51
%59 = load i32, i32* %4
%60 = icmp eq i32 %59, 0
br label %61
61: ; preds = %58, %51
%62 = phi i1 [ false, %51 ], [ %60, %58 ]
br i1 %62, label %63, label %92
63: ; preds = %61
%64 = load i8*, i8** %6
%65 = load i32, i32* %2
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i8, i8* %64, i64 %66
%68 = load i8, i8* %67
%69 = sext i8 %68 to i32
%70 = load i8*, i8** %8
%71 = load i32, i32* %3
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8, i8* %70, i64 %72
%74 = load i8, i8* %73
%75 = sext i8 %74 to i32
%76 = icmp eq i32 %69, %75
br i1 %76, label %77, label %88
77: ; preds = %63
%78 = load i8*, i8** %6
%79 = load i32, i32* %2
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds i8, i8* %78, i64 %80
%82 = load i8, i8* %81
%83 = sext i8 %82 to i32
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %83)
%85 = load i32, i32* %3
%86 = add nsw i32 %85, 1
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0), i32 %86)
store i32 1, i32* %4
br label %88
88: ; preds = %77, %63
br label %89
89: ; preds = %88
%90 = load i32, i32* %3
%91 = add nsw i32 %90, 1
store i32 %91, i32* %3
br label %51
92: ; preds = %61
%93 = load i32, i32* %4
%94 = icmp eq i32 %93, 0
br i1 %94, label %95, label %103
95: ; preds = %92
%96 = load i8*, i8** %6
%97 = load i32, i32* %2
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds i8, i8* %96, i64 %98
%100 = load i8, i8* %99
%101 = sext i8 %100 to i32
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0), i32 %101)
br label %104
103: ; preds = %92
store i32 0, i32* %4
br label %104
104: ; preds = %103, %95
br label %105
105: ; preds = %104
%106 = load i32, i32* %2
%107 = add nsw i32 %106, 1
store i32 %107, i32* %2
br label %43
108: ; preds = %43
%109 = load i32, i32* %1
ret i32 %109
}

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
}