#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 *, int, ...);
scalar_t__ strlen(char *);
scalar_t__ strncmp(char *, char *, scalar_t__);
int main(int argc, char **argv) {
  int i;
  printf("Number of arguments from the user: %d\n", argc);
  for (i = 0; i < argc; i++) {
    printf("* Argument nr %d is '%s'\n", i, argv[i]);
    if (strlen(argv[i]) == strlen("--terminate") &&
        strncmp(argv[i], "--terminate", strlen("--terminate")) == 0) {
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1209 <main+0xd9>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x20(%rbp)
lea    0xe9e(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
jne    11f6 <main+0xc6>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
lea    0xe72(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    %rax,%rdx
lea    0xe5f(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11f6 <main+0xc6>
jmp    1209 <main+0xd9>
jmp    11fb <main+0xcb>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115e <main+0x2e>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r13
mov    %edi,%r12d
lea    0xeb8(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r12d,%r12d
jle    11b3 <main+0x83>
lea    0xec9(%rip),%r14
lea    0xedc(%rip),%r15
xor    %ebp,%ebp
jmp    1178 <main+0x48>
nopl   0x0(%rax)
add    $0x1,%ebp
cmp    %r12d,%ebp
jge    11b3 <main+0x83>
mov    %ebp,%ebx
mov    0x0(%r13,%rbx,8),%rdx
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x0(%r13,%rbx,8),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0xb,%rax
jne    1170 <main+0x40>
mov    $0xb,%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1170 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [39 x i8] c"Number of arguments from the user: %d\0A\00"
@.str.1 = [26 x i8] c"* Argument nr %d is '%s'\0A\00"
@.str.2 = [12 x i8] c"--terminate\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %7)
store i32 0, i32* %6
br label %9
9: ; preds = %40, %2
%10 = load i32, i32* %6
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %43
13: ; preds = %9
%14 = load i32, i32* %6
%15 = load i8**, i8*** %5
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %14, i8* %19)
%21 = load i8**, i8*** %5
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %21, i64 %23
%25 = load i8*, i8** %24
%26 = call i64 @strlen(i8* %25)
%27 = call i64 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%28 = icmp eq i64 %26, %27
br i1 %28, label %29, label %39
29: ; preds = %13
%30 = load i8**, i8*** %5
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %30, i64 %32
%34 = load i8*, i8** %33
%35 = call i64 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%36 = call i64 @strncmp(i8* %34, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i64 %35)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %29
br label %43
39: ; preds = %29, %13
br label %40
40: ; preds = %39
%41 = load i32, i32* %6
%42 = add nsw i32 %41, 1
store i32 %42, i32* %6
br label %9
43: ; preds = %38, %9
ret i32 0
}

LLVM IR (-O2):
@.str = [39 x i8] c"Number of arguments from the user: %d\0A\00"
@.str.1 = [26 x i8] c"* Argument nr %d is '%s'\0A\00"
@.str.2 = [12 x i8] c"--terminate\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %0)
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %25
5: ; preds = %2, %23
%6 = phi i32 [ %24, %23 ], [ 0, %2 ]
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %6, i8* %9)
%11 = load i8*, i8** %8
%12 = tail call i64 @strlen(i8* dereferenceable(1) %11)
%13 = icmp eq i64 %12, 11
br i1 %13, label %14, label %20
14: ; preds = %5
%15 = tail call i64 @strncmp(i8* %11, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i64 11)
%16 = icmp ne i64 %15, 0
%17 = add nuw nsw i32 %6, 1
%18 = icmp slt i32 %17, %0
%19 = select i1 %16, i1 %18, i1 false
br i1 %19, label %23, label %25
20: ; preds = %5
%21 = add nuw nsw i32 %6, 1
%22 = icmp slt i32 %21, %0
br i1 %22, label %23, label %25
23: ; preds = %20, %14
%24 = phi i32 [ %21, %20 ], [ %17, %14 ]
br label %5
25: ; preds = %20, %14, %2
ret i32 0
}