xunge/DecIR huggingface dataset:
int isatty(int fd) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @isatty(i32 %0) {
ret i32 -1
}
/* Type definitions */
struct statfs {
  int dummy;
};

/* Variables and functions */
int errno;
int statfs(char const *, struct statfs *);
int __sulong_posix_statfs(const char *path, struct statfs *buf) {
  {
    int native_errno = errno;
    int result = statfs(path, buf);
    if (result == (int)-1) {
      result = (int)(long)-errno;
    }
    errno = native_errno;
    return result;
  };
}


x86 assembly (clang, -O0):
<__sulong_posix_statfs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eb9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <statfs@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    1156 <__sulong_posix_statfs+0x46>
xor    %eax,%eax
mov    0x2e91(%rip),%rcx
sub    (%rcx),%eax
cltq
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%ecx
mov    0x2e80(%rip),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__sulong_posix_statfs>:
push   %rbp
push   %rbx
push   %rax
mov    0x2ec6(%rip),%rbx
mov    (%rbx),%ebp
call   1030 <statfs@plt>
xor    %ecx,%ecx
sub    (%rbx),%ecx
cmp    $0xffffffff,%eax
cmove  %ecx,%eax
mov    %ebp,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.statfs = type { i32 }
@errno = global i32 0
define i32 @__sulong_posix_statfs(i8* %0, %struct.statfs* %1) {
%3 = alloca i8*
%4 = alloca %struct.statfs*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store %struct.statfs* %1, %struct.statfs** %4
%7 = load i32, i32* @errno
store i32 %7, i32* %5
%8 = load i8*, i8** %3
%9 = load %struct.statfs*, %struct.statfs** %4
%10 = call i32 @statfs(i8* %8, %struct.statfs* %9)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i32, i32* @errno
%15 = sub nsw i32 0, %14
%16 = sext i32 %15 to i64
%17 = trunc i64 %16 to i32
store i32 %17, i32* %6
br label %18
18: ; preds = %13, %2
%19 = load i32, i32* %5
store i32 %19, i32* @errno
%20 = load i32, i32* %6
ret i32 %20
}

LLVM IR (-O2):
%struct.statfs = type { i32 }
@errno = global i32 0
define i32 @__sulong_posix_statfs(i8* %0, %struct.statfs* %1) {
%3 = load i32, i32* @errno
%4 = tail call i32 @statfs(i8* %0, %struct.statfs* %1)
%5 = icmp eq i32 %4, -1
%6 = load i32, i32* @errno
%7 = sub nsw i32 0, %6
%8 = select i1 %5, i32 %7, i32 %4
store i32 %3, i32* @errno
ret i32 %8
}
/* Variables and functions */
int _ceil_power2(int);
int dywapitch_neededsamplecount(int minFreq) {
  int nbSam = 3 * 44100 / minFreq;
  nbSam = _ceil_power2(nbSam);
  return nbSam;
}


x86 assembly (clang, -O0):
<dywapitch_neededsamplecount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x204cc,%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <_ceil_power2@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dywapitch_neededsamplecount>:
mov    $0x204cc,%eax
xor    %edx,%edx
idiv   %edi
mov    %eax,%edi
jmp    1030 <_ceil_power2@plt>

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

LLVM IR (-O2):
define i32 @dywapitch_neededsamplecount(i32 %0) {
%2 = sdiv i32 132300, %0
%3 = tail call i32 @_ceil_power2(i32 %2)
ret i32 %3
}
int test_imm_47uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x47 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_47uint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 16
%6 = and i64 %5, 71
%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_47uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 4653056
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int tst_fs_has_free_(void (*)(), char const *, unsigned int, unsigned int);
int tst_fs_has_free(void (*cleanup)(void), const char *path, unsigned int size,
                    unsigned int mult) {
  return tst_fs_has_free_(cleanup, path, size, mult);
}


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

x86 assembly (clang, -O2):
<tst_fs_has_free>:
jmp    1030 <tst_fs_has_free_@plt>

LLVM IR (-O0):
define i32 @tst_fs_has_free(void ()* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca void ()*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store void ()* %0, void ()** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load void ()*, void ()** %5
%10 = bitcast void ()* %9 to void (...)*
%11 = load i8*, i8** %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = call i32 @tst_fs_has_free_(void (...)* %10, i8* %11, i32 %12, i32 %13)
ret i32 %14
}

