xunge/DecIR huggingface dataset:
/* Variables and functions */
int mutex_imanager_req();
int d2mce_set_mutex_manager() { return mutex_imanager_req(); }


x86 assembly (clang, -O0):
<d2mce_set_mutex_manager>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <mutex_imanager_req@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<d2mce_set_mutex_manager>:
xor    %eax,%eax
jmp    1030 <mutex_imanager_req@plt>

LLVM IR (-O0):
define i32 @d2mce_set_mutex_manager() {
%1 = call i32 (...) @mutex_imanager_req()
ret i32 %1
}

LLVM IR (-O2):
define i32 @d2mce_set_mutex_manager() {
%1 = tail call i32 (...) @mutex_imanager_req()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ read(int, char *, int);
char *basic_read(int SD) {
  static char answer[1024];
  memset(answer, 0, 1024);
  if (0)
    printf("Going for read!\n");
  read(SD, answer, 1024);
  if (0)
    printf("Read returned: %s\n", answer);
  return answer;
}


x86 assembly (clang, -O0):
<basic_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0x2f0e(%rip),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1030 <memset@plt>
mov    -0x4(%rbp),%edi
lea    0x2ef8(%rip),%rsi
mov    $0x400,%edx
call   1040 <read@plt>
lea    0x2ee7(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<basic_read>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0x2f13(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1030 <memset@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x400,%edx
call   1040 <read@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@basic_read.answer = internal global [1024 x i8] zeroinitializer
define i8* @basic_read(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @memset(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @basic_read.answer, i64 0, i64 0), i32 0, i32 1024)
%4 = load i32, i32* %2
%5 = call i32 @read(i32 %4, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @basic_read.answer, i64 0, i64 0), i32 1024)
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @basic_read.answer, i64 0, i64 0)
}

LLVM IR (-O2):
@basic_read.answer = internal global [1024 x i8] zeroinitializer
define i8* @basic_read(i32 %0) {
%2 = tail call i32 @memset(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @basic_read.answer, i64 0, i64 0), i32 0, i32 1024)
%3 = tail call i32 @read(i32 %0, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @basic_read.answer, i64 0, i64 0), i32 1024)
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @basic_read.answer, i64 0, i64 0)
}
void pullUpDnControlDummy(struct wiringPiNodeStruct *node, int pin, int pud) {
  return;
}


x86 assembly (clang, -O0):
<pullUpDnControlDummy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<pullUpDnControlDummy>:
ret

LLVM IR (-O0):
%struct.wiringPiNodeStruct = type opaque
define void @pullUpDnControlDummy(%struct.wiringPiNodeStruct* %0, i32 %1, i32 %2) {
%4 = alloca %struct.wiringPiNodeStruct*
%5 = alloca i32
%6 = alloca i32
store %struct.wiringPiNodeStruct* %0, %struct.wiringPiNodeStruct** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret void
}

LLVM IR (-O2):
%struct.wiringPiNodeStruct = type opaque
define void @pullUpDnControlDummy(%struct.wiringPiNodeStruct* nocapture %0, i32 %1, i32 %2) {
ret void
}
int _ADStranslateRdError(int rc, int nErr) {
  switch (rc) {
  case 0:
    return 0x1a;
  case -1:
    return 0x15;
  case -2:
    return 0x50a;
  case -3:
  case -4:
    return 0x1;
  }
  return (0);
}


