#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 */
void *fctByName(char *);
int /*<<< orphan*/ free(void *);
void *malloc(scalar_t__);
int /*<<< orphan*/ messErr(int);
scalar_t__ noErr();
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ stopErr(char *, char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ traiteLigne(char *);
void *makeFunction(char *f) {
  void *M;
  if ((M = malloc(strlen(f) + 8)) == NULL)
    stopErr("makeFunction", "malloc");
  sprintf((char *)M, ": _f %s ;", f);
  traiteLigne((char *)M);
  free(M);
  if (noErr() == 0) {
    M = fctByName("_f");
    return M;
  }
  messErr(48);
  return ((void *)NULL);
}


x86 assembly (clang, -O0):
<makeFunction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <strlen@plt>
mov    %rax,%rdi
add    $0x8,%rdi
call   1080 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11d2 <makeFunction+0x42>
lea    0xe3a(%rip),%rdi
lea    0xe40(%rip),%rsi
call   1050 <stopErr@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe33(%rip),%rsi
call   10b0 <sprintf@plt>
mov    -0x18(%rbp),%rdi
call   1090 <traiteLigne@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   10a0 <noErr@plt>
cmp    $0x0,%rax
jne    1226 <makeFunction+0x96>
lea    0xe0e(%rip),%rdi
call   1070 <fctByName@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1238 <makeFunction+0xa8>
mov    $0x30,%edi
call   1040 <messErr@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeFunction>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1060 <strlen@plt>
lea    0x8(%rax),%rdi
call   1080 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    11c0 <makeFunction+0x30>
lea    0xe4c(%rip),%rdi
lea    0xe52(%rip),%rsi
call   1050 <stopErr@plt>
lea    0xe4d(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   10b0 <sprintf@plt>
mov    %rbx,%rdi
call   1090 <traiteLigne@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   10a0 <noErr@plt>
test   %rax,%rax
je     1202 <makeFunction+0x72>
mov    $0x30,%edi
call   1040 <messErr@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe15(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1070 <fctByName@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"makeFunction\00"
@.str.1 = [7 x i8] c"malloc\00"
@.str.2 = [10 x i8] c": _f %s ;\00"
@.str.3 = [3 x i8] c"_f\00"
define i8* @makeFunction(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @strlen(i8* %5)
%7 = add nsw i64 %6, 8
%8 = call i8* @malloc(i64 %7)
store i8* %8, i8** %4
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 @stopErr(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %1
%13 = load i8*, i8** %4
%14 = load i8*, i8** %3
%15 = call i32 @sprintf(i8* %13, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %14)
%16 = load i8*, i8** %4
%17 = call i32 @traiteLigne(i8* %16)
%18 = load i8*, i8** %4
%19 = call i32 @free(i8* %18)
%20 = call i64 (...) @noErr()
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %12
%23 = call i8* @fctByName(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i8* %23, i8** %4
%24 = load i8*, i8** %4
store i8* %24, i8** %2
br label %27
25: ; preds = %12
%26 = call i32 @messErr(i32 48)
store i8* null, i8** %2
br label %27
27: ; preds = %25, %22
%28 = load i8*, i8** %2
ret i8* %28
}

LLVM IR (-O2):
@.str = [13 x i8] c"makeFunction\00"
@.str.1 = [7 x i8] c"malloc\00"
@.str.2 = [10 x i8] c": _f %s ;\00"
@.str.3 = [3 x i8] c"_f\00"
define i8* @makeFunction(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 8
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @stopErr(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = tail call i32 @sprintf(i8* dereferenceable(1) %4, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%10 = tail call i32 @traiteLigne(i8* %4)
%11 = tail call i32 @free(i8* %4)
%12 = tail call i64 (...) @noErr()
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %8
%15 = tail call i8* @fctByName(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %18
16: ; preds = %8
%17 = tail call i32 @messErr(i32 48)
br label %18
18: ; preds = %16, %14
%19 = phi i8* [ %15, %14 ], [ null, %16 ]
ret i8* %19
}