#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*/);
int my_getnbr(char *);
int /*<<< orphan*/ my_putstr(char *);
int remove_alums(unsigned char *, int, int, int);
int user(unsigned char *rows, int size) {
  char *readed;
  int line;
  int alums;
  int state;
  state = 1;
  while (state != 0) {
    my_putstr("Selection of the line: ");
    if ((readed = get_next_line(0)) == NULL)
      return (1);
    line = my_getnbr(readed);
    my_putstr("Number of alumettes in line ");
    my_putstr(readed);
    my_putstr(": ");
    free(readed);
    if ((readed = get_next_line(0)) == NULL)
      return (1);
    alums = my_getnbr(readed);
    free(readed);
    state = remove_alums(rows, line, alums, size);
  }
  return (0);
}


x86 assembly (clang, -O0):
<user>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x1,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     1223 <user+0xd3>
lea    0xe89(%rip),%rdi
call   1060 <my_putstr@plt>
xor    %edi,%edi
call   1070 <get_next_line@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    119d <user+0x4d>
movl   $0x1,-0x4(%rbp)
jmp    122a <user+0xda>
mov    -0x20(%rbp),%rdi
call   1040 <my_getnbr@plt>
mov    %eax,-0x24(%rbp)
lea    0xe68(%rip),%rdi
call   1060 <my_putstr@plt>
mov    -0x20(%rbp),%rdi
call   1060 <my_putstr@plt>
lea    0xe50(%rip),%rdi
call   1060 <my_putstr@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %edi,%edi
call   1070 <get_next_line@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    11f4 <user+0xa4>
movl   $0x1,-0x4(%rbp)
jmp    122a <user+0xda>
mov    -0x20(%rbp),%rdi
call   1040 <my_getnbr@plt>
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1050 <remove_alums@plt>
mov    %eax,-0x2c(%rbp)
jmp    1166 <user+0x16>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<user>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r13d
mov    %rdi,%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xe89(%rip),%rdi
call   1060 <my_putstr@plt>
xor    %edi,%edi
call   1070 <get_next_line@plt>
mov    $0x1,%ebp
test   %rax,%rax
je     11fe <user+0xae>
mov    %rax,%r14
mov    %rax,%rdi
call   1040 <my_getnbr@plt>
mov    %eax,%r15d
lea    0xe76(%rip),%rdi
call   1060 <my_putstr@plt>
mov    %r14,%rdi
call   1060 <my_putstr@plt>
lea    0xe5f(%rip),%rdi
call   1060 <my_putstr@plt>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %edi,%edi
call   1070 <get_next_line@plt>
test   %rax,%rax
je     11fe <user+0xae>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <my_getnbr@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
mov    %r13d,%ecx
call   1050 <remove_alums@plt>
test   %eax,%eax
jne    1170 <user+0x20>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Selection of the line: \00"
@.str.1 = [29 x i8] c"Number of alumettes in line \00"
@.str.2 = [3 x i8] c": \00"
define i32 @user(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 1, i32* %9
br label %10
10: ; preds = %30, %2
%11 = load i32, i32* %9
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %40
13: ; preds = %10
%14 = call i32 @my_putstr(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%15 = call i8* @get_next_line(i32 0)
store i8* %15, i8** %6
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 1, i32* %3
br label %41
18: ; preds = %13
%19 = load i8*, i8** %6
%20 = call i32 @my_getnbr(i8* %19)
store i32 %20, i32* %7
%21 = call i32 @my_putstr(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%22 = load i8*, i8** %6
%23 = call i32 @my_putstr(i8* %22)
%24 = call i32 @my_putstr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%25 = load i8*, i8** %6
%26 = call i32 @free(i8* %25)
%27 = call i8* @get_next_line(i32 0)
store i8* %27, i8** %6
%28 = icmp eq i8* %27, null
br i1 %28, label %29, label %30
29: ; preds = %18
store i32 1, i32* %3
br label %41
30: ; preds = %18
%31 = load i8*, i8** %6
%32 = call i32 @my_getnbr(i8* %31)
store i32 %32, i32* %8
%33 = load i8*, i8** %6
%34 = call i32 @free(i8* %33)
%35 = load i8*, i8** %4
%36 = load i32, i32* %7
%37 = load i32, i32* %8
%38 = load i32, i32* %5
%39 = call i32 @remove_alums(i8* %35, i32 %36, i32 %37, i32 %38)
store i32 %39, i32* %9
br label %10
40: ; preds = %10
store i32 0, i32* %3
br label %41
41: ; preds = %40, %29, %17
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
@.str = [24 x i8] c"Selection of the line: \00"
@.str.1 = [29 x i8] c"Number of alumettes in line \00"
@.str.2 = [3 x i8] c": \00"
define i32 @user(i8* %0, i32 %1) {
br label %3
3: ; preds = %2, %15
%4 = tail call i32 @my_putstr(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%5 = tail call i8* @get_next_line(i32 0)
%6 = icmp eq i8* %5, null
br i1 %6, label %20, label %7
7: ; preds = %3
%8 = tail call i32 @my_getnbr(i8* %5)
%9 = tail call i32 @my_putstr(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 @my_putstr(i8* %5)
%11 = tail call i32 @my_putstr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%12 = tail call i32 @free(i8* %5)
%13 = tail call i8* @get_next_line(i32 0)
%14 = icmp eq i8* %13, null
br i1 %14, label %20, label %15
15: ; preds = %7
%16 = tail call i32 @my_getnbr(i8* %13)
%17 = tail call i32 @free(i8* %13)
%18 = tail call i32 @remove_alums(i8* %0, i32 %8, i32 %16, i32 %1)
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %3
20: ; preds = %15, %7, %3
%21 = phi i32 [ 1, %3 ], [ 1, %7 ], [ 0, %15 ]
ret i32 %21
}