x86 assembly (clang, -O0):
<_ADStranslateRdError>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x4,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x4,%eax
ja     1163 <_ADStranslateRdError+0x63>
mov    -0x18(%rbp),%rax
lea    0xed6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1a,-0x4(%rbp)
jmp    116a <_ADStranslateRdError+0x6a>
movl   $0x15,-0x4(%rbp)
jmp    116a <_ADStranslateRdError+0x6a>
movl   $0x50a,-0x4(%rbp)
jmp    116a <_ADStranslateRdError+0x6a>
movl   $0x1,-0x4(%rbp)
jmp    116a <_ADStranslateRdError+0x6a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ADStranslateRdError>:
add    $0x4,%edi
xor    %eax,%eax
cmp    $0x4,%edi
ja     1117 <_ADStranslateRdError+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @_ADStranslateRdError(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
switch i32 %6, label %11 [
i32 0, label %7
i32 -1, label %8
i32 -2, label %9
i32 -3, label %10
i32 -4, label %10
]
7: ; preds = %2
store i32 26, i32* %3
br label %12
8: ; preds = %2
store i32 21, i32* %3
br label %12
9: ; preds = %2
store i32 1290, i32* %3
br label %12
10: ; preds = %2, %2
store i32 1, i32* %3
br label %12
11: ; preds = %2
store i32 0, i32* %3
br label %12
12: ; preds = %11, %10, %9, %8, %7
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
@switch.table._ADStranslateRdError = [5 x i32] [i32 1, i32 1, i32 1290, i32 21, i32 26]
define i32 @_ADStranslateRdError(i32 %0, i32 %1) {
%3 = add i32 %0, 4
%4 = icmp ult i32 %3, 5
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds [5 x i32], [5 x i32]* @switch.table._ADStranslateRdError, i64 0, i64 %6
%8 = load i32, i32* %7
br label %9
9: ; preds = %2, %5
%10 = phi i32 [ %8, %5 ], [ 0, %2 ]
ret i32 %10
}
void StackClose(long int *stack) {}


x86 assembly (clang, -O0):
<StackClose>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<StackClose>:
ret

LLVM IR (-O0):
define void @StackClose(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
ret void
}

LLVM IR (-O2):
define void @StackClose(i64* nocapture %0) {
ret void
}
int supports_eci(const int symbology) {
  int result = 0;
  switch (symbology) {
  case 92:
  case 71:
  case 57:
  case 84:
  case 55:
  case 56:
  case 58:
  case 115:
  case 142:
  case 116:
  case 144:
    result = 1;
    break;
  }
  return result;
}


x86 assembly (clang, -O0):
<supports_eci>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffc9,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x59,%eax
ja     113e <supports_eci+0x3e>
mov    -0x10(%rbp),%rax
lea    0xed2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<supports_eci>:
xor    %eax,%eax
add    $0xffffffc9,%edi
cmp    $0x59,%edi
ja     111f <supports_eci+0x1f>
lea    0xeef(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @supports_eci(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
switch i32 %4, label %6 [
i32 92, label %5
i32 71, label %5
i32 57, label %5
i32 84, label %5
i32 55, label %5
i32 56, label %5
i32 58, label %5
i32 115, label %5
i32 142, label %5
i32 116, label %5
i32 144, label %5
]
5: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1
store i32 1, i32* %3
br label %6
6: ; preds = %1, %5
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
define i32 @supports_eci(i32 %0) {
switch i32 %0, label %3 [
i32 92, label %2
i32 71, label %2
i32 57, label %2
i32 84, label %2
i32 55, label %2
i32 56, label %2
i32 58, label %2
i32 115, label %2
i32 142, label %2
i32 116, label %2
i32 144, label %2
]
2: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1
br label %3
3: ; preds = %1, %2
%4 = phi i32 [ 0, %1 ], [ 1, %2 ]
ret i32 %4
}
void SWimp_EndFrame(void) {}


x86 assembly (clang, -O0):
<SWimp_EndFrame>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SWimp_EndFrame>:
ret

LLVM IR (-O0):
define void @SWimp_EndFrame() {
ret void
}

LLVM IR (-O2):
define void @SWimp_EndFrame() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int line_length(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int characters_after_cursor(WINDOW *window, int y, int x) {
  int distance = line_length(window, y, 0) - x;
  if (distance < 0) {
    return 0;
  }
  return distance;
}


x86 assembly (clang, -O0):
<characters_after_cursor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
xor    %edx,%edx
call   1030 <line_length@plt>
sub    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    114c <characters_after_cursor+0x3c>
movl   $0x0,-0x4(%rbp)
jmp    1152 <characters_after_cursor+0x42>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<characters_after_cursor>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebx
xor    %ebp,%ebp
xor    %edx,%edx
call   1030 <line_length@plt>
sub    %ebx,%eax
cmovs  %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @characters_after_cursor(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%9 = load i32*, i32** %5
%10 = load i32, i32* %6
%11 = call i32 @line_length(i32* %9, i32 %10, i32 0)
%12 = load i32, i32* %7
%13 = sub nsw i32 %11, %12
store i32 %13, i32* %8
%14 = load i32, i32* %8
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %3
store i32 0, i32* %4
br label %19
17: ; preds = %3
%18 = load i32, i32* %8
store i32 %18, i32* %4
br label %19
19: ; preds = %17, %16
%20 = load i32, i32* %4
ret i32 %20
}

LLVM IR (-O2):
define i32 @characters_after_cursor(i32* %0, i32 %1, i32 %2) {
%4 = tail call i32 @line_length(i32* %0, i32 %1, i32 0)
%5 = sub nsw i32 %4, %2
%6 = icmp sgt i32 %5, 0
%7 = select i1 %6, i32 %5, i32 0
ret i32 %7
}
/* Variables and functions */
int encryptString(char *);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char string[100];
  char character = ' ';
  int flag = 0;
  gets(string);
  flag = encryptString(string);
  printf("%s\n", string);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x20,-0x71(%rbp)
movl   $0x0,-0x78(%rbp)
lea    -0x70(%rbp),%rdi
call   1040 <gets@plt>
lea    -0x70(%rbp),%rdi
call   1050 <encryptString@plt>
mov    %eax,-0x78(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <gets@plt>
mov    %rbx,%rdi
call   1050 <encryptString@plt>
lea    0xeb1(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i8
%4 = alloca i32
store i32 0, i32* %1
store i8 32, i8* %3
store i32 0, i32* %4
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = call i32 @gets(i8* %5)
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%8 = call i32 @encryptString(i8* %7)
store i32 %8, i32* %4
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @gets(i8* %2)
%4 = call i32 @encryptString(i8* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int eventfd(int /*<<< orphan*/, int /*<<< orphan*/);
int main() {
  int fd = eventfd(0, 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %esi,%esi
mov    %esi,%edi
call   1030 <eventfd@plt>
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
call   1030 <eventfd@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @eventfd(i32 0, i32 0)
store i32 %3, i32* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @eventfd(i32 0, i32 0)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ mpz_t;

/* Variables and functions */
int /*<<< orphan*/ mpz8_set_int(int /*<<< orphan*/ *, int, int /*<<< orphan*/,
                                int /*<<< orphan*/, int /*<<< orphan*/,
                                int /*<<< orphan*/, int /*<<< orphan*/,
                                int /*<<< orphan*/, int);
void mpz8_set_mul(mpz_t z[8]) { mpz8_set_int(z, 1, 0, 0, 0, 0, 0, 0, 1); }


x86 assembly (clang, -O0):
<mpz8_set_mul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
xor    %r9d,%r9d
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x1,0x10(%rsp)
call   1030 <mpz8_set_int@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpz8_set_mul>:
push   %rax
sub    $0x8,%rsp
mov    $0x1,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x1
push   $0x0
push   $0x0
call   1030 <mpz8_set_int@plt>
add    $0x20,%rsp
pop    %rax
ret

LLVM IR (-O0):
define void @mpz8_set_mul(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @mpz8_set_int(i32* %3, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1)
ret void
}

LLVM IR (-O2):
define void @mpz8_set_mul(i32* %0) {
%2 = tail call i32 @mpz8_set_int(i32* %0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1)
ret void
}
/* Type definitions */
struct option {
  int dummy;
};

/* Variables and functions */
int _my_getopt_internal(int, char **, char const *, struct option const *,
                        int *, int);
int my_getopt_long_only(int argc, char *argv[], const char *shortopts,
                        const struct option *longopts, int *longind) {
  return _my_getopt_internal(argc, argv, shortopts, longopts, longind, 1);
}


x86 assembly (clang, -O0):
<my_getopt_long_only>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    $0x1,%r9d
call   1030 <_my_getopt_internal@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_getopt_long_only>:
mov    $0x1,%r9d
jmp    1030 <_my_getopt_internal@plt>

LLVM IR (-O0):
%struct.option = type { i32 }
define i32 @my_getopt_long_only(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca %struct.option*
%10 = alloca i32*
store i32 %0, i32* %6
store i8** %1, i8*** %7
store i8* %2, i8** %8
store %struct.option* %3, %struct.option** %9
store i32* %4, i32** %10
%11 = load i32, i32* %6
%12 = load i8**, i8*** %7
%13 = load i8*, i8** %8
%14 = load %struct.option*, %struct.option** %9
%15 = load i32*, i32** %10
%16 = call i32 @_my_getopt_internal(i32 %11, i8** %12, i8* %13, %struct.option* %14, i32* %15, i32 1)
ret i32 %16
}

LLVM IR (-O2):
%struct.option = type { i32 }
define i32 @my_getopt_long_only(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4) {
%6 = tail call i32 @_my_getopt_internal(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4, i32 1)
ret i32 %6
}
void func() {}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func>:
ret

LLVM IR (-O0):
define void @func() {
ret void
}

LLVM IR (-O2):
define void @func() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;
typedef int /*<<< orphan*/ pthread_cond_t;

/* Variables and functions */
int /*<<< orphan*/ pthread_cond_wait(int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *);
int /*<<< orphan*/ pthread_mutex_lock(int /*<<< orphan*/ *);
int /*<<< orphan*/ pthread_mutex_unlock(int /*<<< orphan*/ *);
void cond_wait(pthread_cond_t *cond, pthread_mutex_t *mut) {
  pthread_mutex_lock(mut);
  pthread_cond_wait(cond, mut);
  pthread_mutex_unlock(mut);
}


x86 assembly (clang, -O0):
<cond_wait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <pthread_mutex_lock@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <pthread_cond_wait@plt>
mov    -0x10(%rbp),%rdi
call   1040 <pthread_mutex_unlock@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cond_wait>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1050 <pthread_mutex_lock@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <pthread_cond_wait@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <pthread_mutex_unlock@plt>

LLVM IR (-O0):
define void @cond_wait(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %4
%6 = call i32 @pthread_mutex_lock(i32* %5)
%7 = load i32*, i32** %3
%8 = load i32*, i32** %4
%9 = call i32 @pthread_cond_wait(i32* %7, i32* %8)
%10 = load i32*, i32** %4
%11 = call i32 @pthread_mutex_unlock(i32* %10)
ret void
}

LLVM IR (-O2):
define void @cond_wait(i32* %0, i32* %1) {
%3 = tail call i32 @pthread_mutex_lock(i32* %1)
%4 = tail call i32 @pthread_cond_wait(i32* %0, i32* %1)
%5 = tail call i32 @pthread_mutex_unlock(i32* %1)
ret void
}
int tegra_gpu_enable_node(void *blob, const char *compat) { return 0; }


x86 assembly (clang, -O0):
<tegra_gpu_enable_node>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tegra_gpu_enable_node>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @tegra_gpu_enable_node(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret i32 0
}

LLVM IR (-O2):
define i32 @tegra_gpu_enable_node(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void tlb_miss_handler() {
  printf("TLB miss\n");
  exit(0);
}


x86 assembly (clang, -O0):
<tlb_miss_handler>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<tlb_miss_handler>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"TLB miss\0A\00"
define void @tlb_miss_handler() {
%1 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [9 x i8] c"TLB miss\00"
define void @tlb_miss_handler() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
int test_imm_A1int16_reg(short val) {
  return ((val) & (-0xA1 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_A1int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xffffff5f,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_A1int16_reg>:
test   $0xff5f,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_A1int16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, -161
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_A1int16_reg(i16 signext %0) {
%2 = and i16 %0, -161
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
char tolower(char);
void lowercase(char *string) {
  int n;
  n = 0;
  while ((string[n] = tolower(string[n])) != '\0')
    ++n;
}


x86 assembly (clang, -O0):
<lowercase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <tolower@plt>
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
mov    %al,(%rcx,%rdx,1)
movsbl %al,%eax
cmp    $0x0,%eax
je     1159 <lowercase+0x49>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <lowercase+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lowercase>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl (%rbx),%edi
call   1030 <tolower@plt>
mov    %al,(%rbx)
add    $0x1,%rbx
test   %al,%al
jne    1120 <lowercase+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @lowercase(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %17, %1
%5 = load i8*, i8** %2
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = load i8, i8* %8
%10 = call signext i8 @tolower(i8 signext %9)
%11 = load i8*, i8** %2
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
store i8 %10, i8* %14
%15 = sext i8 %10 to i32
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %4
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %4
20: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @lowercase(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %8, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = tail call signext i8 @tolower(i8 signext %5)
store i8 %6, i8* %4
%7 = icmp eq i8 %6, 0
%8 = add nuw i64 %3, 1
br i1 %7, label %9, label %2
9: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Reverse(int *, int, int);
void RightShift(int *array, int size, int shift) {
  shift = shift % size;
  Reverse(array, 0, size - shift - 1);
  Reverse(array, size - shift, size - 1);
  Reverse(array, 0, size - 1);
}


x86 assembly (clang, -O0):
<RightShift>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
sub    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1030 <Reverse@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
call   1030 <Reverse@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1030 <Reverse@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RightShift>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%eax
mov    %esi,%ebx
mov    %rdi,%r14
cltd
idiv   %esi
mov    %esi,%ebp
sub    %edx,%ebp
neg    %edx
add    %ebx,%edx
add    $0xffffffff,%edx
xor    %esi,%esi
call   1030 <Reverse@plt>
add    $0xffffffff,%ebx
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <Reverse@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    %ebx,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <Reverse@plt>

LLVM IR (-O0):
define void @RightShift(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = load i32, i32* %5
%9 = srem i32 %7, %8
store i32 %9, i32* %6
%10 = load i32*, i32** %4
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = sub nsw i32 %11, %12
%14 = sub nsw i32 %13, 1
%15 = call i32 @Reverse(i32* %10, i32 0, i32 %14)
%16 = load i32*, i32** %4
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = sub nsw i32 %17, %18
%20 = load i32, i32* %5
%21 = sub nsw i32 %20, 1
%22 = call i32 @Reverse(i32* %16, i32 %19, i32 %21)
%23 = load i32*, i32** %4
%24 = load i32, i32* %5
%25 = sub nsw i32 %24, 1
%26 = call i32 @Reverse(i32* %23, i32 0, i32 %25)
ret void
}

LLVM IR (-O2):
define void @RightShift(i32* %0, i32 %1, i32 %2) {
%4 = srem i32 %2, %1
%5 = sub nsw i32 %1, %4
%6 = add nsw i32 %5, -1
%7 = tail call i32 @Reverse(i32* %0, i32 0, i32 %6)
%8 = add nsw i32 %1, -1
%9 = tail call i32 @Reverse(i32* %0, i32 %5, i32 %8)
%10 = tail call i32 @Reverse(i32* %0, i32 0, i32 %8)
ret void
}
__attribute__((pure)) _Complex float foo_float(int x) {
  _Complex float r;
  __real r = x + 1;
  __imag r = x - 1;
  return r;
}


x86 assembly (clang, -O0):
<foo_float>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x18(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
movss  %xmm1,-0x8(%rbp)
movss  %xmm0,-0x4(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo_float>:
movd   %edi,%xmm0
pshufd $0x50,%xmm0,%xmm0
paddd  0xeef(%rip),%xmm0
cvtdq2ps %xmm0,%xmm0
ret

LLVM IR (-O0):
define <2 x float> @foo_float(i32 %0) {
%2 = alloca { float, float }
%3 = alloca i32
%4 = alloca { float, float }
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = add nsw i32 %5, 1
%7 = sitofp i32 %6 to float
%8 = getelementptr inbounds { float, float }, { float, float }* %4, i32 0, i32 0
store float %7, float* %8
%9 = load i32, i32* %3
%10 = sub nsw i32 %9, 1
%11 = sitofp i32 %10 to float
%12 = getelementptr inbounds { float, float }, { float, float }* %4, i32 0, i32 1
store float %11, float* %12
%13 = getelementptr inbounds { float, float }, { float, float }* %4, i32 0, i32 0
%14 = load float, float* %13
%15 = getelementptr inbounds { float, float }, { float, float }* %4, i32 0, i32 1
%16 = load float, float* %15
%17 = getelementptr inbounds { float, float }, { float, float }* %2, i32 0, i32 0
%18 = getelementptr inbounds { float, float }, { float, float }* %2, i32 0, i32 1
store float %14, float* %17
store float %16, float* %18
%19 = bitcast { float, float }* %2 to <2 x float>*
%20 = load <2 x float>, <2 x float>* %19
ret <2 x float> %20
}

LLVM IR (-O2):
define <2 x float> @foo_float(i32 %0) {
%2 = insertelement <2 x i32> poison, i32 %0, i64 0
%3 = shufflevector <2 x i32> %2, <2 x i32> poison, <2 x i32> zeroinitializer
%4 = add nsw <2 x i32> %3, <i32 1, i32 -1>
%5 = sitofp <2 x i32> %4 to <2 x float>
ret <2 x float> %5
}
/* Variables and functions */
int scanf(char *, char *);
int /*<<< orphan*/ skipspaces();
int read_char(void *dest) {
  skipspaces();
  if (scanf("%c", (char *)dest) == 1) {
    return 0;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<read_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <skipspaces@plt>
mov    -0x10(%rbp),%rsi
lea    0xec2(%rip),%rdi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    1158 <read_char+0x38>
movl   $0x0,-0x4(%rbp)
jmp    115f <read_char+0x3f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_char>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <skipspaces@plt>
lea    0xece(%rip),%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
setne  %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
define i32 @read_char(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = call i32 (...) @skipspaces()
%5 = load i8*, i8** %3
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %10
9: ; preds = %1
store i32 1, i32* %2
br label %10
10: ; preds = %9, %8
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define i32 @read_char(i8* %0) {
%2 = tail call i32 (...) @skipspaces()
%3 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = icmp ne i32 %3, 1
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int __VERIFIER_nondet_int();
int calculate_output(int);
int main() {
  int output = -1;
  while (1) {
    int input;
    input = __VERIFIER_nondet_int();
    if ((input != 2) && (input != 3) && (input != 4) && (input != 5) &&
        (input != 6))
      return -2;
    output = calculate_output(input);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
je     117d <main+0x5d>
cmpl   $0x3,-0xc(%rbp)
je     117d <main+0x5d>
cmpl   $0x4,-0xc(%rbp)
je     117d <main+0x5d>
cmpl   $0x5,-0xc(%rbp)
je     117d <main+0x5d>
cmpl   $0x6,-0xc(%rbp)
je     117d <main+0x5d>
mov    $0xfffffffe,%eax
add    $0x10,%rsp
pop    %rbp
ret
mov    -0xc(%rbp),%edi
call   1030 <calculate_output@plt>
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
lea    -0x2(%rax),%ecx
cmp    $0x4,%ecx
ja     1148 <main+0x28>
mov    %eax,%edi
call   1030 <calculate_output@plt>
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,%ecx
add    $0xfffffffe,%ecx
cmp    $0x5,%ecx
jb     1130 <main+0x10>
mov    $0xfffffffe,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 -1, i32* %2
br label %4
4: ; preds = %0, %21
%5 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %21
8: ; preds = %4
%9 = load i32, i32* %3
%10 = icmp ne i32 %9, 3
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = load i32, i32* %3
%13 = icmp ne i32 %12, 4
br i1 %13, label %14, label %21
14: ; preds = %11
%15 = load i32, i32* %3
%16 = icmp ne i32 %15, 5
br i1 %16, label %17, label %21
17: ; preds = %14
%18 = load i32, i32* %3
%19 = icmp ne i32 %18, 6
br i1 %19, label %20, label %21
20: ; preds = %17
ret i32 -2
21: ; preds = %17, %14, %11, %8, %4
%22 = load i32, i32* %3
%23 = call i32 @calculate_output(i32 %22)
store i32 %23, i32* %2
br label %4
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = add i32 %1, -2
%3 = icmp ult i32 %2, 5
br i1 %3, label %4, label %10
4: ; preds = %0, %4
%5 = phi i32 [ %7, %4 ], [ %1, %0 ]
%6 = tail call i32 @calculate_output(i32 %5)
%7 = tail call i32 (...) @__VERIFIER_nondet_int()
%8 = add i32 %7, -2
%9 = icmp ult i32 %8, 5
br i1 %9, label %4, label %10
10: ; preds = %4, %0
ret i32 -2
}
/* Variables and functions */
int /*<<< orphan*/ CopyFdToFd(int, int);
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int open(char *, int /*<<< orphan*/);
void *ThreadFn(void *arg) {
  (void)arg;
  int fd = open("/proc/self/maps", O_RDONLY);
  CopyFdToFd(fd, 2);
  close(fd);
  return NULL;
}


x86 assembly (clang, -O0):
<ThreadFn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ea5(%rip),%rax
mov    (%rax),%esi
lea    0xeb4(%rip),%rdi
call   1050 <open@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x2,%esi
call   1030 <CopyFdToFd@plt>
mov    -0xc(%rbp),%edi
call   1040 <close@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ThreadFn>:
push   %rbx
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
lea    0xebf(%rip),%rdi
call   1050 <open@plt>
mov    %eax,%ebx
mov    %eax,%edi
mov    $0x2,%esi
call   1030 <CopyFdToFd@plt>
mov    %ebx,%edi
call   1040 <close@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"/proc/self/maps\00"
@O_RDONLY = global i32 0
define i8* @ThreadFn(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i32, i32* @O_RDONLY
%6 = call i32 @open(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @CopyFdToFd(i32 %7, i32 2)
%9 = load i32, i32* %3
%10 = call i32 @close(i32 %9)
ret i8* null
}

LLVM IR (-O2):
@.str = [16 x i8] c"/proc/self/maps\00"
@O_RDONLY = global i32 0
define noalias i8* @ThreadFn(i8* nocapture readnone %0) {
%2 = load i32, i32* @O_RDONLY
%3 = tail call i32 @open(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 @CopyFdToFd(i32 %3, i32 2)
%5 = tail call i32 @close(i32 %3)
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int about() {
  puts("Simplex High Level Compiler (SHLC)"
       " [ "
       "v0.0.1"
       " ] by InternetBowser\n");
  return (1 << 1);
}


x86 assembly (clang, -O0):
<about>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<about>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [65 x i8] c"Simplex High Level Compiler (SHLC) [ v0.0.1 ] by InternetBowser\0A\00"
define i32 @about() {
%1 = call i32 @puts(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0))
ret i32 2
}

LLVM IR (-O2):
@.str = [65 x i8] c"Simplex High Level Compiler (SHLC) [ v0.0.1 ] by InternetBowser\0A\00"
define i32 @about() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0))
ret i32 2
}
void OOC_FFTC_open() {}


x86 assembly (clang, -O0):
<OOC_FFTC_open>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OOC_FFTC_open>:
ret

LLVM IR (-O0):
define void @OOC_FFTC_open() {
ret void
}

LLVM IR (-O2):
define void @OOC_FFTC_open() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
int pthread_self();
void *work(void *i) {
  printf("Hello, world from %i\n", pthread_self());
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<work>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <pthread_self@plt>
mov    %eax,%esi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<work>:
push   %rax
xor    %eax,%eax
call   1050 <pthread_self@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Hello, world from %i\0A\00"
define i8* @work(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = call i32 (...) @pthread_self()
%5 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @pthread_exit(i32* null)
%7 = load i8*, i8** %2
ret i8* %7
}

LLVM IR (-O2):
@.str = [22 x i8] c"Hello, world from %i\0A\00"
define noalias i8* @work(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @pthread_self()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ join_lines();
void cmd_join(const char *pf, char **args) { join_lines(); }


x86 assembly (clang, -O0):
<cmd_join>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <join_lines@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_join>:
xor    %eax,%eax
jmp    1030 <join_lines@plt>

LLVM IR (-O0):
define void @cmd_join(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
store i8* %0, i8** %3
store i8** %1, i8*** %4
%5 = call i32 (...) @join_lines()
ret void
}

LLVM IR (-O2):
define void @cmd_join(i8* nocapture readnone %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @join_lines()
ret void
}
/* Variables and functions */
void *malloc(unsigned int);
void *ia_css_cpu_mem_alloc(unsigned int size) { return malloc(size); }


x86 assembly (clang, -O0):
<ia_css_cpu_mem_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <malloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ia_css_cpu_mem_alloc>:
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @ia_css_cpu_mem_alloc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i8* @malloc(i32 %3)
ret i8* %4
}

LLVM IR (-O2):
define noalias i8* @ia_css_cpu_mem_alloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
ret i8* %2
}
/* Type definitions */
struct mpk_stringlist {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ LIST_INIT(struct mpk_stringlist *);
int mpk_stringlist_init(struct mpk_stringlist *list) {
  LIST_INIT(list);
  return 0;
}


x86 assembly (clang, -O0):
<mpk_stringlist_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <LIST_INIT@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpk_stringlist_init>:
push   %rax
call   1030 <LIST_INIT@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.mpk_stringlist = type { i32 }
define i32 @mpk_stringlist_init(%struct.mpk_stringlist* %0) {
%2 = alloca %struct.mpk_stringlist*
store %struct.mpk_stringlist* %0, %struct.mpk_stringlist** %2
%3 = load %struct.mpk_stringlist*, %struct.mpk_stringlist** %2
%4 = call i32 @LIST_INIT(%struct.mpk_stringlist* %3)
ret i32 0
}

LLVM IR (-O2):
%struct.mpk_stringlist = type { i32 }
define i32 @mpk_stringlist_init(%struct.mpk_stringlist* %0) {
%2 = tail call i32 @LIST_INIT(%struct.mpk_stringlist* %0)
ret i32 0
}
/* Variables and functions */
char *strchr(register const char *s, register int c) {
  c = (char)c;
  while (c != *s)
    if (*s++ == '\0')
      return NULL;
  return (char *)s;
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
movsbl %al,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1153 <strchr+0x53>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    114e <strchr+0x4e>
movq   $0x0,-0x8(%rbp)
jmp    115b <strchr+0x5b>
jmp    1114 <strchr+0x14>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
mov    %rdi,%rax
movsbl %sil,%ecx
nopw   0x0(%rax,%rax,1)
movsbl (%rax),%edx
cmp    %edx,%ecx
je     1121 <strchr+0x21>
add    $0x1,%rax
test   %dl,%dl
jne    1110 <strchr+0x10>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @strchr(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = trunc i32 %6 to i8
%8 = sext i8 %7 to i32
store i32 %8, i32* %5
br label %9
9: ; preds = %22, %2
%10 = load i32, i32* %5
%11 = load i8*, i8** %4
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %10, %13
br i1 %14, label %15, label %23
15: ; preds = %9
%16 = load i8*, i8** %4
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %4
%18 = load i8, i8* %16
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %15
store i8* null, i8** %3
br label %25
22: ; preds = %15
br label %9
23: ; preds = %9
%24 = load i8*, i8** %4
store i8* %24, i8** %3
br label %25
25: ; preds = %23, %21
%26 = load i8*, i8** %3
ret i8* %26
}

LLVM IR (-O2):
define i8* @strchr(i8* %0, i32 %1) {
%3 = shl i32 %1, 24
%4 = ashr exact i32 %3, 24
br label %5
5: ; preds = %10, %2
%6 = phi i8* [ %0, %2 ], [ %11, %10 ]
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %4, %8
br i1 %9, label %13, label %10
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %6, i64 1
%12 = icmp eq i8 %7, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %10
%14 = phi i8* [ null, %10 ], [ %6, %5 ]
ret i8* %14
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
uint32_t I2CMasterIntStatusEx(uint32_t ui32Base, bool bMasked) {
  ;
  if (bMasked) {
    return ((*((volatile unsigned long *)(ui32Base + 0x00000018))));
  } else {
    return ((*((volatile unsigned long *)(ui32Base + 0x00000014))));
  }
}


x86 assembly (clang, -O0):
<I2CMasterIntStatusEx>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1126 <I2CMasterIntStatusEx+0x26>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    1132 <I2CMasterIntStatusEx+0x32>
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2CMasterIntStatusEx>:
mov    %rdi,-0x8(%rsp)
xor    %eax,%eax
test   %esi,%esi
setne  %al
mov    -0x8(%rsp),%rcx
mov    0x14(%rcx,%rax,4),%rax
ret

LLVM IR (-O0):
define i64 @I2CMasterIntStatusEx(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i32
store volatile i64 %0, i64* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load volatile i64, i64* %4
%10 = add i64 %9, 24
%11 = inttoptr i64 %10 to i64*
%12 = load volatile i64, i64* %11
store i64 %12, i64* %3
br label %18
13: ; preds = %2
%14 = load volatile i64, i64* %4
%15 = add i64 %14, 20
%16 = inttoptr i64 %15 to i64*
%17 = load volatile i64, i64* %16
store i64 %17, i64* %3
br label %18
18: ; preds = %13, %8
%19 = load i64, i64* %3
ret i64 %19
}

LLVM IR (-O2):
define i64 @I2CMasterIntStatusEx(i64 %0, i32 %1) {
%3 = alloca i64
store volatile i64 %0, i64* %3
%4 = icmp eq i32 %1, 0
%5 = load volatile i64, i64* %3
%6 = select i1 %4, i64 20, i64 24
%7 = add i64 %5, %6
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
ret i64 %9
}
int main(void) {
  int counter = 0;
  for (; counter < 5; counter++) {
    int a;
    a++;
  }
  for (counter = 15; counter < 5; counter) {
    int b;
    b++;
  }
  for (counter = 15; counter < 5;) {
    int c;
    c++;
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1133 <main+0x33>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1112 <main+0x12>
movl   $0xf,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1152 <main+0x52>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113a <main+0x3a>
movl   $0xf,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1171 <main+0x71>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1159 <main+0x59>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %6
6: ; preds = %12, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 5
br i1 %8, label %9, label %15
9: ; preds = %6
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
store i32 %11, i32* %3
br label %12
12: ; preds = %9
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
br label %6
15: ; preds = %6
store i32 15, i32* %2
br label %16
16: ; preds = %22, %15
%17 = load i32, i32* %2
%18 = icmp slt i32 %17, 5
br i1 %18, label %19, label %24
19: ; preds = %16
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %22
22: ; preds = %19
%23 = load i32, i32* %2
br label %16
24: ; preds = %16
store i32 15, i32* %2
br label %25
25: ; preds = %28, %24
%26 = load i32, i32* %2
%27 = icmp slt i32 %26, 5
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
br label %25
31: ; preds = %25
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void fninit() { __asm("fninit" ::: "memory"); }


x86 assembly (clang, -O0):
<fninit>:
push   %rbp
mov    %rsp,%rbp
fninit
pop    %rbp
ret

x86 assembly (clang, -O2):
<fninit>:
fninit
ret

LLVM IR (-O0):
define void @fninit() {
ret void
}

LLVM IR (-O2):
define void @fninit() {
tail call void asm sideeffect "fninit", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
void foo_2_1_2_1_2_1_1_1_2() {}


x86 assembly (clang, -O0):
<foo_2_1_2_1_2_1_1_1_2>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo_2_1_2_1_2_1_1_1_2>:
ret

LLVM IR (-O0):
define void @foo_2_1_2_1_2_1_1_1_2() {
ret void
}

LLVM IR (-O2):
define void @foo_2_1_2_1_2_1_1_1_2() {
ret void
}
char *my_strcpy(char *dest, char *src) {
  int i;
  i = 0;
  while (src[i] != '\0') {
    dest[i] = src[i];
    i++;
  }
  dest[i] = '\0';
  return (dest);
}


x86 assembly (clang, -O0):
<my_strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     114c <my_strcpy+0x4c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <my_strcpy+0x13>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strcpy>:
mov    %rdi,%rax
mov    (%rsi),%cl
test   %cl,%cl
je     1127 <my_strcpy+0x27>
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
mov    %cl,(%rax,%rdx,1)
movzbl 0x1(%rsi,%rdx,1),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1110 <my_strcpy+0x10>
mov    %edx,%ecx
movb   $0x0,(%rax,%rcx,1)
ret
xor    %ecx,%ecx
movb   $0x0,(%rax,%rcx,1)
ret

LLVM IR (-O0):
define i8* @my_strcpy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
br label %6
6: ; preds = %14, %2
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %7, i64 %9
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %26
14: ; preds = %6
%15 = load i8*, i8** %4
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = load i8*, i8** %3
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
store i8 %19, i8* %23
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
br label %6
26: ; preds = %6
%27 = load i8*, i8** %3
%28 = load i32, i32* %5
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %27, i64 %29
store i8 0, i8* %30
%31 = load i8*, i8** %3
ret i8* %31
}

LLVM IR (-O2):
define i8* @my_strcpy(i8* returned writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %9, %5 ], [ 0, %2 ]
%7 = phi i8 [ %11, %5 ], [ %3, %2 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 %7, i8* %8
%9 = add nuw nsw i64 %6, 1
%10 = getelementptr inbounds i8, i8* %1, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5
%14 = and i64 %9, 4294967295
br label %15
15: ; preds = %13, %2
%16 = phi i64 [ 0, %2 ], [ %14, %13 ]
%17 = getelementptr inbounds i8, i8* %0, i64 %16
store i8 0, i8* %17
ret i8* %0
}