xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ t();
void __attribute__((__no__)) function_definition(void) { t(); }


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

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

LLVM IR (-O0):
define void @function_definition() {
%1 = call i32 (...) @t()
ret void
}

LLVM IR (-O2):
define void @function_definition() {
%1 = tail call i32 (...) @t()
ret void
}
unsigned char implicitcast_0(unsigned int x) { return x; }


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

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

LLVM IR (-O0):
define zeroext i8 @implicitcast_0(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = trunc i32 %3 to i8
ret i8 %4
}

LLVM IR (-O2):
define zeroext i8 @implicitcast_0(i32 %0) {
%2 = trunc i32 %0 to i8
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, void *, char const *,
                           char const *, int);
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ stderr;
void debug_free(void *ptr, const char *file, int line, const char *function) {
  fprintf(stderr, "free(0x%p) (%s:%s:%d)\n", ptr, file, function, line);
  free(ptr);
}


x86 assembly (clang, -O0):
<debug_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x14(%rbp),%r9d
lea    0xea9(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<debug_free>:
push   %rbx
mov    %rcx,%r8
mov    %edx,%r9d
mov    %rsi,%rcx
mov    %rdi,%rbx
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
lea    0xec3(%rip),%rsi
mov    %rbx,%rdx
call   1040 <fprintf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"free(0x%p) (%s:%s:%d)\0A\00"
define void @debug_free(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = load i8*, i8** %8
%13 = load i32, i32* %7
%14 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %11, i8* %12, i32 %13)
%15 = load i8*, i8** %5
%16 = call i32 @free(i8* %15)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"free(0x%p) (%s:%s:%d)\0A\00"
define void @debug_free(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i8* %3, i32 %2)
%7 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int open_file(char *);
int sys_open(char *dir_file) { return open_file(dir_file); }


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

x86 assembly (clang, -O2):
<sys_open>:
jmp    1030 <open_file@plt>

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

LLVM IR (-O2):
define i32 @sys_open(i8* %0) {
%2 = tail call i32 @open_file(i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ bzero(void *, size_t);
void explicit_bzero(void *p, size_t n) { bzero(p, n); }


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

x86 assembly (clang, -O2):
<explicit_bzero>:
jmp    1030 <bzero@plt>

LLVM IR (-O0):
define void @explicit_bzero(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i32 @bzero(i8* %5, i64 %6)
ret void
}

LLVM IR (-O2):
define void @explicit_bzero(i8* nocapture writeonly %0, i64 %1) {
%3 = tail call i32 @bzero(i8* %0, i64 %1)
ret void
}
int strcmp(const char *s1, const char *s2) {
  while (*s1++ == *s2++)
    if (s1[-1] == '\0')
      return (0);
  return ((int)((unsigned char)s1[-1] - (unsigned char)s2[-1]));
}


x86 assembly (clang, -O0):
<strcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    115a <strcmp+0x5a>
mov    -0x10(%rbp),%rax
movsbl -0x1(%rax),%eax
cmp    $0x0,%eax
jne    1155 <strcmp+0x55>
movl   $0x0,-0x4(%rbp)
jmp    116f <strcmp+0x6f>
jmp    110c <strcmp+0xc>
mov    -0x10(%rbp),%rax
movzbl -0x1(%rax),%eax
mov    -0x18(%rbp),%rcx
movzbl -0x1(%rcx),%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmp>:
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rdi,%rcx,1),%eax
movzbl (%rsi,%rcx,1),%edx
cmp    %dl,%al
jne    1127 <strcmp+0x27>
add    $0x1,%rcx
test   %eax,%eax
jne    1110 <strcmp+0x10>
xor    %eax,%eax
ret
sub    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @strcmp(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %9, %2
%4 = phi i8* [ %0, %2 ], [ %10, %9 ]
%5 = phi i8* [ %1, %2 ], [ %11, %9 ]
%6 = load i8, i8* %4
%7 = load i8, i8* %5
%8 = icmp eq i8 %6, %7
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = getelementptr inbounds i8, i8* %4, i64 1
%11 = getelementptr inbounds i8, i8* %5, i64 1
%12 = icmp eq i8 %6, 0
br i1 %12, label %17, label %3
13: ; preds = %3
%14 = zext i8 %6 to i32
%15 = zext i8 %7 to i32
%16 = sub nsw i32 %14, %15
br label %17
17: ; preds = %9, %13
%18 = phi i32 [ %16, %13 ], [ 0, %9 ]
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *strstr(char *, char *);
void strstrTest() {
  char str[] = "This is a simple string";
  char *pch;
  pch = strstr(str, "simple");
  strncpy(pch, "sample", 6);
  puts(str);
}


x86 assembly (clang, -O0):
<strstrTest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xec1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xebe(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xebb(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
lea    0xeb4(%rip),%rsi
call   1050 <strstr@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xea7(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncpy@plt>
lea    -0x20(%rbp),%rdi
call   1040 <puts@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strstrTest>:
push   %rbx
sub    $0x20,%rsp
movaps 0xec4(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x676e6972747320,%rax
mov    %rax,0x10(%rsp)
lea    0xec2(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <strstr@plt>
lea    0xeb7(%rip),%rsi
mov    %rax,%rdi
mov    $0x6,%edx
call   1030 <strncpy@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.strstrTest.str = [24 x i8] c"This is a simple string\00"
@.str = [7 x i8] c"simple\00"
@.str.1 = [7 x i8] c"sample\00"
define void @strstrTest() {
%1 = alloca [24 x i8]
%2 = alloca i8*
%3 = bitcast [24 x i8]* %1 to i8*
%4 = getelementptr inbounds [24 x i8], [24 x i8]* %1, i64 0, i64 0
%5 = call i8* @strstr(i8* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @strncpy(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
%8 = getelementptr inbounds [24 x i8], [24 x i8]* %1, i64 0, i64 0
%9 = call i32 @puts(i8* %8)
ret void
}

LLVM IR (-O2):
@__const.strstrTest.str = [24 x i8] c"This is a simple string\00"
@.str = [7 x i8] c"simple\00"
@.str.1 = [7 x i8] c"sample\00"
define void @strstrTest() {
%1 = alloca [24 x i8]
%2 = getelementptr inbounds [24 x i8], [24 x i8]* %1, i64 0, i64 0
%3 = call i8* @strstr(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @strncpy(i8* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
%5 = call i32 @puts(i8* %2)
ret void
}
/* Variables and functions */
scalar_t__ config_WITH_CARDREADER();
int config_CARDREADER_MP35(void) { return config_WITH_CARDREADER() ? 1 : 0; }


x86 assembly (clang, -O0):
<config_CARDREADER_MP35>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <config_WITH_CARDREADER@plt>
mov    %rax,%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_CARDREADER_MP35>:
push   %rax
xor    %eax,%eax
call   1030 <config_WITH_CARDREADER@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @config_CARDREADER_MP35() {
%1 = call i64 (...) @config_WITH_CARDREADER()
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i64
%4 = select i1 %2, i32 1, i32 0
ret i32 %4
}

LLVM IR (-O2):
define i32 @config_CARDREADER_MP35() {
%1 = tail call i64 (...) @config_WITH_CARDREADER()
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double, double);
int /*<<< orphan*/ scanf(char *, double *);
int main() {
  double r;
  double Pi = 3.14;
  scanf("%lf", &r);
  double perimeter = 2 * Pi * r;
  double area = Pi * r * r;
  printf("Perimeter: %.2lf\nArea: %.2f\n", perimeter, area);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed1(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    0xecd(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movsd  0xeac(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
movsd  (%rsp),%xmm2
movsd  0xec3(%rip),%xmm0
mulsd  %xmm2,%xmm0
movsd  0xebf(%rip),%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [29 x i8] c"Perimeter: %.2lf\0AArea: %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
store double 3.140000e+00, double* %3
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %2)
%7 = load double, double* %3
%8 = fmul double 2.000000e+00, %7
%9 = load double, double* %2
%10 = fmul double %8, %9
store double %10, double* %4
%11 = load double, double* %3
%12 = load double, double* %2
%13 = fmul double %11, %12
%14 = load double, double* %2
%15 = fmul double %13, %14
store double %15, double* %5
%16 = load double, double* %4
%17 = load double, double* %5
%18 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), double %16, double %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [29 x i8] c"Perimeter: %.2lf\0AArea: %.2f\0A\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%4 = load double, double* %1
%5 = fmul double %4, 6.280000e+00
%6 = fmul double %4, 3.140000e+00
%7 = fmul double %4, %6
%8 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), double %5, double %7)
ret i32 0
}
void f(int g_, int i_, int h_) {
  _Noreturn void abort(void);
  if (g_ != -5)
    abort();
  if (h_ != -72)
    abort();
  if (i_ != 1)
    abort();
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0xfffffffb,-0x4(%rbp)
je     1130 <f+0x20>
call   1030 <abort@plt>
cmpl   $0xffffffb8,-0xc(%rbp)
je     113f <f+0x2f>
call   1030 <abort@plt>
cmpl   $0x1,-0x8(%rbp)
je     114e <f+0x3e>
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rax
cmp    $0xfffffffb,%edi
jne    1122 <f+0x12>
cmp    $0xffffffb8,%edx
jne    1122 <f+0x12>
cmp    $0x1,%esi
jne    1122 <f+0x12>
pop    %rax
ret
call   1030 <abort@plt>

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

LLVM IR (-O2):
define void @f(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, -5
br i1 %4, label %6, label %5
5: ; preds = %3
tail call void @abort()
unreachable
6: ; preds = %3
%7 = icmp eq i32 %2, -72
br i1 %7, label %9, label %8
8: ; preds = %6
tail call void @abort()
unreachable
9: ; preds = %6
%10 = icmp eq i32 %1, 1
br i1 %10, label %12, label %11
11: ; preds = %9
tail call void @abort()
unreachable
12: ; preds = %9
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void error(char *x) {
  puts("\n\n");
  puts(x);
  puts("\n\n -- System halted");
  while (1)
    ;
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
mov    -0x8(%rbp),%rdi
call   1030 <puts@plt>
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
jmp    113d <error+0x2d>

x86 assembly (clang, -O2):
<error>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
jmp    1140 <error+0x30>

LLVM IR (-O0):
@.str = [3 x i8] c"\0A\0A\00"
@.str.1 = [20 x i8] c"\0A\0A -- System halted\00"
define void @error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @puts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 @puts(i8* %4)
%6 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %1, %7
br label %7
}

LLVM IR (-O2):
@.str = [3 x i8] c"\0A\0A\00"
@.str.1 = [20 x i8] c"\0A\0A -- System halted\00"
define void @error(i8* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) %0)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %5
5: ; preds = %1, %5
br label %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
const uint8_t *gap_event_advertising_report_get_data(const uint8_t *event) {
  return &event[12];
}


x86 assembly (clang, -O0):
<gap_event_advertising_report_get_data>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gap_event_advertising_report_get_data>:
lea    0x30(%rdi),%rax
ret

LLVM IR (-O0):
define i32* @gap_event_advertising_report_get_data(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 12
ret i32* %4
}

LLVM IR (-O2):
define i32* @gap_event_advertising_report_get_data(i32* readnone %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 12
ret i32* %2
}
int test_imm_7Auint8_mem(unsigned char *val) {
  return ((*val) & (-0x7A << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_7Auint8_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, -122
%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_7Auint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -122
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
unsigned int jzrtc_readl(int);
int /*<<< orphan*/ jzrtc_writel(int, unsigned int);
void jzrtc_setl(int offset, unsigned int value) {
  jzrtc_writel(offset, jzrtc_readl(offset) | (value));
}


x86 assembly (clang, -O0):
<jzrtc_setl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <jzrtc_readl@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%esi
or     -0x8(%rbp),%esi
call   1040 <jzrtc_writel@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jzrtc_setl>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <jzrtc_readl@plt>
or     %eax,%ebx
mov    %ebp,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <jzrtc_writel@plt>

LLVM IR (-O0):
define void @jzrtc_setl(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* %3
%7 = call i32 @jzrtc_readl(i32 %6)
%8 = load i32, i32* %4
%9 = or i32 %7, %8
%10 = call i32 @jzrtc_writel(i32 %5, i32 %9)
ret void
}

LLVM IR (-O2):
define void @jzrtc_setl(i32 %0, i32 %1) {
%3 = tail call i32 @jzrtc_readl(i32 %0)
%4 = or i32 %3, %1
%5 = tail call i32 @jzrtc_writel(i32 %0, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ chdir(char *);
int /*<<< orphan*/ system(char *);
int main() {
  chdir("/mnt/browser/usb/javascript");
  system("sh install.sh");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <chdir@plt>
lea    0xee5(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <chdir@plt>
lea    0xee8(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"/mnt/browser/usb/javascript\00"
@.str.1 = [14 x i8] c"sh install.sh\00"
define i32 @main() {
%1 = call i32 @chdir(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"/mnt/browser/usb/javascript\00"
@.str.1 = [14 x i8] c"sh install.sh\00"
define i32 @main() {
%1 = tail call i32 @chdir(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
long absl(i)
long i;
{ return i >= 0 ? i : -i; }


x86 assembly (clang, -O0):
<absl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jl     1120 <absl+0x20>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    112a <absl+0x2a>
xor    %eax,%eax
sub    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<absl>:
mov    %rdi,%rax
neg    %rax
cmovs  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @absl(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp sge i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = load i64, i64* %2
br label %10
7: ; preds = %1
%8 = load i64, i64* %2
%9 = sub nsw i64 0, %8
br label %10
10: ; preds = %7, %5
%11 = phi i64 [ %6, %5 ], [ %9, %7 ]
ret i64 %11
}

LLVM IR (-O2):
define i64 @absl(i64 %0) {
%2 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ Direct(int);
int /*<<< orphan*/ TSB8(int /*<<< orphan*/);
void Op04M1(void) { TSB8(Direct(3)); }


x86 assembly (clang, -O0):
<Op04M1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
call   1040 <Direct@plt>
mov    %eax,%edi
call   1030 <TSB8@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Op04M1>:
push   %rax
mov    $0x3,%edi
call   1040 <Direct@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <TSB8@plt>

LLVM IR (-O0):
define void @Op04M1() {
%1 = call i32 @Direct(i32 3)
%2 = call i32 @TSB8(i32 %1)
ret void
}

LLVM IR (-O2):
define void @Op04M1() {
%1 = tail call i32 @Direct(i32 3)
%2 = tail call i32 @TSB8(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __set_heaptop(char *);
char *_sbrk(int adj) {
  extern char end;
  static char *heap = &end;
  char *rv = heap;
  heap += adj;
  __set_heaptop(heap);
  return rv;
}


x86 assembly (clang, -O0):
<_sbrk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2f06(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
mov    0x2ef8(%rip),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,0x2eeb(%rip)
mov    0x2ee4(%rip),%rdi
call   1030 <__set_heaptop@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_sbrk>:
push   %rbx
mov    0x2f10(%rip),%rbx
movslq %edi,%rdi
add    %rbx,%rdi
mov    %rdi,0x2f03(%rip)
call   1030 <__set_heaptop@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@_sbrk.heap = internal global i8* @end
@end = external global i8
define i8* @_sbrk(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i8*, i8** @_sbrk.heap
store i8* %4, i8** %3
%5 = load i32, i32* %2
%6 = load i8*, i8** @_sbrk.heap
%7 = sext i32 %5 to i64
%8 = getelementptr inbounds i8, i8* %6, i64 %7
store i8* %8, i8** @_sbrk.heap
%9 = load i8*, i8** @_sbrk.heap
%10 = call i32 @__set_heaptop(i8* %9)
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@_sbrk.heap = internal unnamed_addr global i8* @end
@end = external global i8
define i8* @_sbrk(i32 %0) {
%2 = load i8*, i8** @_sbrk.heap
%3 = sext i32 %0 to i64
%4 = getelementptr inbounds i8, i8* %2, i64 %3
store i8* %4, i8** @_sbrk.heap
%5 = tail call i32 @__set_heaptop(i8* %4)
ret i8* %2
}
void I2CSlaveIntClearEx(unsigned long ulBase, unsigned long ulIntFlags) {
  ;
  (*((volatile unsigned long *)(ulBase + 0x00000018))) = ulIntFlags;
}


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

x86 assembly (clang, -O2):
<I2CSlaveIntClearEx>:
mov    %rsi,0x18(%rdi)
ret

LLVM IR (-O0):
define void @I2CSlaveIntClearEx(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i64, i64* %3
%7 = add i64 %6, 24
%8 = inttoptr i64 %7 to i64*
store volatile i64 %5, i64* %8
ret void
}

LLVM IR (-O2):
define void @I2CSlaveIntClearEx(i64 %0, i64 %1) {
%3 = add i64 %0, 24
%4 = inttoptr i64 %3 to i64*
store volatile i64 %1, i64* %4
ret void
}
/* Variables and functions */
unsigned long long rdtsc();
int /*<<< orphan*/ usleep(int);
unsigned long long calibrate_loop(void) {
  unsigned long long mytime1, mytime2;
  mytime1 = rdtsc();
  usleep(500000);
  mytime2 = rdtsc();
  return (mytime2 - mytime1) * 2;
}


x86 assembly (clang, -O0):
<calibrate_loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rdtsc@plt>
mov    %rax,-0x8(%rbp)
mov    $0x7a120,%edi
call   1040 <usleep@plt>
mov    $0x0,%al
call   1030 <rdtsc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
sub    -0x8(%rbp),%rax
shl    $0x1,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calibrate_loop>:
push   %rbx
xor    %eax,%eax
call   1030 <rdtsc@plt>
mov    %rax,%rbx
mov    $0x7a120,%edi
call   1040 <usleep@plt>
xor    %eax,%eax
call   1030 <rdtsc@plt>
sub    %rbx,%rax
add    %rax,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @calibrate_loop() {
%1 = alloca i64
%2 = alloca i64
%3 = call i64 (...) @rdtsc()
store i64 %3, i64* %1
%4 = call i32 @usleep(i32 500000)
%5 = call i64 (...) @rdtsc()
store i64 %5, i64* %2
%6 = load i64, i64* %2
%7 = load i64, i64* %1
%8 = sub i64 %6, %7
%9 = mul i64 %8, 2
ret i64 %9
}

LLVM IR (-O2):
define i64 @calibrate_loop() {
%1 = tail call i64 (...) @rdtsc()
%2 = tail call i32 @usleep(i32 500000)
%3 = tail call i64 (...) @rdtsc()
%4 = sub i64 %3, %1
%5 = shl i64 %4, 1
ret i64 %5
}
void f(void) {
  unsigned int x0 = 0x9423U;
  unsigned long int x1 = 0x9423UL;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movl   $0x9423,-0x4(%rbp)
movq   $0x9423,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f() {
%1 = alloca i32
%2 = alloca i64
store i32 37923, i32* %1
store i64 37923, i64* %2
ret void
}

LLVM IR (-O2):
define void @f() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ asprintf(char **, char *, char *, char *);
char *strdup(char *);
char *concat_pathname_elements(char *pathname, char *filename) {
  char *filepathname = strdup(pathname);
  asprintf(&filepathname, "%s/%s", filepathname, filename);
  return filepathname;
}


x86 assembly (clang, -O0):
<concat_pathname_elements>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    -0x18(%rbp),%rdi
lea    0xeb0(%rip),%rsi
call   1030 <asprintf@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<concat_pathname_elements>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
call   1040 <strdup@plt>
mov    %rax,0x8(%rsp)
lea    0xec7(%rip),%rsi
lea    0x8(%rsp),%rdi
mov    %rax,%rdx
mov    %rbx,%rcx
call   1030 <asprintf@plt>
mov    0x8(%rsp),%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s/%s\00"
define i8* @concat_pathname_elements(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 = call i8* @strdup(i8* %6)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = load i8*, i8** %4
%10 = call i32 @asprintf(i8** %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9)
%11 = load i8*, i8** %5
ret i8* %11
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s/%s\00"
define i8* @concat_pathname_elements(i8* nocapture %0, i8* %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = tail call i8* @strdup(i8* %0)
store i8* %5, i8** %3
%6 = call i32 @asprintf(i8** %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %1)
%7 = load i8*, i8** %3
ret i8* %7
}
/* Variables and functions */
int func();
int main(void) { return func(); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @func()
ret i32 %1
}
void SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter(void *self) {
  xlogf("%s(self = %p)\n", __func__, self);
}


x86 assembly (clang, -O0):
<SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
lea    0xed9(%rip),%rdi
lea    0xee1(%rip),%rsi
mov    $0x0,%al
call   1030 <xlogf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
lea    0xeee(%rip),%rsi
xor    %eax,%eax
jmp    1030 <xlogf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"%s(self = %p)\0A\00"
@__func__.SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter = [61 x i8] c"SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter\00"
define void @SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([61 x i8], [61 x i8]* @__func__.SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%s(self = %p)\0A\00"
@__func__.SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter = [61 x i8] c"SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter\00"
define void @SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter(i8* %0) {
%2 = tail call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([61 x i8], [61 x i8]* @__func__.SteamAPI_ISteamMatchmaking_AddRequestLobbyListDistanceFilter, i64 0, i64 0), i8* %0)
ret void
}
void ble_rsp_gap_set_privacy_flags(const void *nul) {}


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

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

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

LLVM IR (-O2):
define void @ble_rsp_gap_set_privacy_flags(i8* nocapture %0) {
ret void
}
int max17058_calc_rcomp(unsigned int batt_temp) {}


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

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

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

LLVM IR (-O2):
define i32 @max17058_calc_rcomp(i32 %0) {
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ bswap32(int /*<<< orphan*/);
uint32_t be32_to_cpu(uint32_t v) { return bswap32(v); }


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

x86 assembly (clang, -O2):
<be32_to_cpu>:
jmp    1030 <bswap32@plt>

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

LLVM IR (-O2):
define i32 @be32_to_cpu(i32 %0) {
%2 = tail call i32 @bswap32(i32 %0)
ret i32 %2
}
int test_imm_99uint64_lowword_reg(unsigned long long val) {
  return ((val) & (0x99 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_99uint64_lowword_reg>:
test   $0x99,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_99uint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 153
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int test_1(int, int, int);
int main() { return test_1(16, 16, 32); }


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

x86 assembly (clang, -O2):
<main>:
mov    $0x10,%edi
mov    $0x10,%esi
mov    $0x20,%edx
jmp    1030 <test_1@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @test_1(i32 16, i32 16, i32 32)
ret i32 %1
}
void RTHeapSimpleDump(void) {}


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

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

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

LLVM IR (-O2):
define void @RTHeapSimpleDump() {
ret void
}
f(char x) { return sizeof(long[x + 2]); }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x2,%eax
mov    %eax,%eax
shl    $0x3,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
lea    0x10(,%rdi,8),%eax
ret

LLVM IR (-O0):
define i32 @f(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = add nsw i32 %4, 2
%6 = zext i32 %5 to i64
%7 = mul nuw i64 8, %6
%8 = trunc i64 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @f(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = shl nsw i32 %2, 3
%4 = add nsw i32 %3, 16
ret i32 %4
}
void fdputc(char c, int fd) {
  if (write(fd, &c, 1) < 1)
    perror("write"), exit(1);
}


x86 assembly (clang, -O0):
<fdputc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x1(%rbp),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1030 <write@plt>
cmp    $0x1,%eax
jge    1175 <fdputc+0x45>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fdputc>:
push   %rax
mov    %esi,%eax
mov    %dil,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    %eax,%edi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <write@plt>
test   %eax,%eax
jle    1151 <fdputc+0x21>
pop    %rax
ret
lea    0xea8(%rip),%rdi
xor    %eax,%eax
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"write\00"
define void @fdputc(i8 signext %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 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 %5, i8* %3, i32 1)
%7 = icmp slt i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
unreachable
10: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"write\00"
define void @fdputc(i8 signext %0, i32 %1) {
%3 = alloca i8
store i8 %0, i8* %3
%4 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 %1, i8* %3, i32 1)
%5 = icmp slt i32 %4, 1
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
unreachable
8: ; preds = %2
ret void
}
void __attribute__((section(".text.1"))) main(void) {
  asm("main_label: .globl main_label");
  frame2();
}


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

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

LLVM IR (-O0):
define void @main() section ".text.1" {
%1 = call i32 (...) @frame2()
ret void
}

LLVM IR (-O2):
define void @main() section ".text.1" {
tail call void asm sideeffect "main_label: .globl main_label", "~{dirflag},~{fpsr},~{flags}"()
%1 = tail call i32 (...) @frame2()
ret void
}
void bsp_init(void) {}


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

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

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

LLVM IR (-O2):
define void @bsp_init() {
ret void
}
/* Variables and functions */
int analog(int);
int detect_straight(int sensor) {
  int result = -1;
  if (analog(sensor) > 100) {
    result = 1;
  } else {
    result = 0;
  }
  return result;
}


x86 assembly (clang, -O0):
<detect_straight>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <analog@plt>
cmp    $0x64,%eax
jle    113f <detect_straight+0x2f>
movl   $0x1,-0x8(%rbp)
jmp    1146 <detect_straight+0x36>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<detect_straight>:
push   %rax
call   1030 <analog@plt>
xor    %ecx,%ecx
cmp    $0x65,%eax
setge  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @detect_straight(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 -1, i32* %3
%4 = load i32, i32* %2
%5 = call i32 @analog(i32 %4)
%6 = icmp sgt i32 %5, 100
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %3
br label %9
8: ; preds = %1
store i32 0, i32* %3
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
define i32 @detect_straight(i32 %0) {
%2 = tail call i32 @analog(i32 %0)
%3 = icmp sgt i32 %2, 100
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
unsigned int sys_call(int, int, unsigned int, int /*<<< orphan*/,
                      int /*<<< orphan*/);
unsigned int gcd_set_opb(unsigned int val) {
  return sys_call(0x06, 1, val, 0, 0);
}


x86 assembly (clang, -O0):
<gcd_set_opb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x6,%edi
mov    $0x1,%esi
xor    %r8d,%r8d
mov    %r8d,%ecx
call   1030 <sys_call@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd_set_opb>:
mov    %edi,%edx
mov    $0x6,%edi
mov    $0x1,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
jmp    1030 <sys_call@plt>

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

LLVM IR (-O2):
define i32 @gcd_set_opb(i32 %0) {
%2 = tail call i32 @sys_call(i32 6, i32 1, i32 %0, i32 0, i32 0)
ret i32 %2
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void swap32_b_store(uint32_t *out, uint32_t in) {
  uint32_t a;
  a = (in << 16) | (in >> 16);
  a = ((a & 0x00ff00ff) << 8) | ((a & 0xff00ff00) >> 8);
  *out = a;
}


x86 assembly (clang, -O0):
<swap32_b_store>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x10,%eax
mov    -0xc(%rbp),%ecx
sar    $0x10,%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
and    $0xff00ff,%eax
shl    $0x8,%eax
mov    -0x10(%rbp),%ecx
and    $0xff00ff00,%ecx
shr    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap32_b_store>:
mov    %esi,%eax
shl    $0x10,%eax
sar    $0x10,%esi
or     %eax,%esi
bswap  %esi
ror    $0x10,%esi
mov    %esi,(%rdi)
ret

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

LLVM IR (-O2):
define void @swap32_b_store(i32* nocapture writeonly %0, i32 %1) {
%3 = shl i32 %1, 16
%4 = ashr i32 %1, 16
%5 = or i32 %3, %4
%6 = shl i32 %5, 8
%7 = and i32 %6, -16711936
%8 = lshr i32 %5, 8
%9 = and i32 %8, 16711935
%10 = or i32 %7, %9
store i32 %10, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _pwmss_clk_disable(unsigned int);
scalar_t__ _pwmss_clk_status_get(unsigned int);
int /*<<< orphan*/ _pwmss_clk_status_set(unsigned int, int /*<<< orphan*/);
int pwmss_clk_disable(unsigned int device_id) {
  if (device_id > 2) {
    return -1;
  }
  if (_pwmss_clk_status_get(device_id) == 0) {
    return 1;
  }
  _pwmss_clk_disable(device_id);
  _pwmss_clk_status_set(device_id, 0);
  return 0;
}


x86 assembly (clang, -O0):
<pwmss_clk_disable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jbe    1151 <pwmss_clk_disable+0x21>
movl   $0xffffffff,-0x4(%rbp)
jmp    1188 <pwmss_clk_disable+0x58>
mov    -0x8(%rbp),%edi
call   1050 <_pwmss_clk_status_get@plt>
cmp    $0x0,%rax
jne    116f <pwmss_clk_disable+0x3f>
movl   $0x1,-0x4(%rbp)
jmp    1188 <pwmss_clk_disable+0x58>
mov    -0x8(%rbp),%edi
call   1040 <_pwmss_clk_disable@plt>
mov    -0x8(%rbp),%edi
xor    %esi,%esi
call   1030 <_pwmss_clk_status_set@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pwmss_clk_disable>:
push   %rbp
push   %rbx
push   %rax
mov    $0xffffffff,%ebp
cmp    $0x2,%edi
ja     1162 <pwmss_clk_disable+0x32>
mov    %edi,%ebx
call   1050 <_pwmss_clk_status_get@plt>
test   %rax,%rax
je     115d <pwmss_clk_disable+0x2d>
mov    %ebx,%edi
call   1040 <_pwmss_clk_disable@plt>
xor    %ebp,%ebp
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <_pwmss_clk_status_set@plt>
jmp    1162 <pwmss_clk_disable+0x32>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @pwmss_clk_disable(i32 %0) {
%2 = icmp ugt i32 %0, 2
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = tail call i64 @_pwmss_clk_status_get(i32 %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i32 @_pwmss_clk_disable(i32 %0)
%8 = tail call i32 @_pwmss_clk_status_set(i32 %0, i32 0)
br label %9
9: ; preds = %3, %1, %6
%10 = phi i32 [ 0, %6 ], [ -1, %1 ], [ 1, %3 ]
ret i32 %10
}
void connect(int *p, int rA, int rB) {
  if (p[rA] > p[rB])
    rA ^= rB ^= rA ^= rB;
  p[rA] += p[rB];
  p[rB] = rA;
}


x86 assembly (clang, -O0):
<connect>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x8(%rbp),%rcx
movslq -0x10(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jle    113f <connect+0x3f>
mov    -0x10(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
xor    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
xor    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
add    (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<connect>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%ecx
movslq %edx,%rdx
cmp    (%rdi,%rdx,4),%ecx
mov    %eax,%ecx
cmovg  %edx,%ecx
cmovg  %eax,%edx
movslq %edx,%rax
mov    (%rdi,%rax,4),%edx
movslq %ecx,%rcx
add    %edx,(%rdi,%rcx,4)
mov    %ecx,(%rdi,%rax,4)
ret

LLVM IR (-O0):
define void @connect(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i32, i32* %7, i64 %9
%11 = load i32, i32* %10
%12 = load i32*, i32** %4
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = load i32, i32* %15
%17 = icmp sgt i32 %11, %16
br i1 %17, label %18, label %26
18: ; preds = %3
%19 = load i32, i32* %6
%20 = load i32, i32* %5
%21 = xor i32 %20, %19
store i32 %21, i32* %5
%22 = load i32, i32* %6
%23 = xor i32 %22, %21
store i32 %23, i32* %6
%24 = load i32, i32* %5
%25 = xor i32 %24, %23
store i32 %25, i32* %5
br label %26
26: ; preds = %18, %3
%27 = load i32*, i32** %4
%28 = load i32, i32* %6
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
%31 = load i32, i32* %30
%32 = load i32*, i32** %4
%33 = load i32, i32* %5
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %32, i64 %34
%36 = load i32, i32* %35
%37 = add nsw i32 %36, %31
store i32 %37, i32* %35
%38 = load i32, i32* %5
%39 = load i32*, i32** %4
%40 = load i32, i32* %6
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i32, i32* %39, i64 %41
store i32 %38, i32* %42
ret void
}

LLVM IR (-O2):
define void @connect(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = icmp sgt i32 %6, %9
%11 = select i1 %10, i32 %2, i32 %1
%12 = select i1 %10, i32 %1, i32 %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %0, i64 %13
%15 = load i32, i32* %14
%16 = sext i32 %11 to i64
%17 = getelementptr inbounds i32, i32* %0, i64 %16
%18 = load i32, i32* %17
%19 = add nsw i32 %18, %15
store i32 %19, i32* %17
store i32 %11, i32* %14
ret void
}