#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*/ padding(int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char const *, char const *);
int strlen(char const *);
void unit_test_str(const char *msg, const char *attendu, const char *obtenu) {
  int len = strlen(msg);
  printf("%s", msg);
  if (strcmp(attendu, obtenu) == 0) {
    padding(80 - len - 4);
    printf("[OK]\n");
  } else {
    padding(80 - len - 7);
    printf("[ERROR]\n");
    printf("Attendu : %s, Obtenu : %s\n", attendu, obtenu);
  }
}


x86 assembly (clang, -O0):
<unit_test_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11ac <unit_test_str+0x6c>
mov    $0x50,%edi
sub    -0x1c(%rbp),%edi
sub    $0x4,%edi
call   1060 <padding@plt>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11e0 <unit_test_str+0xa0>
mov    $0x50,%edi
sub    -0x1c(%rbp),%edi
sub    $0x7,%edi
call   1060 <padding@plt>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unit_test_str>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %eax,%ebp
lea    0xe92(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11be <unit_test_str+0x6e>
mov    $0x49,%edi
sub    %ebp,%edi
call   1070 <padding@plt>
lea    0xe83(%rip),%rdi
call   1030 <puts@plt>
lea    0xe5c(%rip),%rdi
mov    %r15,%rsi
mov    %r14,%rdx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <printf@plt>
mov    $0x4c,%edi
sub    %ebp,%edi
call   1070 <padding@plt>
lea    0xe55(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [6 x i8] c"[OK]\0A\00"
@.str.2 = [9 x i8] c"[ERROR]\0A\00"
@.str.3 = [27 x i8] c"Attendu : %s, Obtenu : %s\0A\00"
define void @unit_test_str(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %4
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %7
%10 = load i8*, i8** %4
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i8*, i8** %5
%13 = load i8*, i8** %6
%14 = call i64 @strcmp(i8* %12, i8* %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %22
16: ; preds = %3
%17 = load i32, i32* %7
%18 = sub nsw i32 80, %17
%19 = sub nsw i32 %18, 4
%20 = call i32 @padding(i32 %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %31
22: ; preds = %3
%23 = load i32, i32* %7
%24 = sub nsw i32 80, %23
%25 = sub nsw i32 %24, 7
%26 = call i32 @padding(i32 %25)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%28 = load i8*, i8** %5
%29 = load i8*, i8** %6
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %28, i8* %29)
br label %31
31: ; preds = %22, %16
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.3 = [27 x i8] c"Attendu : %s, Obtenu : %s\0A\00"
@str = [8 x i8] c"[ERROR]\00"
@str.4 = [5 x i8] c"[OK]\00"
define void @unit_test_str(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = tail call i64 @strcmp(i8* %1, i8* %2)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %3
%9 = sub i32 76, %4
%10 = tail call i32 @padding(i32 %9)
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.4, i64 0, i64 0))
br label %17
12: ; preds = %3
%13 = sub i32 73, %4
%14 = tail call i32 @padding(i32 %13)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %1, i8* %2)
br label %17
17: ; preds = %12, %8
ret void
}