xunge/DecIR huggingface dataset:
int test_imm_ECint16_mem(short *val) {
  return ((*val) & (-0xEC << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_ECint16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%edx
and    $0xffffff14,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_ECint16_mem>:
movzwl (%rdi),%eax
test   $0xff14,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_ECint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -236
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int test_imm_1Fuint8_mem(unsigned char *val) {
  return ((*val) & (-0x1F << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_1Fuint8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%edx
and    $0xffffffe1,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_1Fuint8_mem>:
testb  $0xe1,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_1Fuint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -31
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int do_900() { return 900; }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    $0x384,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    $0x384,%eax
ret

LLVM IR (-O0):
define i32 @do_900() {
ret i32 900
}

LLVM IR (-O2):
define i32 @do_900() {
ret i32 900
}
/* Variables and functions */
int *lista_multiplos(int quantos, int base) { return NULL; }


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

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

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

LLVM IR (-O2):
define noalias i32* @lista_multiplos(i32 %0, i32 %1) {
ret i32* null
}
int compare_byte(char *a, char *b) { return ((a[0] ^ 0x42) != b[0]); }


x86 assembly (clang, -O0):
<compare_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
xor    $0x42,%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_byte>:
mov    (%rdi),%cl
xor    $0x42,%cl
xor    %eax,%eax
cmp    (%rsi),%cl
setne  %al
ret

LLVM IR (-O0):
define i32 @compare_byte(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = xor i32 %8, 66
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %9, %13
%15 = zext i1 %14 to i32
ret i32 %15
}

LLVM IR (-O2):
define i32 @compare_byte(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = xor i8 %3, 66
%5 = load i8, i8* %1
%6 = icmp ne i8 %4, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
double *malloc(int);
int /*<<< orphan*/ my_task(double *, double *);
void registered_pointers_with_aliases(void) {
  double *a, *b, *p, *q;
  a = malloc(123 * sizeof *a);
  b = malloc(234 * sizeof *b);
#pragma starpu register a 123
#pragma starpu register b 234
  p = a;
  q = b;
  my_task(p, q);
}


x86 assembly (clang, -O0):
<registered_pointers_with_aliases>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x3d8,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    $0x750,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <my_task@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<registered_pointers_with_aliases>:
push   %rbx
mov    $0x3d8,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    $0x750,%edi
call   1040 <malloc@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
pop    %rbx
jmp    1030 <my_task@plt>

LLVM IR (-O0):
define void @registered_pointers_with_aliases() {
%1 = alloca double*
%2 = alloca double*
%3 = alloca double*
%4 = alloca double*
%5 = call double* @malloc(i32 984)
store double* %5, double** %1
%6 = call double* @malloc(i32 1872)
store double* %6, double** %2
%7 = load double*, double** %1
store double* %7, double** %3
%8 = load double*, double** %2
store double* %8, double** %4
%9 = load double*, double** %3
%10 = load double*, double** %4
%11 = call i32 @my_task(double* %9, double* %10)
ret void
}

LLVM IR (-O2):
define void @registered_pointers_with_aliases() {
%1 = tail call double* @malloc(i32 984)
%2 = tail call double* @malloc(i32 1872)
%3 = tail call i32 @my_task(double* %1, double* %2)
ret void
}
/* Variables and functions */
int memcmp(void const *, void const *, int);
int g_memcmp(const void *s1, const void *s2, int len) {
  return memcmp(s1, s2, len);
}


x86 assembly (clang, -O0):
<g_memcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <memcmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_memcmp>:
jmp    1030 <memcmp@plt>

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

LLVM IR (-O2):
define i32 @g_memcmp(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @memcmp(i8* %0, i8* %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
scalar_t__ putchar(char);
int main() {
  char string[] = "Hello, there!\n";
  int x;
  x = 0;
  while (putchar(string[x]))
    x++;
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x13(%rbp)
mov    0xed8(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xed2(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xeca(%rip),%al
mov    %al,-0x5(%rbp)
movl   $0x0,-0x18(%rbp)
movslq -0x18(%rbp),%rax
movsbl -0x13(%rbp,%rax,1),%edi
call   1030 <putchar@plt>
cmp    $0x0,%rax
je     1174 <main+0x64>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114e <main+0x3e>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
movsbl (%rbx),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1120 <main+0x10>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.string = [15 x i8] c"Hello, there!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [15 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [15 x i8]* %2 to i8*
store i32 0, i32* %3
br label %5
5: ; preds = %12, %0
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 %7
%9 = load i8, i8* %8
%10 = call i64 @putchar(i8 signext %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %5
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %5
15: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@__const.main.string = [15 x i8] c"Hello, there!\0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i64 [ %7, %1 ], [ 0, %0 ]
%3 = getelementptr inbounds [15 x i8], [15 x i8]* @__const.main.string, i64 0, i64 %2
%4 = load i8, i8* %3
%5 = tail call i64 @putchar(i8 signext %4)
%6 = icmp eq i64 %5, 0
%7 = add nuw i64 %2, 1
br i1 %6, label %8, label %1
8: ; preds = %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void error_and_exit(const char *msg) {
  fprintf(stderr, "%s\n\n", msg);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<error_and_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error_and_exit>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [5 x i8] c"%s\0A\0A\00"
@EXIT_FAILURE = global i32 0
define void @error_and_exit(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [5 x i8] c"%s\0A\0A\00"
@EXIT_FAILURE = global i32 0
define void @error_and_exit(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ print_internal(char *, unsigned int, unsigned int volatile);
void Terminal_PrintImportant(char *string, unsigned int length) {
  volatile unsigned int k = 1;
  print_internal(string, length, k);
}


x86 assembly (clang, -O0):
<Terminal_PrintImportant>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <print_internal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Terminal_PrintImportant>:
movl   $0x1,-0x4(%rsp)
mov    -0x4(%rsp),%edx
jmp    1030 <print_internal@plt>

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

LLVM IR (-O2):
define void @Terminal_PrintImportant(i8* %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store volatile i32 1, i32* %3
%5 = load volatile i32, i32* %3
%6 = tail call i32 @print_internal(i8* %0, i32 %1, i32 %5)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
int /*<<< orphan*/ __be_u16(void *);
int16_t __be_s16(void *p) { return (int16_t)__be_u16(p); }


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

x86 assembly (clang, -O2):
<__be_s16>:
jmp    1030 <__be_u16@plt>

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

LLVM IR (-O2):
define i32 @__be_s16(i8* %0) {
%2 = tail call i32 @__be_u16(i8* %0)
ret i32 %2
}
int addDigits(int num) {
  if (num == 0)
    return 0;
  if (num % 9 == 0)
    return 9;
  return num % 9;
}


x86 assembly (clang, -O0):
<addDigits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111d <addDigits+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    114b <addDigits+0x4b>
mov    -0x8(%rbp),%eax
mov    $0x9,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    113d <addDigits+0x3d>
movl   $0x9,-0x4(%rbp)
jmp    114b <addDigits+0x4b>
mov    -0x8(%rbp),%eax
mov    $0x9,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<addDigits>:
test   %edi,%edi
je     1129 <addDigits+0x29>
movslq %edi,%rax
imul   $0x38e38e39,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
lea    (%rax,%rax,8),%eax
sub    %eax,%edi
mov    $0x9,%eax
cmovne %edi,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @addDigits(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %15
7: ; preds = %1
%8 = load i32, i32* %3
%9 = srem i32 %8, 9
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 9, i32* %2
br label %15
12: ; preds = %7
%13 = load i32, i32* %3
%14 = srem i32 %13, 9
store i32 %14, i32* %2
br label %15
15: ; preds = %12, %11, %6
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @addDigits(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = srem i32 %0, 9
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 9, i32 %4
br label %7
7: ; preds = %3, %1
%8 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %8
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int x;
};
typedef TYPE_1__ XKeyReleasedEvent;

/* Variables and functions */
void set_XKeyReleasedEvent_x(void *_p, int _v) {
  ((XKeyReleasedEvent *)_p)->x = (int)_v;
}


x86 assembly (clang, -O0):
<set_XKeyReleasedEvent_x>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XKeyReleasedEvent_x>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XKeyReleasedEvent_x(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XKeyReleasedEvent_x(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
unsigned char f(unsigned n) {
  static const unsigned char table[64] = {
      0,  0, 0, 9,  0, 0,  10, 1,  0,  0,  0,  0,  0,  11, 2,  21,
      7,  0, 0, 0,  0, 0,  0,  15, 0,  0,  12, 0,  17, 3,  22, 27,
      32, 8, 0, 0,  0, 0,  0,  20, 6,  0,  0,  14, 0,  0,  16, 26,
      31, 0, 0, 19, 5, 13, 0,  25, 30, 18, 4,  24, 29, 23, 28, 0};
  return table[((n & -n) * 0x1d0d73df) >> 26];
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    %ecx,%ecx
sub    -0x4(%rbp),%ecx
and    %ecx,%eax
imul   $0x1d0d73df,%eax,%eax
shr    $0x1a,%eax
mov    %eax,%eax
mov    %eax,%ecx
lea    0xedb(%rip),%rax
movzbl (%rax,%rcx,1),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
mov    %edi,%eax
neg    %eax
and    %edi,%eax
imul   $0x1d0d73df,%eax,%eax
shr    $0x1a,%rax
lea    0xee9(%rip),%rcx
mov    (%rax,%rcx,1),%al
ret

LLVM IR (-O0):
@f.table = internal constant [64 x i8] c"\00\00\00\09\00\00\0A\01\00\00\00\00\00\0B\02\15\07\00\00\00\00\00\00\0F\00\00\0C\00\11\03\16\1B \08\00\00\00\00\00\14\06\00\00\0E\00\00\10\1A\1F\00\00\13\05\0D\00\19\1E\12\04\18\1D\17\1C\00"
define zeroext i8 @f(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = sub i32 0, %4
%6 = and i32 %3, %5
%7 = mul i32 %6, 487420895
%8 = lshr i32 %7, 26
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds [64 x i8], [64 x i8]* @f.table, i64 0, i64 %9
%11 = load i8, i8* %10
ret i8 %11
}

LLVM IR (-O2):
@f.table = internal unnamed_addr constant [64 x i8] c"\00\00\00\09\00\00\0A\01\00\00\00\00\00\0B\02\15\07\00\00\00\00\00\00\0F\00\00\0C\00\11\03\16\1B \08\00\00\00\00\00\14\06\00\00\0E\00\00\10\1A\1F\00\00\13\05\0D\00\19\1E\12\04\18\1D\17\1C\00"
define zeroext i8 @f(i32 %0) {
%2 = sub i32 0, %0
%3 = and i32 %2, %0
%4 = mul i32 %3, 487420895
%5 = lshr i32 %4, 26
%6 = zext i32 %5 to i64
%7 = getelementptr inbounds [64 x i8], [64 x i8]* @f.table, i64 0, i64 %6
%8 = load i8, i8* %7
ret i8 %8
}
/* Variables and functions */
int /*<<< orphan*/ Tut_ErrorExit(char *);
void *malloc(size_t);
void *Tut_Malloc(size_t size) {
  void *mem = malloc(size);
  if (!mem)
    Tut_ErrorExit("Out of memory!\n");
  return mem;
}


x86 assembly (clang, -O0):
<Tut_Malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1150 <Tut_Malloc+0x30>
lea    0xeb5(%rip),%rdi
call   1030 <Tut_ErrorExit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Tut_Malloc>:
push   %rbx
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <Tut_Malloc+0x1a>
lea    0xecb(%rip),%rdi
call   1030 <Tut_ErrorExit@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Out of memory!\0A\00"
define i8* @Tut_Malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 @Tut_ErrorExit(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@.str = [16 x i8] c"Out of memory!\0A\00"
define noalias i8* @Tut_Malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @Tut_ErrorExit(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ _HibernateWriteComplete();
void HibernateRTCSet(uint32_t ui32RTCValue) {
  (*((volatile uint32_t *)(0x400FC360))) = 0xA3359554;
  _HibernateWriteComplete();
  (*((volatile uint32_t *)(0x400FC00C))) = ui32RTCValue;
  _HibernateWriteComplete();
  (*((volatile uint32_t *)(0x400FC360))) = 0;
  _HibernateWriteComplete();
}


x86 assembly (clang, -O0):
<HibernateRTCSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x400fc360,%eax
movl   $0xa3359554,(%rax)
mov    $0x0,%al
call   1030 <_HibernateWriteComplete@plt>
mov    -0x4(%rbp),%ecx
mov    $0x400fc00c,%eax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1030 <_HibernateWriteComplete@plt>
mov    $0x400fc360,%eax
movl   $0x0,(%rax)
mov    $0x0,%al
call   1030 <_HibernateWriteComplete@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HibernateRTCSet>:
push   %rbx
mov    %edi,%ebx
movl   $0xa3359554,0x400fc360
54 95 35 a3
xor    %eax,%eax
call   1030 <_HibernateWriteComplete@plt>
mov    %ebx,0x400fc00c
xor    %eax,%eax
call   1030 <_HibernateWriteComplete@plt>
movl   $0x0,0x400fc360
xor    %eax,%eax
pop    %rbx
jmp    1030 <_HibernateWriteComplete@plt>

LLVM IR (-O0):
define void @HibernateRTCSet(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
store volatile i32 -1556769452, i32* inttoptr (i64 1074774880 to i32*)
%3 = call i32 (...) @_HibernateWriteComplete()
%4 = load i32, i32* %2
store volatile i32 %4, i32* inttoptr (i64 1074774028 to i32*)
%5 = call i32 (...) @_HibernateWriteComplete()
store volatile i32 0, i32* inttoptr (i64 1074774880 to i32*)
%6 = call i32 (...) @_HibernateWriteComplete()
ret void
}

LLVM IR (-O2):
define void @HibernateRTCSet(i32 %0) {
store volatile i32 -1556769452, i32* inttoptr (i64 1074774880 to i32*)
%2 = tail call i32 (...) @_HibernateWriteComplete()
store volatile i32 %0, i32* inttoptr (i64 1074774028 to i32*)
%3 = tail call i32 (...) @_HibernateWriteComplete()
store volatile i32 0, i32* inttoptr (i64 1074774880 to i32*)
%4 = tail call i32 (...) @_HibernateWriteComplete()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ *xmalloc(int);
uint64_t *uint642ptr(uint64_t val) {
  uint64_t *ptr = xmalloc(sizeof(uint64_t));
  *ptr = val;
  return ptr;
}


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

x86 assembly (clang, -O2):
<uint642ptr>:
push   %rbx
mov    %edi,%ebx
mov    $0x4,%edi
call   1030 <xmalloc@plt>
mov    %ebx,(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define i32* @uint642ptr(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = call i32* @xmalloc(i32 4)
store i32* %4, i32** %3
%5 = load i32, i32* %2
%6 = load i32*, i32** %3
store i32 %5, i32* %6
%7 = load i32*, i32** %3
ret i32* %7
}

LLVM IR (-O2):
define i32* @uint642ptr(i32 %0) {
%2 = tail call i32* @xmalloc(i32 4)
store i32 %0, i32* %2
ret i32* %2
}
/* Variables and functions */
int memcmp(void const *, void const *, size_t);
int byte_diff(const void *a, size_t len, const void *b) {
  return memcmp(a, b, len);
}


x86 assembly (clang, -O0):
<byte_diff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <memcmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<byte_diff>:
mov    %rsi,%rax
mov    %rdx,%rsi
mov    %rax,%rdx
jmp    1030 <memcmp@plt>

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

LLVM IR (-O2):
define i32 @byte_diff(i8* nocapture %0, i64 %1, i8* nocapture %2) {
%4 = tail call i32 @memcmp(i8* %0, i8* %2, i64 %1)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
int /*<<< orphan*/ printchar(char *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char word[100];
  int i = 0;
  scanf("%s", word);
  printchar(word, i);
  printf("\n");
  print(word);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x74(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xe9c(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x70(%rbp),%rdi
mov    -0x74(%rbp),%esi
call   1030 <printchar@plt>
lea    0xe87(%rip),%rdi
call   1040 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1050 <print@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
lea    0xeb4(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printchar@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %rbx,%rdi
call   1050 <print@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\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 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @printchar(i8* %2, i32 0)
%5 = call i32 @putchar(i32 10)
%6 = call i32 @print(i8* %2)
ret i32 0
}
/* Type definitions */
struct Queen {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct Queen *);
int destroy_queen(struct Queen *queen) {
  int destroyed = 0;
  if (queen != NULL) {
    free(queen);
    destroyed = 1;
  }
  return destroyed;
}


x86 assembly (clang, -O0):
<destroy_queen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     113e <destroy_queen+0x2e>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<destroy_queen>:
test   %rdi,%rdi
je     1125 <destroy_queen+0x15>
push   %rax
call   1030 <free@plt>
mov    $0x1,%eax
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.Queen = type { i32 }
define i32 @destroy_queen(%struct.Queen* %0) {
%2 = alloca %struct.Queen*
%3 = alloca i32
store %struct.Queen* %0, %struct.Queen** %2
store i32 0, i32* %3
%4 = load %struct.Queen*, %struct.Queen** %2
%5 = icmp ne %struct.Queen* %4, null
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load %struct.Queen*, %struct.Queen** %2
%8 = call i32 @free(%struct.Queen* %7)
store i32 1, i32* %3
br label %9
9: ; preds = %6, %1
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
%struct.Queen = type { i32 }
define i32 @destroy_queen(%struct.Queen* %0) {
%2 = icmp eq %struct.Queen* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(%struct.Queen* %0)
br label %5
5: ; preds = %3, %1
%6 = phi i32 [ 1, %3 ], [ 0, %1 ]
ret i32 %6
}
/* Variables and functions */
scalar_t__ malloc(size_t);
int /*<<< orphan*/ nrerror(char *);
int *ivector(int nl, int nh) {
  int *v;
  v = (int *)malloc((size_t)((nh - nl + 1 + 1) * sizeof(int)));
  if (!v)
    nrerror("allocation failure in ivector()");
  return v - nl + 1;
}


x86 assembly (clang, -O0):
<ivector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
add    $0x1,%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x2,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1161 <ivector+0x41>
lea    0xea4(%rip),%rdi
call   1030 <nrerror@plt>
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
add    $0x4,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ivector>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
sub    %edi,%esi
add    $0x2,%esi
movslq %esi,%rdi
shl    $0x2,%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114a <ivector+0x2a>
lea    0xebb(%rip),%rdi
call   1030 <nrerror@plt>
movslq %ebp,%rax
shl    $0x2,%rax
sub    %rax,%rbx
add    $0x4,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"allocation failure in ivector()\00"
define i32* @ivector(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = sub nsw i32 %6, %7
%9 = add nsw i32 %8, 1
%10 = add nsw i32 %9, 1
%11 = sext i32 %10 to i64
%12 = mul i64 %11, 4
%13 = call i64 @malloc(i64 %12)
%14 = inttoptr i64 %13 to i32*
store i32* %14, i32** %5
%15 = load i32*, i32** %5
%16 = icmp ne i32* %15, null
br i1 %16, label %19, label %17
17: ; preds = %2
%18 = call i32 @nrerror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %17, %2
%20 = load i32*, i32** %5
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = sub i64 0, %22
%24 = getelementptr inbounds i32, i32* %20, i64 %23
%25 = getelementptr inbounds i32, i32* %24, i64 1
ret i32* %25
}

LLVM IR (-O2):
@.str = [32 x i8] c"allocation failure in ivector()\00"
define i32* @ivector(i32 %0, i32 %1) {
%3 = sub i32 2, %0
%4 = add i32 %3, %1
%5 = sext i32 %4 to i64
%6 = shl nsw i64 %5, 2
%7 = tail call i64 @malloc(i64 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 @nrerror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
%12 = inttoptr i64 %7 to i32*
%13 = sext i32 %0 to i64
%14 = sub nsw i64 0, %13
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = getelementptr inbounds i32, i32* %15, i64 1
ret i32* %16
}
int do_588() { return 588; }


x86 assembly (clang, -O0):
<do_588>:
push   %rbp
mov    %rsp,%rbp
mov    $0x24c,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_588>:
mov    $0x24c,%eax
ret

LLVM IR (-O0):
define i32 @do_588() {
ret i32 588
}

LLVM IR (-O2):
define i32 @do_588() {
ret i32 588
}
void PDMCritSectGetRecursion(void) {}


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

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

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

LLVM IR (-O2):
define void @PDMCritSectGetRecursion() {
ret void
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int send_event;
};
struct TYPE_4__ {
  TYPE_1__ xcirculate;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void set_XEvent_xcirculate_send_event(void *_p, int _v) {
  ((XEvent *)_p)->xcirculate.send_event = (int)_v;
}


x86 assembly (clang, -O0):
<set_XEvent_xcirculate_send_event>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XEvent_xcirculate_send_event>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32 }
define void @set_XEvent_xcirculate_send_event(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_4__*
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
store i32 %5, i32* %9
ret void
}

LLVM IR (-O2):
define void @set_XEvent_xcirculate_send_event(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Centaurus_write_gpio(int, int, unsigned long);
void Centaurus_Power_Down(void) {
  unsigned long off_data = 0;
  Centaurus_write_gpio(4, 0x00000400 + 0x08, off_data);
  return;
}


x86 assembly (clang, -O0):
<Centaurus_Power_Down>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
mov    $0x4,%edi
mov    $0x408,%esi
call   1030 <Centaurus_write_gpio@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Centaurus_Power_Down>:
mov    $0x4,%edi
mov    $0x408,%esi
xor    %edx,%edx
jmp    1030 <Centaurus_write_gpio@plt>

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

LLVM IR (-O2):
define void @Centaurus_Power_Down() {
%1 = tail call i32 @Centaurus_write_gpio(i32 4, i32 1032, i64 0)
ret void
}
/* Variables and functions */
scalar_t__ json_malloc(size_t);
int /*<<< orphan*/ memmove(char *, char const *, size_t);
char *json_util_copystr(const char *str, size_t size) {
  char *new_str = NULL;
  new_str = (char *)json_malloc(size + 1);
  memmove(new_str, str, size);
  new_str[size] = 0;
  return new_str;
}


x86 assembly (clang, -O0):
<json_util_copystr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1030 <json_malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1040 <memmove@plt>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<json_util_copystr>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
lea    0x1(%rsi),%rdi
call   1030 <json_malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <memmove@plt>
movb   $0x0,(%rbx,%r15,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @json_util_copystr(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
store i8* null, i8** %5
%6 = load i64, i64* %4
%7 = add i64 %6, 1
%8 = call i64 @json_malloc(i64 %7)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = load i8*, i8** %3
%12 = load i64, i64* %4
%13 = call i32 @memmove(i8* %10, i8* %11, i64 %12)
%14 = load i8*, i8** %5
%15 = load i64, i64* %4
%16 = getelementptr inbounds i8, i8* %14, i64 %15
store i8 0, i8* %16
%17 = load i8*, i8** %5
ret i8* %17
}

LLVM IR (-O2):
define i8* @json_util_copystr(i8* %0, i64 %1) {
%3 = add i64 %1, 1
%4 = tail call i64 @json_malloc(i64 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @memmove(i8* %5, i8* %0, i64 %1)
%7 = getelementptr inbounds i8, i8* %5, i64 %1
store i8 0, i8* %7
ret i8* %5
}
/* Variables and functions */
int asm_main();
int main(void) { return asm_main(); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <asm_main@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @asm_main()
ret i32 %1
}
void swapi(int *a, int *b) {
  *a ^= *b;
  *b ^= *a;
  *a ^= *b;
}


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

x86 assembly (clang, -O2):
<swapi>:
mov    (%rdi),%eax
xor    (%rsi),%eax
mov    %eax,(%rdi)
xor    (%rsi),%eax
mov    %eax,(%rsi)
xor    %eax,(%rdi)
ret

LLVM IR (-O0):
define void @swapi(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 = load i32, i32* %5
%7 = load i32*, i32** %3
%8 = load i32, i32* %7
%9 = xor i32 %8, %6
store i32 %9, i32* %7
%10 = load i32*, i32** %3
%11 = load i32, i32* %10
%12 = load i32*, i32** %4
%13 = load i32, i32* %12
%14 = xor i32 %13, %11
store i32 %14, i32* %12
%15 = load i32*, i32** %4
%16 = load i32, i32* %15
%17 = load i32*, i32** %3
%18 = load i32, i32* %17
%19 = xor i32 %18, %16
store i32 %19, i32* %17
ret void
}

LLVM IR (-O2):
define void @swapi(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = load i32, i32* %0
%5 = xor i32 %4, %3
store i32 %5, i32* %0
%6 = load i32, i32* %1
%7 = xor i32 %6, %5
store i32 %7, i32* %1
%8 = load i32, i32* %0
%9 = xor i32 %8, %7
store i32 %9, i32* %0
ret void
}
/* Variables and functions */
int executeSql(char *, int /*<<< orphan*/ *);
int setDbVersion(int);
int upgrade5() {
  int status = setDbVersion(5);
  if (status == 0) {
    return 0;
  }
  status = executeSql("UPDATE data SET hs = '' WHERE hs IS NULL", NULL);
  if (status == 0) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<upgrade5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x5,%edi
call   1040 <setDbVersion@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    114b <upgrade5+0x2b>
movl   $0x0,-0x4(%rbp)
jmp    117b <upgrade5+0x5b>
lea    0xeae(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <executeSql@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1174 <upgrade5+0x54>
movl   $0x0,-0x4(%rbp)
jmp    117b <upgrade5+0x5b>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<upgrade5>:
push   %rax
mov    $0x5,%edi
call   1040 <setDbVersion@plt>
test   %eax,%eax
je     1148 <upgrade5+0x28>
lea    0xeca(%rip),%rdi
xor    %esi,%esi
call   1030 <executeSql@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
setne  %al
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [41 x i8] c"UPDATE data SET hs = '' WHERE hs IS NULL\00"
define i32 @upgrade5() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @setDbVersion(i32 5)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 0, i32* %1
br label %13
7: ; preds = %0
%8 = call i32 @executeSql(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32* null)
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 0, i32* %1
br label %13
12: ; preds = %7
store i32 1, i32* %1
br label %13
13: ; preds = %12, %11, %6
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
@.str = [41 x i8] c"UPDATE data SET hs = '' WHERE hs IS NULL\00"
define i32 @upgrade5() {
%1 = tail call i32 @setDbVersion(i32 5)
%2 = icmp eq i32 %1, 0
br i1 %2, label %7, label %3
3: ; preds = %0
%4 = tail call i32 @executeSql(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32* null)
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %3, %0
%8 = phi i32 [ 0, %0 ], [ %6, %3 ]
ret i32 %8
}
int test_imm_76int64_highword_mem(long long *val) {
  return ((*val >> 32) & (0x76 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_76int64_highword_mem>:
testb  $0x76,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_76int64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 32
%6 = and i64 %5, 118
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_76int64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 506806140928
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
char *basename(char const *);
int /*<<< orphan*/ printf(char *, char *, char *);
void version(const char *cmd) {
  printf("%s version %s\n", basename(cmd), "0.4-rc1");
}


x86 assembly (clang, -O0):
<version>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <basename@plt>
mov    %rax,%rsi
lea    0xec1(%rip),%rdi
lea    0xec9(%rip),%rdx
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<version>:
push   %rax
call   1040 <basename@plt>
lea    0xed3(%rip),%rdi
lea    0xedb(%rip),%rdx
mov    %rax,%rsi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"%s version %s\0A\00"
@.str.1 = [8 x i8] c"0.4-rc1\00"
define void @version(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @basename(i8* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%s version %s\0A\00"
@.str.1 = [8 x i8] c"0.4-rc1\00"
define void @version(i8* %0) {
%2 = tail call i8* @basename(i8* %0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
struct pci_dev {
  int dummy;
};

/* Variables and functions */
struct pci_dev *pci_get_domain_bus_and_slot(int /*<<< orphan*/, unsigned int,
                                            unsigned int);
__attribute__((always_)) struct pci_dev *
pci_get_bus_and_slot(unsigned int bus, unsigned int devfn) {
  return pci_get_domain_bus_and_slot(0, bus, devfn);
}


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

x86 assembly (clang, -O2):
<pci_get_bus_and_slot>:
mov    %esi,%edx
mov    %edi,%esi
xor    %edi,%edi
jmp    1030 <pci_get_domain_bus_and_slot@plt>

LLVM IR (-O0):
%struct.pci_dev = type { i32 }
define %struct.pci_dev* @pci_get_bus_and_slot(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 = call %struct.pci_dev* @pci_get_domain_bus_and_slot(i32 0, i32 %5, i32 %6)
ret %struct.pci_dev* %7
}

LLVM IR (-O2):
%struct.pci_dev = type { i32 }
define %struct.pci_dev* @pci_get_bus_and_slot(i32 %0, i32 %1) {
%3 = tail call %struct.pci_dev* @pci_get_domain_bus_and_slot(i32 0, i32 %0, i32 %1)
ret %struct.pci_dev* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void vlsi_ampli(uint8_t on) {}


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

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

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

LLVM IR (-O2):
define void @vlsi_ampli(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ popNarray(char *, unsigned int);
void popcomplex4array(char *x, int n) {
  popNarray((char *)x, (unsigned int)(n * 4));
}


x86 assembly (clang, -O0):
<popcomplex4array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
shl    $0x2,%esi
call   1030 <popNarray@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<popcomplex4array>:
shl    $0x2,%esi
jmp    1030 <popNarray@plt>

LLVM IR (-O0):
define void @popcomplex4array(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = mul nsw i32 %6, 4
%8 = call i32 @popNarray(i8* %5, i32 %7)
ret void
}

LLVM IR (-O2):
define void @popcomplex4array(i8* %0, i32 %1) {
%3 = shl nsw i32 %1, 2
%4 = tail call i32 @popNarray(i8* %0, i32 %3)
ret void
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *, int /*<<< orphan*/);
int write_quaddobl_start_system(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc(244, a, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<write_quaddobl_start_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0xf4,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_quaddobl_start_system>:
mov    $0xf4,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc@plt>

LLVM IR (-O0):
define i32 @write_quaddobl_start_system() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc(i32 244, i32* %5, i32* %6, double* %7, i32 0)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @write_quaddobl_start_system() {
%1 = tail call i32 @_ada_use_c2phc(i32 244, i32* undef, i32* undef, double* undef, i32 0)
ret i32 %1
}
range(a, b) {
  if (a > b)
    printf("%d", b);
  if (a <= b)
    printf("%d", a);
  if (a < b)
    printf(",%d", b);
}


x86 assembly (clang, -O0):
<range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    113b <range+0x2b>
mov    -0xc(%rbp),%esi
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1158 <range+0x48>
mov    -0x8(%rbp),%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1175 <range+0x65>
mov    -0xc(%rbp),%esi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<range>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
cmp    %esi,%edi
mov    %edi,%esi
cmovg  %ebx,%esi
lea    0xedc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    %ebx,%ebp
jge    1140 <range+0x30>
lea    0xec9(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c",%d\00"
define i32 @range(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
%7 = load i32, i32* %5
%8 = icmp sgt i32 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i32, i32* %5
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %9, %2
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = icmp sle i32 %13, %14
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = load i32, i32* %4
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %16, %12
%20 = load i32, i32* %4
%21 = load i32, i32* %5
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load i32, i32* %5
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %23, %19
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c",%d\00"
define i32 @range(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = icmp slt i32 %0, %1
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %1)
br label %9
9: ; preds = %7, %2
ret i32 undef
}
int c(int i) { return i * i; }


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

x86 assembly (clang, -O2):
<c>:
mov    %edi,%eax
imul   %edi,%eax
ret

LLVM IR (-O0):
define i32 @c(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = mul nsw i32 %3, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @c(i32 %0) {
%2 = mul nsw i32 %0, %0
ret i32 %2
}