LLVM IR (-O2):
define i32 @tst_fs_has_free(void ()* %0, i8* %1, i32 %2, i32 %3) {
%5 = bitcast void ()* %0 to void (...)*
%6 = tail call i32 @tst_fs_has_free_(void (...)* %5, i8* %1, i32 %2, i32 %3)
ret i32 %6
}
int test_imm_13int8_reg(signed char val) {
  return ((val) & (-0x13 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_13int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xffffffed,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_13int8_reg(i8 signext %0) {
%2 = and i8 %0, -19
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
__attribute__((always_)) int isvalid(unsigned char c) {
  return ((0x09 <= c) && (c <= 0x0d)) || ((0x20 <= c) && (c <= 0x7e));
}


x86 assembly (clang, -O0):
<isvalid>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%ecx
mov    $0x9,%eax
cmp    %ecx,%eax
jg     112d <isvalid+0x2d>
movzbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0xd,%ecx
mov    %al,-0x2(%rbp)
jle    1156 <isvalid+0x56>
movzbl -0x1(%rbp),%edx
xor    %eax,%eax
mov    $0x20,%ecx
cmp    %edx,%ecx
mov    %al,-0x3(%rbp)
jg     1150 <isvalid+0x50>
movzbl -0x1(%rbp),%eax
cmp    $0x7e,%eax
setle  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isvalid>:
lea    -0x9(%rdi),%eax
cmp    $0x5,%al
setb   %al
add    $0xe0,%dil
cmp    $0x5f,%dil
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @isvalid(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = icmp sle i32 9, %4
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = zext i8 %7 to i32
%9 = icmp sle i32 %8, 13
br i1 %9, label %20, label %10
10: ; preds = %6, %1
%11 = load i8, i8* %2
%12 = zext i8 %11 to i32
%13 = icmp sle i32 32, %12
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %2
%16 = zext i8 %15 to i32
%17 = icmp sle i32 %16, 126
br label %18
18: ; preds = %14, %10
%19 = phi i1 [ false, %10 ], [ %17, %14 ]
br label %20
20: ; preds = %18, %6
%21 = phi i1 [ true, %6 ], [ %19, %18 ]
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
define i32 @isvalid(i8 zeroext %0) {
%2 = add i8 %0, -9
%3 = icmp ult i8 %2, 5
%4 = add i8 %0, -32
%5 = icmp ult i8 %4, 95
%6 = or i1 %3, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
void procinit() {}


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

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

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

LLVM IR (-O2):
define void @procinit() {
ret void
}
/* Type definitions */
struct user {
  int dummy;
};

/* Variables and functions */
int EPERM;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int user_delete(struct user *user) {
  fprintf(stderr, "cannot delete user in single user mode\n");
  return -EPERM;
}


x86 assembly (clang, -O0):
<user_delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
lea    0xed4(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
mov    0x2e96(%rip),%rcx
sub    (%rcx),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<user_delete>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2ea3(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.user = type { i32 }
@stderr = global i32 0
@.str = [40 x i8] c"cannot delete user in single user mode\0A\00"
@EPERM = global i32 0
define i32 @user_delete(%struct.user* %0) {
%2 = alloca %struct.user*
store %struct.user* %0, %struct.user** %2
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @EPERM
%6 = sub nsw i32 0, %5
ret i32 %6
}

LLVM IR (-O2):
%struct.user = type { i32 }
@stderr = global i32 0
@.str = [40 x i8] c"cannot delete user in single user mode\0A\00"
@EPERM = global i32 0
define i32 @user_delete(%struct.user* nocapture readnone %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @EPERM
%5 = sub nsw i32 0, %4
ret i32 %5
}
int str_has_char(char *s) {
  char c;
  if (!s) {
    return (-1);
  }
  while ((c = *s++)) {
    if (c != ' ') {
      break;
    }
  }
  if (c) {
    return (0);
  } else {
    return (-1);
  }
}


x86 assembly (clang, -O0):
<str_has_char>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    111f <str_has_char+0x1f>
movl   $0xffffffff,-0x4(%rbp)
jmp    1174 <str_has_char+0x74>
jmp    1124 <str_has_char+0x24>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    %al,-0x11(%rbp)
cmp    $0x0,%al
je     1157 <str_has_char+0x57>
movsbl -0x11(%rbp),%eax
cmp    $0x20,%eax
je     1152 <str_has_char+0x52>
jmp    1157 <str_has_char+0x57>
jmp    1124 <str_has_char+0x24>
cmpb   $0x0,-0x11(%rbp)
je     116d <str_has_char+0x6d>
movl   $0x0,-0x4(%rbp)
jmp    1174 <str_has_char+0x74>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_has_char>:
mov    $0xffffffff,%eax
test   %rdi,%rdi
je     1122 <str_has_char+0x22>
nopw   0x0(%rax,%rax,1)
movzbl (%rdi),%ecx
add    $0x1,%rdi
cmp    $0x20,%cl
je     1110 <str_has_char+0x10>
test   %cl,%cl
je     1122 <str_has_char+0x22>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @str_has_char(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %8, label %3
3: ; preds = %1, %3
%4 = phi i8* [ %5, %3 ], [ %0, %1 ]
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = load i8, i8* %4
switch i8 %6, label %7 [
i8 32, label %3
i8 0, label %8
]
7: ; preds = %3
br label %8
8: ; preds = %3, %7, %1
%9 = phi i32 [ -1, %1 ], [ 0, %7 ], [ -1, %3 ]
ret i32 %9
}
int fn1(int a, int b) {
  int tem1 = a | b;
  int tem2 = a ^ b;
  return tem1 ^ tem2;
}


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

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

LLVM IR (-O0):
define i32 @fn1(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = or i32 %7, %8
store i32 %9, i32* %5
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = xor i32 %10, %11
store i32 %12, i32* %6
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = xor i32 %13, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @fn1(i32 %0, i32 %1) {
%3 = and i32 %1, %0
ret i32 %3
}
int findComplement(int num) {
  num = ~num;
  int flag = 1 << 31;
  while (num & flag) {
    num &= (~flag);
    flag = flag >> 1;
  }
  return num;
}


x86 assembly (clang, -O0):
<findComplement>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
movl   $0x80000000,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    -0x8(%rbp),%eax
cmp    $0x0,%eax
je     1140 <findComplement+0x40>
mov    -0x8(%rbp),%eax
xor    $0xffffffff,%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1117 <findComplement+0x17>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<findComplement>:
mov    %edi,%eax
not    %eax
test   %edi,%edi
js     111c <findComplement+0x1c>
mov    $0x80000000,%ecx
nopl   (%rax)
mov    %ecx,%edx
not    %edx
and    %edx,%eax
sar    %ecx
test   %eax,%ecx
jne    1110 <findComplement+0x10>
ret

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

LLVM IR (-O2):
define i32 @findComplement(i32 %0) {
%2 = xor i32 %0, -1
%3 = icmp slt i32 %0, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %9, %4 ], [ -2147483648, %1 ]
%6 = phi i32 [ %8, %4 ], [ %2, %1 ]
%7 = xor i32 %5, -1
%8 = and i32 %6, %7
%9 = ashr i32 %5, 1
%10 = and i32 %9, %8
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
%13 = phi i32 [ %2, %1 ], [ %8, %4 ]
ret i32 %13
}
int test_imm_4Fuint8_reg(unsigned char val) {
  return ((val) & (-0x4F << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_4Fuint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0xffffffb1,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_4Fuint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -79
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ jwPutch(char);
void jwPutstr(char *str) {
  jwPutch('\"');
  while (*str != '\0')
    jwPutch(*str++);
  jwPutch('\"');
}


x86 assembly (clang, -O0):
<jwPutstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x22,%edi
call   1030 <jwPutch@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1152 <jwPutstr+0x42>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <jwPutch@plt>
jmp    1126 <jwPutstr+0x16>
mov    $0x22,%edi
call   1030 <jwPutch@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jwPutstr>:
push   %rbx
mov    %rdi,%rbx
mov    $0x22,%edi
call   1030 <jwPutch@plt>
mov    (%rbx),%al
test   %al,%al
je     1143 <jwPutstr+0x33>
add    $0x1,%rbx
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <jwPutch@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <jwPutstr+0x20>
mov    $0x22,%edi
pop    %rbx
jmp    1030 <jwPutch@plt>

LLVM IR (-O0):
define void @jwPutstr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @jwPutch(i8 signext 34)
br label %4
4: ; preds = %9, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %4
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %2
%12 = load i8, i8* %10
%13 = call i32 @jwPutch(i8 signext %12)
br label %4
14: ; preds = %4
%15 = call i32 @jwPutch(i8 signext 34)
ret void
}

LLVM IR (-O2):
define void @jwPutstr(i8* nocapture %0) {
%2 = tail call i32 @jwPutch(i8 signext 34)
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %1, %5
%6 = phi i8 [ %10, %5 ], [ %3, %1 ]
%7 = phi i8* [ %8, %5 ], [ %0, %1 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = tail call i32 @jwPutch(i8 signext %6)
%10 = load i8, i8* %8
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5, %1
%13 = tail call i32 @jwPutch(i8 signext 34)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint16_t;

/* Variables and functions */
int st103_get_epreg(int /*<<< orphan*/);
uint16_t st103_ep_get_rx_status(uint8_t ep_num) {
  uint16_t value = st103_get_epreg(ep_num);
  return value & (0x3000);
}


x86 assembly (clang, -O0):
<st103_ep_get_rx_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <st103_get_epreg@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x3000,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<st103_ep_get_rx_status>:
push   %rax
call   1030 <st103_get_epreg@plt>
and    $0x3000,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @st103_ep_get_rx_status(i32 %0) {
%2 = tail call i32 @st103_get_epreg(i32 %0)
%3 = and i32 %2, 12288
ret i32 %3
}
/* Variables and functions */
int function(int, int, int);
void main(void) {
  volatile int foo = function(11, 333, 77777);
  ;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xb,%edi
mov    $0x14d,%esi
mov    $0x12fd1,%edx
call   1030 <function@plt>
mov    %eax,-0x4(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xb,%edi
mov    $0x14d,%esi
mov    $0x12fd1,%edx
call   1030 <function@plt>
mov    %eax,0x4(%rsp)
pop    %rax
ret

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = call i32 @function(i32 11, i32 333, i32 77777)
store volatile i32 %2, i32* %1
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @function(i32 11, i32 333, i32 77777)
store volatile i32 %3, i32* %1
ret void
}
int strvlen(char *strv) {
  int i;
  for (i = 1; strv[i - 1] || strv[i]; i++)
    ;
  return i;
}


x86 assembly (clang, -O0):
<strvlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0xd(%rbp)
jne    1143 <strvlen+0x43>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1153 <strvlen+0x53>
jmp    1166 <strvlen+0x66>
jmp    1158 <strvlen+0x58>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <strvlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strvlen>:
mov    $0x1,%eax
jmp    1114 <strvlen+0x14>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rax
cmpb   $0x0,-0x1(%rdi,%rax,1)
jne    1110 <strvlen+0x10>
cmpb   $0x0,(%rdi,%rax,1)
jne    1110 <strvlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @strvlen(i8* nocapture %0) {
br label %2
2: ; preds = %12, %1
%3 = phi i64 [ %13, %12 ], [ 1, %1 ]
%4 = add nsw i64 %3, -1
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = getelementptr inbounds i8, i8* %0, i64 %3
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %2, %8
%13 = add nuw i64 %3, 1
br label %2
14: ; preds = %8
%15 = trunc i64 %3 to i32
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int a = 10;
  int b = 100;
  int *p;
  p = &a;
  for (int i = 0; i < 10; i++) {
    p = &b;
  }
  *p = 20;
  assert(a == 20);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x64,-0xc(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jge    115c <main+0x4c>
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113c <main+0x2c>
mov    -0x18(%rbp),%rax
movl   $0x14,(%rax)
cmpl   $0x14,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exec_rcl(int, int, int);
void test_rcl(void) {
  int i;
  for (i = 0; i < 32; i++)
    exec_rcl(0x21ad3d34, 0x12345678, i);
  for (i = 0; i < 32; i++)
    exec_rcl(0x813f3421, 0x82345678, i);
}


x86 assembly (clang, -O0):
<test_rcl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x20,-0x4(%rbp)
jge    1149 <test_rcl+0x39>
mov    -0x4(%rbp),%edx
mov    $0x21ad3d34,%edi
mov    $0x12345678,%esi
call   1030 <exec_rcl@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <test_rcl+0xf>
movl   $0x0,-0x4(%rbp)
cmpl   $0x20,-0x4(%rbp)
jge    117a <test_rcl+0x6a>
mov    -0x4(%rbp),%edx
mov    $0x813f3421,%edi
mov    $0x82345678,%esi
call   1030 <exec_rcl@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1150 <test_rcl+0x40>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_rcl>:
push   %rbx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x21ad3d34,%edi
mov    $0x12345678,%esi
mov    %ebx,%edx
call   1030 <exec_rcl@plt>
add    $0x1,%ebx
cmp    $0x20,%ebx
jne    1120 <test_rcl+0x10>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    $0x813f3421,%edi
mov    $0x82345678,%esi
mov    %ebx,%edx
call   1030 <exec_rcl@plt>
add    $0x1,%ebx
cmp    $0x20,%ebx
jne    1140 <test_rcl+0x30>
pop    %rbx
ret

LLVM IR (-O0):
define void @test_rcl() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %8, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 32
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = load i32, i32* %1
%7 = call i32 @exec_rcl(i32 565001524, i32 305419896, i32 %6)
br label %8
8: ; preds = %5
%9 = load i32, i32* %1
%10 = add nsw i32 %9, 1
store i32 %10, i32* %1
br label %2
11: ; preds = %2
store i32 0, i32* %1
br label %12
12: ; preds = %18, %11
%13 = load i32, i32* %1
%14 = icmp slt i32 %13, 32
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = load i32, i32* %1
%17 = call i32 @exec_rcl(i32 -2126564319, i32 -2110499208, i32 %16)
br label %18
18: ; preds = %15
%19 = load i32, i32* %1
%20 = add nsw i32 %19, 1
store i32 %20, i32* %1
br label %12
21: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @test_rcl() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 @exec_rcl(i32 565001524, i32 305419896, i32 %2)
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 32
br i1 %5, label %6, label %1
6: ; preds = %1, %6
%7 = phi i32 [ %9, %6 ], [ 0, %1 ]
%8 = tail call i32 @exec_rcl(i32 -2126564319, i32 -2110499208, i32 %7)
%9 = add nuw nsw i32 %7, 1
%10 = icmp eq i32 %9, 32
br i1 %10, label %11, label %6
11: ; preds = %6
ret void
}
/* Variables and functions */
char EOF;
char getchar();
int /*<<< orphan*/ lower(char);
int /*<<< orphan*/ putchar(int /*<<< orphan*/);
int main() {
  char c;
  while ((c = getchar()) != EOF) {
    putchar(lower(c));
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2e95(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1173 <main+0x43>
movsbl -0x5(%rbp),%edi
call   1050 <lower@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
jmp    113f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2ea9(%rip),%rbx
cmp    (%rbx),%al
je     116a <main+0x3a>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %al,%edi
call   1050 <lower@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%al
jne    1150 <main+0x20>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i8 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
br label %3
3: ; preds = %9, %0
%4 = call signext i8 (...) @getchar()
store i8 %4, i8* %2
%5 = sext i8 %4 to i32
%6 = load i8, i8* @EOF
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %5, %7
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = load i8, i8* %2
%11 = call i32 @lower(i8 signext %10)
%12 = call i32 @putchar(i32 %11)
br label %3
13: ; preds = %3
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
@EOF = global i8 0
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = load i8, i8* @EOF
%3 = icmp eq i8 %1, %2
br i1 %3, label %11, label %4
4: ; preds = %0, %4
%5 = phi i8 [ %8, %4 ], [ %1, %0 ]
%6 = tail call i32 @lower(i8 signext %5)
%7 = tail call i32 @putchar(i32 %6)
%8 = tail call signext i8 (...) @getchar()
%9 = load i8, i8* @EOF
%10 = icmp eq i8 %8, %9
br i1 %10, label %11, label %4
11: ; preds = %4, %0
ret i32 0
}
/* Variables and functions */
bool pathIsRoot(const char *path) {
  bool status = false;
  if (path == NULL) {
    status = true;
  } else if (*path == '/') {
    while (*++path == '/')
      ;
    status = *path == '\0';
  }
  return status;
}


x86 assembly (clang, -O0):
<pathIsRoot>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1126 <pathIsRoot+0x26>
movl   $0x1,-0xc(%rbp)
jmp    1176 <pathIsRoot+0x76>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1171 <pathIsRoot+0x71>
jmp    113b <pathIsRoot+0x3b>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl 0x1(%rax),%eax
cmp    $0x2f,%eax
jne    115c <pathIsRoot+0x5c>
jmp    113b <pathIsRoot+0x3b>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
jmp    1176 <pathIsRoot+0x76>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pathIsRoot>:
test   %rdi,%rdi
je     1124 <pathIsRoot+0x24>
xor    %eax,%eax
cmpb   $0x2f,(%rdi)
jne    1123 <pathIsRoot+0x23>
add    $0x1,%rdi
movzbl (%rdi),%ecx
add    $0x1,%rdi
cmp    $0x2f,%cl
je     1110 <pathIsRoot+0x10>
xor    %eax,%eax
test   %cl,%cl
sete   %al
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @pathIsRoot(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 47
br i1 %5, label %6, label %14
6: ; preds = %3, %6
%7 = phi i8* [ %8, %6 ], [ %0, %3 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 47
br i1 %10, label %6, label %11
11: ; preds = %6
%12 = icmp eq i8 %9, 0
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %1, %3, %11
%15 = phi i32 [ %13, %11 ], [ 0, %3 ], [ 1, %1 ]
ret i32 %15
}
/* Variables and functions */
int MCL_CURRENT;
int MCL_FUTURE;
scalar_t__ mlockall(int);
int /*<<< orphan*/ panic(char *);
void xlockme(void) {
  if (mlockall(MCL_CURRENT | MCL_FUTURE) != 0)
    panic("Cannot lock pages!\n");
}


x86 assembly (clang, -O0):
<xlockme>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    0x2ebc(%rip),%rax
or     (%rax),%edi
call   1040 <mlockall@plt>
cmp    $0x0,%rax
je     1151 <xlockme+0x31>
lea    0xeb4(%rip),%rdi
call   1030 <panic@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<xlockme>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    0x2ec1(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
call   1040 <mlockall@plt>
test   %rax,%rax
je     114a <xlockme+0x2a>
lea    0xebc(%rip),%rdi
pop    %rax
jmp    1030 <panic@plt>
pop    %rax
ret

LLVM IR (-O0):
@MCL_CURRENT = global i32 0
@MCL_FUTURE = global i32 0
@.str = [20 x i8] c"Cannot lock pages!\0A\00"
define void @xlockme() {
%1 = load i32, i32* @MCL_CURRENT
%2 = load i32, i32* @MCL_FUTURE
%3 = or i32 %1, %2
%4 = call i64 @mlockall(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @panic(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
ret void
}

LLVM IR (-O2):
@MCL_CURRENT = global i32 0
@MCL_FUTURE = global i32 0
@.str = [20 x i8] c"Cannot lock pages!\0A\00"
define void @xlockme() {
%1 = load i32, i32* @MCL_CURRENT
%2 = load i32, i32* @MCL_FUTURE
%3 = or i32 %2, %1
%4 = tail call i64 @mlockall(i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = tail call i32 @panic(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
int strlen(char const *);
size_t strxfrm(char *s1, const char *s2, size_t n) {
  size_t len = strlen(s2) + 1;
  if (len < n)
    n = len;
  memcpy(s1, s2, n);
  return len;
}


x86 assembly (clang, -O0):
<strxfrm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    115c <strxfrm+0x3c>
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strxfrm>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsi,%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
movslq %eax,%r12
cmp    %rbx,%r12
cmovb  %r12,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <memcpy@plt>
mov    %r12,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i64 @strxfrm(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @strlen(i8* %1)
%5 = add nsw i32 %4, 1
%6 = sext i32 %5 to i64
%7 = icmp ult i64 %6, %2
%8 = select i1 %7, i64 %6, i64 %2
%9 = tail call i32 @memcpy(i8* %0, i8* %1, i64 %8)
ret i64 %6
}
int return_integer_part_in_reverse(float number) {
  int n = number;
  int result = 0;
  while (n) {
    result = result * 10 + (n % 10);
    n /= 10;
  }
  return result;
}


x86 assembly (clang, -O0):
<return_integer_part_in_reverse>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
cvttss2si -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     114f <return_integer_part_in_reverse+0x4f>
imul   $0xa,-0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%eax
add    %edx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1118 <return_integer_part_in_reverse+0x18>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<return_integer_part_in_reverse>:
cvttss2si %xmm0,%ecx
xor    %eax,%eax
test   %ecx,%ecx
je     113f <return_integer_part_in_reverse+0x3f>
nopw   0x0(%rax,%rax,1)
lea    (%rax,%rax,4),%eax
movslq %ecx,%rdx
imul   $0x66666667,%rdx,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rcx
add    %esi,%ecx
lea    (%rcx,%rcx,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edx,%edi
sub    %esi,%edi
lea    (%rdi,%rax,2),%eax
add    $0x9,%edx
cmp    $0x12,%edx
ja     1110 <return_integer_part_in_reverse+0x10>
ret

LLVM IR (-O0):
define i32 @return_integer_part_in_reverse(float %0) {
%2 = alloca float
%3 = alloca i32
%4 = alloca i32
store float %0, float* %2
%5 = load float, float* %2
%6 = fptosi float %5 to i32
store i32 %6, i32* %3
store i32 0, i32* %4
br label %7
7: ; preds = %10, %1
%8 = load i32, i32* %3
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = load i32, i32* %4
%12 = mul nsw i32 %11, 10
%13 = load i32, i32* %3
%14 = srem i32 %13, 10
%15 = add nsw i32 %12, %14
store i32 %15, i32* %4
%16 = load i32, i32* %3
%17 = sdiv i32 %16, 10
store i32 %17, i32* %3
br label %7
18: ; preds = %7
%19 = load i32, i32* %4
ret i32 %19
}

LLVM IR (-O2):
define i32 @return_integer_part_in_reverse(float %0) {
%2 = fptosi float %0 to i32
%3 = icmp eq i32 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %9, %4 ], [ 0, %1 ]
%6 = phi i32 [ %10, %4 ], [ %2, %1 ]
%7 = mul nsw i32 %5, 10
%8 = srem i32 %6, 10
%9 = add nsw i32 %7, %8
%10 = sdiv i32 %6, 10
%11 = add i32 %6, 9
%12 = icmp ult i32 %11, 19
br i1 %12, label %13, label %4
13: ; preds = %4, %1
%14 = phi i32 [ 0, %1 ], [ %9, %4 ]
ret i32 %14
}
/* Type definitions */
struct session {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ get_number_string(struct session *, char *, char *);
void mathstring(struct session *ses, char *str) {
  get_number_string(ses, str, str);
}


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

x86 assembly (clang, -O2):
<mathstring>:
mov    %rsi,%rdx
jmp    1030 <get_number_string@plt>

LLVM IR (-O0):
%struct.session = type { i32 }
define void @mathstring(%struct.session* %0, i8* %1) {
%3 = alloca %struct.session*
%4 = alloca i8*
store %struct.session* %0, %struct.session** %3
store i8* %1, i8** %4
%5 = load %struct.session*, %struct.session** %3
%6 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @get_number_string(%struct.session* %5, i8* %6, i8* %7)
ret void
}

LLVM IR (-O2):
%struct.session = type { i32 }
define void @mathstring(%struct.session* %0, i8* %1) {
%3 = tail call i32 @get_number_string(%struct.session* %0, i8* %1, i8* %1)
ret void
}
void vmemDumpStack() {}


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

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

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

LLVM IR (-O2):
define void @vmemDumpStack() {
ret void
}
/* Type definitions */
struct sysinfo {
  float totalram;
  float freeram;
};

/* Variables and functions */
int /*<<< orphan*/ sysinfo(struct sysinfo *);
int mem_usage_percent(void) {
  struct sysinfo info;
  sysinfo(&info);
  float per_float =
      (float)100 * (info.totalram - info.freeram) / info.totalram + 0.5;
  int per_int = (int)per_float;
  return per_int;
}


x86 assembly (clang, -O0):
<mem_usage_percent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
call   1030 <sysinfo@plt>
movss  -0x8(%rbp),%xmm1
subss  -0x4(%rbp),%xmm1
movss  0xed5(%rip),%xmm0
mulss  %xmm1,%xmm0
divss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeb8(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
cvttss2si -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_usage_percent>:
push   %rax
mov    %rsp,%rdi
call   1030 <sysinfo@plt>
movss  (%rsp),%xmm0
movaps %xmm0,%xmm1
subss  0x4(%rsp),%xmm1
mulss  0xed1(%rip),%xmm1
divss  %xmm0,%xmm1
addss  0xec9(%rip),%xmm1
cvttss2si %xmm1,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.sysinfo = type { float, float }
define i32 @mem_usage_percent() {
%1 = alloca %struct.sysinfo
%2 = alloca float
%3 = alloca i32
%4 = call i32 @sysinfo(%struct.sysinfo* %1)
%5 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i32 0, i32 0
%6 = load float, float* %5
%7 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i32 0, i32 1
%8 = load float, float* %7
%9 = fsub float %6, %8
%10 = fmul float 1.000000e+02, %9
%11 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i32 0, i32 0
%12 = load float, float* %11
%13 = fdiv float %10, %12
%14 = fpext float %13 to double
%15 = fadd double %14, 5.000000e-01
%16 = fptrunc double %15 to float
store float %16, float* %2
%17 = load float, float* %2
%18 = fptosi float %17 to i32
store i32 %18, i32* %3
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
%struct.sysinfo = type { float, float }
define i32 @mem_usage_percent() {
%1 = alloca %struct.sysinfo
%2 = bitcast %struct.sysinfo* %1 to i8*
%3 = call i32 @sysinfo(%struct.sysinfo* %1)
%4 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 0
%5 = load float, float* %4
%6 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 1
%7 = load float, float* %6
%8 = fsub float %5, %7
%9 = fmul float %8, 1.000000e+02
%10 = fdiv float %9, %5
%11 = fadd float %10, 5.000000e-01
%12 = fptosi float %11 to i32
ret i32 %12
}
int mod(int a, int b) {
  int c = a % b;
  return c < 0 ? c + b : c;
}


x86 assembly (clang, -O0):
<mod>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    112c <mod+0x2c>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1132 <mod+0x32>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mod>:
mov    %edi,%eax
cltd
idiv   %esi
mov    %edx,%eax
sar    $0x1f,%eax
and    %esi,%eax
add    %edx,%eax
ret

LLVM IR (-O0):
define i32 @mod(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* %3
%7 = load i32, i32* %4
%8 = srem i32 %6, %7
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* %5
%13 = load i32, i32* %4
%14 = add nsw i32 %12, %13
br label %17
15: ; preds = %2
%16 = load i32, i32* %5
br label %17
17: ; preds = %15, %11
%18 = phi i32 [ %14, %11 ], [ %16, %15 ]
ret i32 %18
}

LLVM IR (-O2):
define i32 @mod(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
%4 = icmp slt i32 %3, 0
%5 = select i1 %4, i32 %1, i32 0
%6 = add nsw i32 %5, %3
ret i32 %6
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int syscon_initialize_number_of_quaddobl_polynomials(int length) {
  int *b, fail;
  double *c;
  fail = _ada_use_c2phc4c(383, &length, b, c, 0);
  return fail;
}


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

x86 assembly (clang, -O2):
<syscon_initialize_number_of_quaddobl_polynomials>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x17f,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @syscon_initialize_number_of_quaddobl_polynomials(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @_ada_use_c2phc4c(i32 383, i32* %2, i32* undef, double* undef, i32 0)
ret i32 %3
}
void sendData() {}


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

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

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

LLVM IR (-O2):
define void @sendData() {
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
bool errata_66(void) {
  if (*(uint32_t *)0x10000130ul == 0x8ul) {
    if (*(uint32_t *)0x10000134ul == 0x0ul) {
      return true;
    }
    if (*(uint32_t *)0x10000134ul == 0x1ul) {
      return true;
    }
    if (*(uint32_t *)0x10000134ul == 0x2ul) {
      return true;
    }
  }
  return true;
}


x86 assembly (clang, -O0):
<errata_66>:
push   %rbp
mov    %rsp,%rbp
mov    $0x10000130,%eax
movslq (%rax),%rax
cmp    $0x8,%rax
jne    1175 <errata_66+0x75>
mov    $0x10000134,%eax
movslq (%rax),%rax
cmp    $0x0,%rax
jne    1134 <errata_66+0x34>
movl   $0x1,-0x4(%rbp)
jmp    117c <errata_66+0x7c>
mov    $0x10000134,%eax
movslq (%rax),%rax
cmp    $0x1,%rax
jne    1152 <errata_66+0x52>
movl   $0x1,-0x4(%rbp)
jmp    117c <errata_66+0x7c>
mov    $0x10000134,%eax
movslq (%rax),%rax
cmp    $0x2,%rax
jne    1170 <errata_66+0x70>
movl   $0x1,-0x4(%rbp)
jmp    117c <errata_66+0x7c>
jmp    1175 <errata_66+0x75>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @errata_66() {
%1 = alloca i32
%2 = load i32, i32* inttoptr (i64 268435760 to i32*)
%3 = sext i32 %2 to i64
%4 = icmp eq i64 %3, 8
br i1 %4, label %5, label %21
5: ; preds = %0
%6 = load i32, i32* inttoptr (i64 268435764 to i32*)
%7 = sext i32 %6 to i64
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %5
store i32 1, i32* %1
br label %22
10: ; preds = %5
%11 = load i32, i32* inttoptr (i64 268435764 to i32*)
%12 = sext i32 %11 to i64
%13 = icmp eq i64 %12, 1
br i1 %13, label %14, label %15
14: ; preds = %10
store i32 1, i32* %1
br label %22
15: ; preds = %10
%16 = load i32, i32* inttoptr (i64 268435764 to i32*)
%17 = sext i32 %16 to i64
%18 = icmp eq i64 %17, 2
br i1 %18, label %19, label %20
19: ; preds = %15
store i32 1, i32* %1
br label %22
20: ; preds = %15
br label %21
21: ; preds = %20, %0
store i32 1, i32* %1
br label %22
22: ; preds = %21, %19, %14, %9
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
define i32 @errata_66() {
ret i32 1
}