#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*/ free(char *);
char *get_next_line(int /*<<< orphan*/);
char *malloc(int);
int /*<<< orphan*/ my_putstr(char *);
int my_strlen(char *);
scalar_t__ my_strncmp(char *, char *);
char **boucle(char **tab3, char **s2) {
  char *str;
  int i;
  i = 0;
  while (42) {
    my_putstr(" > ");
    if ((str = get_next_line(0)) == NULL)
      return (NULL);
    if ((tab3[i] = malloc(sizeof(char) * my_strlen(str))) == NULL)
      return (0);
    tab3[i] = str;
    if (my_strncmp(s2[0], str) == 0)
      break;
    if (i + 1 == 30)
      break;
    i++;
  }
  tab3[i] = NULL;
  free(str);
  return (tab3);
}


x86 assembly (clang, -O0):
<boucle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
lea    0xe82(%rip),%rdi
call   1060 <my_putstr@plt>
xor    %edi,%edi
call   1080 <get_next_line@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    11a5 <boucle+0x45>
movq   $0x0,-0x8(%rbp)
jmp    1250 <boucle+0xf0>
mov    -0x20(%rbp),%rdi
call   1030 <my_strlen@plt>
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    -0x10(%rbp),%rcx
movslq -0x24(%rbp),%rdx
mov    %rax,(%rcx,%rdx,8)
cmp    $0x0,%rax
jne    11de <boucle+0x7e>
movq   $0x0,-0x8(%rbp)
jmp    1250 <boucle+0xf0>
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <my_strncmp@plt>
cmp    $0x0,%rax
jne    120d <boucle+0xad>
jmp    122f <boucle+0xcf>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
cmp    $0x1e,%eax
jne    1221 <boucle+0xc1>
jmp    122f <boucle+0xcf>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1177 <boucle+0x17>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rdi
call   1040 <free@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<boucle>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r12
xor    %r13d,%r13d
lea    0xe87(%rip),%r15
nopl   0x0(%rax)
mov    %r15,%rdi
call   1060 <my_putstr@plt>
xor    %edi,%edi
call   1080 <get_next_line@plt>
test   %rax,%rax
je     11e3 <boucle+0x83>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <my_strlen@plt>
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,(%r12,%r13,8)
test   %rax,%rax
je     11e3 <boucle+0x83>
mov    %rbx,(%r12,%r13,8)
mov    (%r14),%rdi
mov    %rbx,%rsi
call   1050 <my_strncmp@plt>
lea    0x1(%r13),%rcx
test   %rax,%rax
je     11d0 <boucle+0x70>
cmp    $0x1d,%r13
mov    %rcx,%r13
jne    1180 <boucle+0x20>
movq   $0x0,-0x8(%r12,%rcx,8)
mov    %rbx,%rdi
call   1040 <free@plt>
jmp    11e6 <boucle+0x86>
xor    %r12d,%r12d
mov    %r12,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c" > \00"
define i8** @boucle(i8** %0, i8** %1) {
%3 = alloca i8**
%4 = alloca i8**
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i8** %0, i8*** %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %8
8: ; preds = %2, %44
%9 = call i32 @my_putstr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%10 = call i8* @get_next_line(i32 0)
store i8* %10, i8** %6
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %13
12: ; preds = %8
store i8** null, i8*** %3
br label %55
13: ; preds = %8
%14 = load i8*, i8** %6
%15 = call i32 @my_strlen(i8* %14)
%16 = sext i32 %15 to i64
%17 = mul i64 1, %16
%18 = trunc i64 %17 to i32
%19 = call i8* @malloc(i32 %18)
%20 = load i8**, i8*** %4
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %20, i64 %22
store i8* %19, i8** %23
%24 = icmp eq i8* %19, null
br i1 %24, label %25, label %26
25: ; preds = %13
store i8** null, i8*** %3
br label %55
26: ; preds = %13
%27 = load i8*, i8** %6
%28 = load i8**, i8*** %4
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
store i8* %27, i8** %31
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 0
%34 = load i8*, i8** %33
%35 = load i8*, i8** %6
%36 = call i64 @my_strncmp(i8* %34, i8* %35)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %26
br label %47
39: ; preds = %26
%40 = load i32, i32* %7
%41 = add nsw i32 %40, 1
%42 = icmp eq i32 %41, 30
br i1 %42, label %43, label %44
43: ; preds = %39
br label %47
44: ; preds = %39
%45 = load i32, i32* %7
%46 = add nsw i32 %45, 1
store i32 %46, i32* %7
br label %8
47: ; preds = %43, %38
%48 = load i8**, i8*** %4
%49 = load i32, i32* %7
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8*, i8** %48, i64 %50
store i8* null, i8** %51
%52 = load i8*, i8** %6
%53 = call i32 @free(i8* %52)
%54 = load i8**, i8*** %4
store i8** %54, i8*** %3
br label %55
55: ; preds = %47, %25, %12
%56 = load i8**, i8*** %3
ret i8** %56
}

LLVM IR (-O2):
@.str = [4 x i8] c" > \00"
define i8** @boucle(i8** writeonly %0, i8** nocapture %1) {
br label %3
3: ; preds = %13, %2
%4 = phi i64 [ %17, %13 ], [ 0, %2 ]
%5 = tail call i32 @my_putstr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%6 = tail call i8* @get_next_line(i32 0)
%7 = icmp eq i8* %6, null
br i1 %7, label %22, label %8
8: ; preds = %3
%9 = tail call i32 @my_strlen(i8* %6)
%10 = tail call i8* @malloc(i32 %9)
%11 = getelementptr inbounds i8*, i8** %0, i64 %4
store i8* %10, i8** %11
%12 = icmp eq i8* %10, null
br i1 %12, label %22, label %13
13: ; preds = %8
store i8* %6, i8** %11
%14 = load i8*, i8** %1
%15 = tail call i64 @my_strncmp(i8* %14, i8* %6)
%16 = icmp eq i64 %15, 0
%17 = add nuw nsw i64 %4, 1
%18 = icmp eq i64 %17, 30
%19 = select i1 %16, i1 true, i1 %18
br i1 %19, label %20, label %3
20: ; preds = %13
store i8* null, i8** %11
%21 = tail call i32 @free(i8* %6)
br label %22
22: ; preds = %8, %3, %20
%23 = phi i8** [ %0, %20 ], [ null, %3 ], [ null, %8 ]
ret i8** %23
}