#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*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ print_cow();
int /*<<< orphan*/ print_message(char *, int);
int /*<<< orphan*/ print_message_multilines(char *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main(int argc, char *argv[]) {
  int length = 0;
  char message[1000] = {0};
  if (argc >= 2) {
    if ((length = strlen(argv[1])) < 42) {
      print_message(argv[1], length);
    } else {
      print_message_multilines(argv[1], length);
    }
  } else {
    printf("Entrez le message que vous voulez afficher : \n");
    scanf("%[^\n]s", message);
    if (strlen(message) > 255) {
      printf("Usage: 255 character limit\n");
      exit(EXIT_FAILURE);
    }
    printf("\n\n");
    if ((length = strlen(message)) < 42) {
      print_message(message, length);
    } else {
      print_message_multilines(message, length);
    }
  }
  print_cow();
  printf("\n");
  exit(EXIT_SUCCESS);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0x400(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1080 <memset@plt>
cmpl   $0x2,-0x8(%rbp)
jl     1200 <main+0x80>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x2a,%eax
jge    11eb <main+0x6b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x14(%rbp),%esi
call   1050 <print_message@plt>
jmp    11fb <main+0x7b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x14(%rbp),%esi
call   1070 <print_message_multilines@plt>
jmp    129c <main+0x11c>
lea    0xdf9(%rip),%rdi
call   1060 <printf@plt>
lea    -0x400(%rbp),%rsi
lea    0xe15(%rip),%rdi
call   1090 <scanf@plt>
lea    -0x400(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0xff,%eax
jle    1250 <main+0xd0>
lea    0xdf9(%rip),%rdi
call   1060 <printf@plt>
mov    0x2d97(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
lea    0xdfb(%rip),%rdi
call   1060 <printf@plt>
lea    -0x400(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x2a,%eax
jge    1288 <main+0x108>
lea    -0x400(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <print_message@plt>
jmp    1297 <main+0x117>
lea    -0x400(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1070 <print_message_multilines@plt>
jmp    129c <main+0x11c>
mov    $0x0,%al
call   1030 <print_cow@plt>
lea    0xda9(%rip),%rdi
call   1060 <printf@plt>
mov    0x2d22(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x3e8,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsp,%rdi
mov    $0x3e8,%edx
xor    %esi,%esi
call   1090 <memset@plt>
cmp    $0x2,%ebp
jl     11c1 <main+0x31>
mov    0x8(%rbx),%rdi
call   1060 <strlen@plt>
mov    0x8(%rbx),%rdi
jmp    121f <main+0x8f>
lea    0xe3f(%rip),%rdi
call   1040 <puts@plt>
lea    0xe2c(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   10a0 <scanf@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
cmp    $0x100,%eax
jl     1208 <main+0x78>
lea    0xe42(%rip),%rdi
call   1040 <puts@plt>
mov    0x2ddf(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
lea    0xe26(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rdi
call   1060 <strlen@plt>
mov    %rsp,%rdi
mov    %eax,%esi
cmp    $0x29,%eax
jg     122d <main+0x9d>
call   1070 <print_message@plt>
jmp    1232 <main+0xa2>
call   1080 <print_message_multilines@plt>
xor    %eax,%eax
call   1050 <print_cow@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2d8e(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [47 x i8] c"Entrez le message que vous voulez afficher : \0A\00"
@.str.1 = [7 x i8] c"%[^\0A]s\00"
@.str.2 = [28 x i8] c"Usage: 255 character limit\0A\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [3 x i8] c"\0A\0A\00"
@.str.4 = [2 x i8] c"\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [1000 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%8 = bitcast [1000 x i8]* %7 to i8*
%9 = load i32, i32* %4
%10 = icmp sge i32 %9, 2
br i1 %10, label %11, label %30
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @strlen(i8* %14)
store i32 %15, i32* %6
%16 = icmp slt i32 %15, 42
br i1 %16, label %17, label %23
17: ; preds = %11
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = load i32, i32* %6
%22 = call i32 @print_message(i8* %20, i32 %21)
br label %29
23: ; preds = %11
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = load i32, i32* %6
%28 = call i32 @print_message_multilines(i8* %26, i32 %27)
br label %29
29: ; preds = %23, %17
br label %55
30: ; preds = %2
%31 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%32 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
%33 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %32)
%34 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
%35 = call i32 @strlen(i8* %34)
%36 = icmp sgt i32 %35, 255
br i1 %36, label %37, label %41
37: ; preds = %30
%38 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%39 = load i32, i32* @EXIT_FAILURE
%40 = call i32 @exit(i32 %39)
unreachable
41: ; preds = %30
%42 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%43 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
%44 = call i32 @strlen(i8* %43)
store i32 %44, i32* %6
%45 = icmp slt i32 %44, 42
br i1 %45, label %46, label %50
46: ; preds = %41
%47 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
%48 = load i32, i32* %6
%49 = call i32 @print_message(i8* %47, i32 %48)
br label %54
50: ; preds = %41
%51 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
%52 = load i32, i32* %6
%53 = call i32 @print_message_multilines(i8* %51, i32 %52)
br label %54
54: ; preds = %50, %46
br label %55
55: ; preds = %54, %29
%56 = call i32 (...) @print_cow()
%57 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%58 = load i32, i32* @EXIT_SUCCESS
%59 = call i32 @exit(i32 %58)
unreachable
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"%[^\0A]s\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
@str = [46 x i8] c"Entrez le message que vous voulez afficher : \00"
@str.5 = [2 x i8] c"\0A\00"
@str.6 = [27 x i8] c"Usage: 255 character limit\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1000 x i8]
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %16
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @strlen(i8* %8)
%10 = icmp slt i32 %9, 42
%11 = load i8*, i8** %7
br i1 %10, label %12, label %14
12: ; preds = %6
%13 = tail call i32 @print_message(i8* %11, i32 %9)
br label %33
14: ; preds = %6
%15 = tail call i32 @print_message_multilines(i8* %11, i32 %9)
br label %33
16: ; preds = %2
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%19 = call i32 @strlen(i8* %4)
%20 = icmp sgt i32 %19, 255
br i1 %20, label %21, label %25
21: ; preds = %16
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.6, i64 0, i64 0))
%23 = load i32, i32* @EXIT_FAILURE
%24 = call i32 @exit(i32 %23)
unreachable
25: ; preds = %16
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.5, i64 0, i64 0))
%27 = call i32 @strlen(i8* %4)
%28 = icmp slt i32 %27, 42
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = call i32 @print_message(i8* %4, i32 %27)
br label %33
31: ; preds = %25
%32 = call i32 @print_message_multilines(i8* %4, i32 %27)
br label %33
33: ; preds = %29, %31, %12, %14
%34 = call i32 (...) @print_cow()
%35 = call i32 @putchar(i32 10)
%36 = load i32, i32* @EXIT_SUCCESS
%37 = call i32 @exit(i32 %36)
unreachable
}