xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strlen(char *);
int main() {
  char input[128];
  fgets(input, 128, stdin);
  printf("%s has %lu characters.\n", input, strlen(input));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x90(%rbp),%rdi
mov    0x2e98(%rip),%rax
mov    (%rax),%edx
mov    $0x80,%esi
call   1050 <fgets@plt>
lea    -0x90(%rbp),%rax
mov    %rax,-0x98(%rbp)
lea    -0x90(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x98(%rbp),%rsi
mov    %eax,%edx
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
mov    0x2ea9(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x80,%esi
call   1050 <fgets@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0xea0(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [24 x i8] c"%s has %lu characters.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [128 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* %3, i32 128, i32 %4)
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %6, i32 %8)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [24 x i8] c"%s has %lu characters.\0A\00"
define i32 @main() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32 @fgets(i8* %2, i32 128, i32 %3)
%5 = call i32 @strlen(i8* %2)
%6 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %5)
ret i32 0
}
void U_EMRWIDENPATH_print(const char *contents) { (void)contents; }


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

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

LLVM IR (-O0):
define void @U_EMRWIDENPATH_print(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
define void @U_EMRWIDENPATH_print(i8* nocapture %0) {
ret void
}
void foo718(int p) {}


x86 assembly (clang, -O0):
<foo718>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @foo718(i32 %0) {
ret void
}
/* Variables and functions */
char *getHello();
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  printf("%s\n", getHello());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getHello@plt>
mov    %rax,%rsi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <getHello@plt>
lea    0xed1(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8* (...) @getHello()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 0
}
/* Variables and functions */
int rand();
int rand_between(int a, int b) {
  b += 1;
  return (rand() % (b - a)) + a;
}


x86 assembly (clang, -O0):
<rand_between>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_between>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
sub    %ebp,%ebx
add    $0x1,%ebx
cltd
idiv   %ebx
add    %edx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @rand_between(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 = add nsw i32 %5, 1
store i32 %6, i32* %4
%7 = call i32 (...) @rand()
%8 = load i32, i32* %4
%9 = load i32, i32* %3
%10 = sub nsw i32 %8, %9
%11 = srem i32 %7, %10
%12 = load i32, i32* %3
%13 = add nsw i32 %11, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @rand_between(i32 %0, i32 %1) {
%3 = tail call i32 (...) @rand()
%4 = sub i32 1, %0
%5 = add i32 %4, %1
%6 = srem i32 %3, %5
%7 = add nsw i32 %6, %0
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int *malloc(int);
int main() {
  int *p, *q, *r;
  int havoc1, havoc2;
  p = malloc(sizeof(int));
  q = malloc(sizeof(int));
  if (havoc1) {
    r = q;
  } else {
    r = p;
  }
  *p = 0;
  *q = 1;
  if (havoc2) {
    *r = 1;
  } else {
    *p = 1;
  }
  assert(*r == 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1162 <main+0x42>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    116a <main+0x4a>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
cmpl   $0x0,-0x28(%rbp)
je     1197 <main+0x77>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
jmp    11a1 <main+0x81>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rax
cmpl   $0x1,(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @malloc(i32 4)
%2 = tail call i32* @malloc(i32 4)
%3 = tail call i32 @assert(i32 1)
ret i32 0
}
/* Type definitions */
typedef scalar_t__ uint64_t;
struct timespec {
  int tv_sec;
  scalar_t__ tv_nsec;
};

/* Variables and functions */
uint64_t getTimeDiff(struct timespec *time_A, struct timespec *time_B) {
  return ((time_A->tv_sec * 1000000000) + time_A->tv_nsec) -
         ((time_B->tv_sec * 1000000000) + time_B->tv_nsec);
}


x86 assembly (clang, -O0):
<getTimeDiff>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x3b9aca00,(%rax),%eax
cltq
mov    -0x8(%rbp),%rcx
add    0x8(%rcx),%rax
mov    -0x10(%rbp),%rcx
imul   $0x3b9aca00,(%rcx),%ecx
movslq %ecx,%rcx
mov    -0x10(%rbp),%rdx
add    0x8(%rdx),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getTimeDiff>:
movslq (%rdi),%rax
imul   $0x3b9aca00,%rax,%rax
movslq (%rsi),%rcx
add    0x8(%rdi),%rax
imul   $0x3b9aca00,%rcx,%rcx
add    0x8(%rsi),%rcx
sub    %rcx,%rax
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i64 }
define i64 @getTimeDiff(%struct.timespec* %0, %struct.timespec* %1) {
%3 = alloca %struct.timespec*
%4 = alloca %struct.timespec*
store %struct.timespec* %0, %struct.timespec** %3
store %struct.timespec* %1, %struct.timespec** %4
%5 = load %struct.timespec*, %struct.timespec** %3
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 0
%7 = load i32, i32* %6
%8 = mul nsw i32 %7, 1000000000
%9 = sext i32 %8 to i64
%10 = load %struct.timespec*, %struct.timespec** %3
%11 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 1
%12 = load i64, i64* %11
%13 = add nsw i64 %9, %12
%14 = load %struct.timespec*, %struct.timespec** %4
%15 = getelementptr inbounds %struct.timespec, %struct.timespec* %14, i32 0, i32 0
%16 = load i32, i32* %15
%17 = mul nsw i32 %16, 1000000000
%18 = sext i32 %17 to i64
%19 = load %struct.timespec*, %struct.timespec** %4
%20 = getelementptr inbounds %struct.timespec, %struct.timespec* %19, i32 0, i32 1
%21 = load i64, i64* %20
%22 = add nsw i64 %18, %21
%23 = sub nsw i64 %13, %22
ret i64 %23
}

LLVM IR (-O2):
%struct.timespec = type { i32, i64 }
define i64 @getTimeDiff(%struct.timespec* nocapture %0, %struct.timespec* nocapture %1) {
%3 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
%4 = load i32, i32* %3
%5 = mul nsw i32 %4, 1000000000
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
%8 = load i64, i64* %7
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%10 = load i32, i32* %9
%11 = mul nsw i32 %10, 1000000000
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%14 = load i64, i64* %13
%15 = add i64 %8, %6
%16 = add i64 %14, %12
%17 = sub i64 %15, %16
ret i64 %17
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int SIGINT;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void sig_handler(int sig) {
  char signal;
  if (sig == SIGINT) {
    fprintf(stderr, "\nProgram stopped!\n");
    exit(EXIT_FAILURE);
  } else
    return;
}


x86 assembly (clang, -O0):
<sig_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2eb3(%rip),%rcx
cmp    (%rcx),%eax
jne    1160 <sig_handler+0x40>
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_handler>:
push   %rax
mov    0x2ec0(%rip),%rax
cmp    %edi,(%rax)
je     112e <sig_handler+0xe>
pop    %rax
ret
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
lea    0xec2(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@SIGINT = global i32 0
@stderr = global i32 0
@.str = [19 x i8] c"\0AProgram stopped!\0A\00"
@EXIT_FAILURE = global i32 0
define void @sig_handler(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @SIGINT
%6 = icmp eq i32 %4, %5
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
12: ; preds = %1
ret void
}

LLVM IR (-O2):
@SIGINT = global i32 0
@stderr = global i32 0
@.str = [19 x i8] c"\0AProgram stopped!\0A\00"
@EXIT_FAILURE = global i32 0
define void @sig_handler(i32 %0) {
%2 = load i32, i32* @SIGINT
%3 = icmp eq i32 %2, %0
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ moveSpider();
int /*<<< orphan*/ printf(char *);
void *motorHandle(void *param) {
  printf("[INFO] Handle Motor Thread created. \n");
  unsigned int time = 1;
  while (1) {
    moveSpider();
    time++;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<motorHandle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    $0x0,%al
call   1040 <moveSpider@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    %eax,-0xc(%rbp)
jmp    113f <motorHandle+0x1f>

x86 assembly (clang, -O2):
<motorHandle>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
nopl   (%rax)
xor    %eax,%eax
call   1040 <moveSpider@plt>
jmp    1130 <motorHandle+0x10>

LLVM IR (-O0):
@.str = [38 x i8] c"[INFO] Handle Motor Thread created. \0A\00"
define i8* @motorHandle(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %5
5: ; preds = %1, %5
%6 = call i32 (...) @moveSpider()
%7 = load i32, i32* %3
%8 = add i32 %7, 1
store i32 %8, i32* %3
br label %5
}

LLVM IR (-O2):
@str = [37 x i8] c"[INFO] Handle Motor Thread created. \00"
define noalias i8* @motorHandle(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
br label %3
3: ; preds = %3, %1
%4 = tail call i32 (...) @moveSpider()
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int f(int);
int g(int x) {
  int y;
  if (x < 1000) {
    y = f(x);
    assert(y == x + 1);
  }
  return x;
}


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x3e8,-0x4(%rbp)
jge    115b <g+0x3b>
mov    -0x4(%rbp),%edi
call   1030 <f@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g>:
push   %rbx
mov    %edi,%ebx
cmp    $0x3e7,%edi
jg     1142 <g+0x22>
mov    %ebx,%edi
call   1030 <f@plt>
lea    0x1(%rbx),%ecx
xor    %edi,%edi
cmp    %ecx,%eax
sete   %dil
call   1040 <assert@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @g(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 1000
br i1 %5, label %6, label %15
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i32 @f(i32 %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
%12 = icmp eq i32 %9, %11
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
br label %15
15: ; preds = %6, %1
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @g(i32 returned %0) {
%2 = icmp slt i32 %0, 1000
br i1 %2, label %3, label %9
3: ; preds = %1
%4 = tail call i32 @f(i32 %0)
%5 = add nsw i32 %0, 1
%6 = icmp eq i32 %4, %5
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
br label %9
9: ; preds = %3, %1
ret i32 %0
}
void init_leds(void) {
  (*(volatile unsigned long *)(0xE0028000 + 0x18)) |= 0x00ff0000;
}


x86 assembly (clang, -O0):
<init_leds>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe0028018,%eax
mov    (%rax),%rcx
or     $0xff0000,%rcx
mov    $0xe0028018,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_leds>:
mov    $0xe0028018,%eax
orq    $0xff0000,(%rax)
ret

LLVM IR (-O0):
define void @init_leds() {
%1 = load volatile i64, i64* inttoptr (i64 3758260248 to i64*)
%2 = or i64 %1, 16711680
store volatile i64 %2, i64* inttoptr (i64 3758260248 to i64*)
ret void
}

LLVM IR (-O2):
define void @init_leds() {
%1 = load volatile i64, i64* inttoptr (i64 3758260248 to i64*)
%2 = or i64 %1, 16711680
store volatile i64 %2, i64* inttoptr (i64 3758260248 to i64*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EOPNOTSUPP;
int /*<<< orphan*/ errno;
int get_rcvtimeo(int fd, void *optval, int *optlen) {
  errno = EOPNOTSUPP;
  return -1;
}


x86 assembly (clang, -O0):
<get_rcvtimeo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2eca(%rip),%rax
mov    (%rax),%ecx
mov    0x2eb9(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_rcvtimeo>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@EOPNOTSUPP = global i32 0
@errno = global i32 0
define i32 @get_rcvtimeo(i32 %0, i8* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%7 = load i32, i32* @EOPNOTSUPP
store i32 %7, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@EOPNOTSUPP = global i32 0
@errno = global i32 0
define i32 @get_rcvtimeo(i32 %0, i8* nocapture readnone %1, i32* nocapture readnone %2) {
%4 = load i32, i32* @EOPNOTSUPP
store i32 %4, i32* @errno
ret i32 -1
}
void _glapi_destroy_multithread(void) {}


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

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

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

LLVM IR (-O2):
define void @_glapi_destroy_multithread() {
ret void
}
void wx11qr() {}


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

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

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

LLVM IR (-O2):
define void @wx11qr() {
ret void
}
void wifi_rsp_dfu_flash_set_address(
    const struct wifi_msg_dfu_flash_set_address_rsp_t *msg) {}


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

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

LLVM IR (-O0):
%struct.wifi_msg_dfu_flash_set_address_rsp_t = type opaque
define void @wifi_rsp_dfu_flash_set_address(%struct.wifi_msg_dfu_flash_set_address_rsp_t* %0) {
%2 = alloca %struct.wifi_msg_dfu_flash_set_address_rsp_t*
store %struct.wifi_msg_dfu_flash_set_address_rsp_t* %0, %struct.wifi_msg_dfu_flash_set_address_rsp_t** %2
ret void
}

LLVM IR (-O2):
%struct.wifi_msg_dfu_flash_set_address_rsp_t = type opaque
define void @wifi_rsp_dfu_flash_set_address(%struct.wifi_msg_dfu_flash_set_address_rsp_t* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void rt_timer_destroy(void *v) { free(v); }


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

x86 assembly (clang, -O2):
<rt_timer_destroy>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @rt_timer_destroy(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
const char *np(const char *str) {
  if (str)
    return str;
  else
    return "[NULL]";
}


x86 assembly (clang, -O0):
<np>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1120 <np+0x20>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    112b <np+0x2b>
lea    0xed9(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<np>:
test   %rdi,%rdi
lea    0xef6(%rip),%rax
cmovne %rdi,%rax
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"[NULL]\00"
define i8* @np(i8* readnone %0) {
%2 = icmp eq i8* %0, null
%3 = select i1 %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0
ret i8* %3
}
void free_dcuboid(double ***m) {
  free(m[0][0]);
  free(m[0]);
  free(m);
}


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

x86 assembly (clang, -O2):
<free_dcuboid>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    (%rbx),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_dcuboid(double*** %0) {
%2 = alloca double***
store double*** %0, double**** %2
%3 = load double***, double**** %2
%4 = getelementptr inbounds double**, double*** %3, i64 0
%5 = load double**, double*** %4
%6 = getelementptr inbounds double*, double** %5, i64 0
%7 = load double*, double** %6
%8 = bitcast double* %7 to i8*
%9 = load double***, double**** %2
%10 = getelementptr inbounds double**, double*** %9, i64 0
%11 = load double**, double*** %10
%12 = bitcast double** %11 to i8*
%13 = load double***, double**** %2
%14 = bitcast double*** %13 to i8*
ret void
}

LLVM IR (-O2):
define void @free_dcuboid(double*** nocapture %0) {
%2 = bitcast double*** %0 to i8***
%3 = load i8**, i8*** %2
%4 = load i8*, i8** %3
tail call void @free(i8* %4)
%5 = bitcast double*** %0 to i8**
%6 = load i8*, i8** %5
tail call void @free(i8* %6)
%7 = bitcast double*** %0 to i8*
tail call void @free(i8* %7)
ret void
}
int __cxa_atexit(void func(void *), void *arg, void *dso_handle) {
  (void)func;
  (void)arg;
  (void)dso_handle;
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @__cxa_atexit(void (i8*)* %0, i8* %1, i8* %2) {
%4 = alloca void (i8*)*
%5 = alloca i8*
%6 = alloca i8*
store void (i8*)* %0, void (i8*)** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load void (i8*)*, void (i8*)** %4
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
ret i32 0
}

LLVM IR (-O2):
define i32 @__cxa_atexit(void (i8*)* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2) {
ret i32 0
}
int xor1(int i, int j) { return (j % 2) ? 0 : 1; }


x86 assembly (clang, -O0):
<xor1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xor1>:
mov    %esi,%eax
not    %eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @xor1(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 = srem i32 %5, 2
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 0, i32 1
ret i32 %9
}

LLVM IR (-O2):
define i32 @xor1(i32 %0, i32 %1) {
%3 = and i32 %1, 1
%4 = xor i32 %3, 1
ret i32 %4
}
int test_imm_C6int64_midword_reg(long long val) {
  return ((val >> 16) & (0xC6 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_C6int64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
sar    $0x10,%rdx
and    $0xc6,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_C6int64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 16
%5 = and i64 %4, 198
%6 = icmp ne i64 %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_C6int64_midword_reg(i64 %0) {
%2 = and i64 %0, 12976128
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ error(char *);
illname() { error("illegal symbol name"); }


x86 assembly (clang, -O0):
<illname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <error@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<illname>:
lea    0xee9(%rip),%rdi
jmp    1030 <error@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"illegal symbol name\00"
define i32 @illname() {
%1 = alloca i32
%2 = call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [20 x i8] c"illegal symbol name\00"
define i32 @illname() {
%1 = tail call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
int tas(volatile char *lock) {
  register char res = 1;
  __asm__ __volatile__("lock xchgb %0, %1\n"
                       : "+q"(res), "+m"(*lock)
                       :
                       : "memory", "cc");
  return res;
}


x86 assembly (clang, -O0):
<tas>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movb   $0x1,-0x9(%rbp)
mov    -0x9(%rbp),%al
mov    -0x8(%rbp),%rcx
lock xchg %al,(%rcx)
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tas>:
mov    $0x1,%al
lock xchg %al,(%rdi)
movsbl %al,%eax
ret

LLVM IR (-O0):
define i32 @tas(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
store i8 1, i8* %3
%4 = load i8, i8* %3
%5 = load i8*, i8** %2
%6 = call i8 asm sideeffect "lock xchgb $0, $1\0A", "=q,=*m,0,*m,~{memory},~{cc},~{dirflag},~{fpsr},~{flags}"(i8* elementtype(i8) %5, i8 %4, i8* elementtype(i8) %5)
store i8 %6, i8* %3
%7 = load i8, i8* %3
%8 = sext i8 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @tas(i8* %0) {
%2 = tail call i8 asm sideeffect "lock xchgb $0, $1\0A", "=q,=*m,0,*m,~{memory},~{cc},~{dirflag},~{fpsr},~{flags}"(i8* elementtype(i8) %0, i8 1, i8* elementtype(i8) %0)
%3 = sext i8 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ isalpha(int);
int /*<<< orphan*/ isdigit(int);
int ispunct(int c) { return !isalpha(c) && !isdigit(c) && !(c < 0x21); }


x86 assembly (clang, -O0):
<ispunct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <isalpha@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x5(%rbp)
jne    1167 <ispunct+0x47>
mov    -0x4(%rbp),%edi
call   1030 <isdigit@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x5(%rbp)
jne    1167 <ispunct+0x47>
cmpl   $0x21,-0x4(%rbp)
setl   %al
xor    $0xff,%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ispunct>:
push   %rbx
mov    %edi,%ebx
call   1030 <isalpha@plt>
test   %eax,%eax
sete   %al
lea    -0x3a(%rbx),%ecx
cmp    $0xfffffff6,%ecx
setb   %cl
cmp    $0x21,%ebx
setge  %dl
and    %al,%cl
and    %dl,%cl
movzbl %cl,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ispunct(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @isalpha(i32 %3)
%5 = icmp ne i32 %4, 0
br i1 %5, label %14, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i32 @isdigit(i32 %7)
%9 = icmp ne i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %6
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 33
%13 = xor i1 %12, true
br label %14
14: ; preds = %10, %6, %1
%15 = phi i1 [ false, %6 ], [ false, %1 ], [ %13, %10 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @ispunct(i32 %0) {
%2 = tail call i32 @isalpha(i32 %0)
%3 = icmp eq i32 %2, 0
%4 = add i32 %0, -58
%5 = icmp ult i32 %4, -10
%6 = icmp sgt i32 %0, 32
%7 = and i1 %5, %3
%8 = and i1 %6, %7
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int main() {
  char c = 'A';
  c++;
  printf("%c\n", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x41,-0x5(%rbp)
mov    -0x5(%rbp),%al
add    $0x1,%al
mov    %al,-0x5(%rbp)
lea    0xece(%rip),%rdi
movsbl -0x5(%rbp),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x42,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
store i8 65, i8* %2
%3 = load i8, i8* %2
%4 = add i8 %3, 1
store i8 %4, i8* %2
%5 = load i8, i8* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext 66)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ core7_print(char *, char *, char *, char const *);
void U_EMRSETVIEWPORTEXTEX_print(const char *contents) {
  core7_print("U_EMRSETVIEWPORTEXTEX", "szlExtent:", "", contents);
}


x86 assembly (clang, -O0):
<U_EMRSETVIEWPORTEXTEX_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
lea    0xed9(%rip),%rdi
lea    0xee8(%rip),%rsi
lea    0xeeb(%rip),%rdx
call   1030 <core7_print@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<U_EMRSETVIEWPORTEXTEX_print>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdi
lea    0xef5(%rip),%rsi
lea    0xef8(%rip),%rdx
jmp    1030 <core7_print@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"U_EMRSETVIEWPORTEXTEX\00"
@.str.1 = [11 x i8] c"szlExtent:\00"
@.str.2 = [1 x i8] zeroinitializer
define void @U_EMRSETVIEWPORTEXTEX_print(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @core7_print(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"U_EMRSETVIEWPORTEXTEX\00"
@.str.1 = [11 x i8] c"szlExtent:\00"
@.str.2 = [1 x i8] zeroinitializer
define void @U_EMRSETVIEWPORTEXTEX_print(i8* %0) {
%2 = tail call i32 @core7_print(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
scalar_t__ getpid();
scalar_t__ gettid_sys();
int /*<<< orphan*/ printf(char *, long, long, char *);
int /*<<< orphan*/ stdout;
void whoami(char *msg) {
  printf("pid %ld Thread %ld %s\n", (long)getpid(), (long)gettid_sys(), msg);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<whoami>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <gettid_sys@plt>
mov    -0x10(%rbp),%rsi
mov    %rax,%rdx
mov    -0x8(%rbp),%rcx
lea    0xe90(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<whoami>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1050 <gettid_sys@plt>
lea    0xea1(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
mov    %r14,%rcx
call   1040 <printf@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <fflush@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"pid %ld Thread %ld %s\0A\00"
@stdout = global i32 0
define void @whoami(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i64 (...) @getpid()
%4 = call i64 (...) @gettid_sys()
%5 = load i8*, i8** %2
%6 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i64 %3, i64 %4, i8* %5)
%7 = load i32, i32* @stdout
%8 = call i32 @fflush(i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"pid %ld Thread %ld %s\0A\00"
@stdout = global i32 0
define void @whoami(i8* %0) {
%2 = tail call i64 (...) @getpid()
%3 = tail call i64 (...) @gettid_sys()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i64 %2, i64 %3, i8* %0)
%5 = load i32, i32* @stdout
%6 = tail call i32 @fflush(i32 %5)
ret void
}
void arch_xir_eoi(struct cpu_thread *thread __attribute__((unused))) { return; }


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

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

LLVM IR (-O0):
%struct.cpu_thread = type opaque
define void @arch_xir_eoi(%struct.cpu_thread* %0) {
%2 = alloca %struct.cpu_thread*
store %struct.cpu_thread* %0, %struct.cpu_thread** %2
ret void
}

LLVM IR (-O2):
%struct.cpu_thread = type opaque
define void @arch_xir_eoi(%struct.cpu_thread* nocapture %0) {
ret void
}
/* Variables and functions */
char *strdup(char *);
int strlen(char *);
char *strrchr(char *, char);
char *chomp(char *str) {
  int str_len = strlen(str);
  char *pos = strrchr(str, '.');
  if (pos != NULL) {
    int suf_len = strlen(pos);
    str = strdup(str);
    str[str_len - suf_len] = 0;
  }
  return str;
}


x86 assembly (clang, -O0):
<chomp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2e,%esi
call   1040 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     118f <chomp+0x5f>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chomp>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x2e,%esi
call   1040 <strrchr@plt>
test   %rax,%rax
je     1170 <chomp+0x40>
mov    %rax,%rdi
call   1030 <strlen@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
call   1050 <strdup@plt>
mov    %rax,%rbx
sub    %r14d,%ebp
movslq %ebp,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @chomp(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %3
%8 = load i8*, i8** %2
%9 = call i8* @strrchr(i8* %8, i8 signext 46)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %23
12: ; preds = %1
%13 = load i8*, i8** %4
%14 = call i32 @strlen(i8* %13)
store i32 %14, i32* %5
%15 = load i8*, i8** %2
%16 = call i8* @strdup(i8* %15)
store i8* %16, i8** %2
%17 = load i8*, i8** %2
%18 = load i32, i32* %3
%19 = load i32, i32* %5
%20 = sub nsw i32 %18, %19
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %17, i64 %21
store i8 0, i8* %22
br label %23
23: ; preds = %12, %1
%24 = load i8*, i8** %2
ret i8* %24
}

LLVM IR (-O2):
define i8* @chomp(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 46)
%4 = icmp eq i8* %3, null
br i1 %4, label %11, label %5
5: ; preds = %1
%6 = tail call i32 @strlen(i8* %3)
%7 = tail call i8* @strdup(i8* %0)
%8 = sub nsw i32 %2, %6
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %7, i64 %9
store i8 0, i8* %10
br label %11
11: ; preds = %5, %1
%12 = phi i8* [ %7, %5 ], [ %0, %1 ]
ret i8* %12
}
/* Variables and functions */
int intel_ich_gpio_set(int, int);
int intel_ich_gpio21_raise(void) { return intel_ich_gpio_set(21, 1); }


x86 assembly (clang, -O0):
<intel_ich_gpio21_raise>:
push   %rbp
mov    %rsp,%rbp
mov    $0x15,%edi
mov    $0x1,%esi
call   1030 <intel_ich_gpio_set@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<intel_ich_gpio21_raise>:
mov    $0x15,%edi
mov    $0x1,%esi
jmp    1030 <intel_ich_gpio_set@plt>

LLVM IR (-O0):
define i32 @intel_ich_gpio21_raise() {
%1 = call i32 @intel_ich_gpio_set(i32 21, i32 1)
ret i32 %1
}

LLVM IR (-O2):
define i32 @intel_ich_gpio21_raise() {
%1 = tail call i32 @intel_ich_gpio_set(i32 21, i32 1)
ret i32 %1
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t signum_fun_uint32_t(uint32_t a) { return (a > 0); }


x86 assembly (clang, -O0):
<signum_fun_uint32_t>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<signum_fun_uint32_t>:
xor    %eax,%eax
test   %edi,%edi
setg   %al
ret

LLVM IR (-O0):
define i32 @signum_fun_uint32_t(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @signum_fun_uint32_t(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
int rev(int number) {
  int base = 1;
  while (number / (base * 10)) {
    base *= 10;
  }
  if (number <= 9) {
    return number;
  } else {
    int revNum = (number % 10) * base;
    return rev(number / 10) + revNum;
  }
}


x86 assembly (clang, -O0):
<rev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%eax
imul   $0xa,-0xc(%rbp),%ecx
cltd
idiv   %ecx
cmp    $0x0,%eax
je     1141 <rev+0x31>
imul   $0xa,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1122 <rev+0x12>
cmpl   $0x9,-0x8(%rbp)
jg     1156 <rev+0x46>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1180 <rev+0x70>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
imul   -0xc(%rbp),%edx
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <rev@plt>
add    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rev>:
xor    %r9d,%r9d
mov    $0xcccccccd,%r8d
nopl   0x0(%rax)
mov    $0x1,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ecx,%esi
lea    (%rsi,%rsi,1),%eax
lea    (%rax,%rax,4),%ecx
mov    %edi,%eax
cltd
idiv   %ecx
test   %eax,%eax
jne    1120 <rev+0x20>
cmp    $0xa,%edi
jl     1155 <rev+0x55>
mov    %edi,%eax
imul   %r8,%rax
shr    $0x23,%rax
lea    (%rax,%rax,1),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%edi
imul   %edi,%esi
add    %r9d,%esi
mov    %esi,%r9d
mov    %eax,%edi
jmp    1110 <rev+0x10>
add    %r9d,%edi
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @rev(i32 %0) {
br label %2
2: ; preds = %12, %1
%3 = phi i32 [ 0, %1 ], [ %16, %12 ]
%4 = phi i32 [ %0, %1 ], [ %15, %12 ]
br label %5
5: ; preds = %5, %2
%6 = phi i32 [ 1, %2 ], [ %7, %5 ]
%7 = mul nuw nsw i32 %6, 10
%8 = sdiv i32 %4, %7
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %5
10: ; preds = %5
%11 = icmp slt i32 %4, 10
br i1 %11, label %17, label %12
12: ; preds = %10
%13 = urem i32 %4, 10
%14 = mul nsw i32 %6, %13
%15 = udiv i32 %4, 10
%16 = add nuw nsw i32 %14, %3
br label %2
17: ; preds = %10
%18 = add nsw i32 %4, %3
ret i32 %18
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
void cdecl_type__time_t(time_t *unused) {}


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

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

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

LLVM IR (-O2):
define void @cdecl_type__time_t(i32* nocapture %0) {
ret void
}
int bin8_to_16(unsigned char *a) {
  signed int tmp = (a[0] << 8) + a[1];
  return tmp;
}


x86 assembly (clang, -O0):
<bin8_to_16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bin8_to_16>:
movzwl (%rdi),%eax
shl    $0x10,%eax
bswap  %eax
ret

LLVM IR (-O0):
define i32 @bin8_to_16(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl i32 %7, 8
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = add nsw i32 %8, %12
store i32 %13, i32* %3
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @bin8_to_16(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = shl nuw nsw i32 %3, 8
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = or i32 %4, %7
ret i32 %8
}
int test_add(int a, int b) { return a + b; }


x86 assembly (clang, -O0):
<test_add>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_add>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @test_add(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @test_add(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ my_strlen(char const *);
int /*<<< orphan*/ write(int, char const *, int /*<<< orphan*/);
void my_putstr_to(int fd, char const *str) { write(fd, str, my_strlen(str)); }


x86 assembly (clang, -O0):
<my_putstr_to>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <my_strlen@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_putstr_to>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1030 <my_strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <write@plt>

LLVM IR (-O0):
define void @my_putstr_to(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @my_strlen(i8* %7)
%9 = call i32 @write(i32 %5, i8* %6, i32 %8)
ret void
}

LLVM IR (-O2):
define void @my_putstr_to(i32 %0, i8* %1) {
%3 = tail call i32 @my_strlen(i8* %1)
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %3)
ret void
}
char *strcpy(char *dest, const char *src) {
  printf("# %s(dest=%p, src=%p)\n", __FUNCTION__, dest, src);
  char *p = dest;
  while (*src)
    *p++ = *src++;
  return dest;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xed1(%rip),%rdi
lea    0xee1(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1179 <strcpy+0x69>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    1145 <strcpy+0x35>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xedf(%rip),%rdi
lea    0xeef(%rip),%rsi
mov    %r14,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rbx),%al
test   %al,%al
je     1151 <strcpy+0x41>
xor    %ecx,%ecx
nopl   (%rax)
mov    %al,(%r14,%rcx,1)
movzbl 0x1(%rbx,%rcx,1),%eax
add    $0x1,%rcx
test   %al,%al
jne    1140 <strcpy+0x30>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [23 x i8] c"# %s(dest=%p, src=%p)\0A\00"
@__FUNCTION__.strcpy = [7 x i8] c"strcpy\00"
define i8* @strcpy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @__FUNCTION__.strcpy, i64 0, i64 0), i8* %6, i8* %7)
%9 = load i8*, i8** %3
store i8* %9, i8** %5
br label %10
10: ; preds = %14, %2
%11 = load i8*, i8** %4
%12 = load i8, i8* %11
%13 = icmp ne i8 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %10
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %4
%17 = load i8, i8* %15
%18 = load i8*, i8** %5
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %5
store i8 %17, i8* %18
br label %10
20: ; preds = %10
%21 = load i8*, i8** %3
ret i8* %21
}

LLVM IR (-O2):
@.str = [23 x i8] c"# %s(dest=%p, src=%p)\0A\00"
@__FUNCTION__.strcpy = [7 x i8] c"strcpy\00"
define i8* @strcpy(i8* returned %0, i8* %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @__FUNCTION__.strcpy, i64 0, i64 0), i8* %0, i8* %1)
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 0
br i1 %5, label %14, label %6
6: ; preds = %2, %6
%7 = phi i8 [ %12, %6 ], [ %4, %2 ]
%8 = phi i8* [ %11, %6 ], [ %0, %2 ]
%9 = phi i8* [ %10, %6 ], [ %1, %2 ]
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %7, i8* %8
%12 = load i8, i8* %10
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %6
14: ; preds = %6, %2
ret i8* %0
}