xunge/DecIR huggingface dataset:
/* Variables and functions */
char *peak_malloc(size_t);
int /*<<< orphan*/ strcpy(char *, char const *);
size_t strsize(char const *);
char *peak_strdup(const char *s1) {
  size_t size;
  char *s2;
  size = strsize(s1);
  s2 = peak_malloc(size);
  if (s2) {
    strcpy(s2, s1);
  }
  return (s2);
}


x86 assembly (clang, -O0):
<peak_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strsize@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <peak_malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     116e <peak_strdup+0x3e>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<peak_strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strsize@plt>
mov    %rax,%rdi
call   1050 <peak_malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1157 <peak_strdup+0x27>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @peak_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strsize(i8* %5)
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = call i8* @peak_malloc(i64 %7)
store i8* %8, i8** %4
%9 = load i8*, i8** %4
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %15
11: ; preds = %1
%12 = load i8*, i8** %4
%13 = load i8*, i8** %2
%14 = call i32 @strcpy(i8* %12, i8* %13)
br label %15
15: ; preds = %11, %1
%16 = load i8*, i8** %4
ret i8* %16
}

LLVM IR (-O2):
define i8* @peak_strdup(i8* %0) {
%2 = tail call i64 @strsize(i8* %0)
%3 = tail call i8* @peak_malloc(i64 %2)
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @strcpy(i8* %3, i8* %0)
br label %7
7: ; preds = %5, %1
ret i8* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
unsigned char *mem_copy_word2vect_little(unsigned char *,
                                         int /*<<< orphan*/ const);
unsigned char *arch_mem_copy_word2vect_little(unsigned char *v,
                                              const uint16_t word) {
  return mem_copy_word2vect_little(v, word);
}


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

x86 assembly (clang, -O2):
<arch_mem_copy_word2vect_little>:
jmp    1030 <mem_copy_word2vect_little@plt>

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

LLVM IR (-O2):
define i8* @arch_mem_copy_word2vect_little(i8* %0, i32 %1) {
%3 = tail call i8* @mem_copy_word2vect_little(i8* %0, i32 %1)
ret i8* %3
}
int test_imm_ADuint16_mem(unsigned short *val) {
  return ((*val) & (0xAD << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_ADuint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, 173
%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_ADuint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 173
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void test_one() {
#pragma omp ordered
  ;
}


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

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

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

LLVM IR (-O2):
define void @test_one() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putchar(int /*<<< orphan*/);
void puts(const char *s) {
  while (*s)
    putchar(*s++);
}


x86 assembly (clang, -O0):
<puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <puts+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <putchar@plt>
jmp    111c <puts+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<puts>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <puts+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <puts+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @puts(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 @putchar(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("Test executable.\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [17 x i8] c"Test executable.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void scan_gpio_command() {}


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

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

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

LLVM IR (-O2):
define void @scan_gpio_command() {
ret void
}
void g_filename_display_basename() {}


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

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

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

LLVM IR (-O2):
define void @g_filename_display_basename() {
ret void
}
/* Type definitions */
struct timespec {
  int dummy;
};
typedef int /*<<< orphan*/ clockid_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int __clock_gettime(clockid_t clock_id, struct timespec *tp) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<__clock_gettime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__clock_gettime>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
@ENOSYS = global i32 0
define i32 @__clock_gettime(i32 %0, %struct.timespec* %1) {
%3 = alloca i32
%4 = alloca %struct.timespec*
store i32 %0, i32* %3
store %struct.timespec* %1, %struct.timespec** %4
%5 = load i32, i32* @ENOSYS
%6 = call i32 @__set_errno(i32 %5)
ret i32 -1
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@ENOSYS = global i32 0
define i32 @__clock_gettime(i32 %0, %struct.timespec* nocapture readnone %1) {
%3 = load i32, i32* @ENOSYS
%4 = tail call i32 @__set_errno(i32 %3)
ret i32 -1
}
/* Variables and functions */
scalar_t__ intcmp(char *, char *);
int binary_ge(char *s1, char *s2) { return intcmp(s1, s2) >= 0; }


x86 assembly (clang, -O0):
<binary_ge>:
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 <intcmp@plt>
cmp    $0x0,%rax
setge  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<binary_ge>:
push   %rax
call   1030 <intcmp@plt>
shr    $0x3f,%rax
xor    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @binary_ge(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i64 @intcmp(i8* %5, i8* %6)
%8 = icmp sge i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @binary_ge(i8* %0, i8* %1) {
%3 = tail call i64 @intcmp(i8* %0, i8* %1)
%4 = lshr i64 %3, 63
%5 = trunc i64 %4 to i32
%6 = xor i32 %5, 1
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ test_func();
int main(void) {
  puts("calling stack corruption function");
  test_func();
  puts("back to main");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1040 <test_func@plt>
lea    0xed9(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [34 x i8] c"calling stack corruption function\00"
@.str.1 = [13 x i8] c"back to main\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @puts(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @test_func()
%4 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"calling stack corruption function\00"
@.str.1 = [13 x i8] c"back to main\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @test_func()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ notifyEvent(char *, int /*<<< orphan*/, int /*<<< orphan*/,
                               int /*<<< orphan*/);
void sesc_sysconf(int tid, int flags) { notifyEvent("sesc_sysconf", 0, 0, 0); }


x86 assembly (clang, -O0):
<sesc_sysconf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xedb(%rip),%rdi
xor    %ecx,%ecx
mov    %ecx,%esi
mov    %ecx,%edx
call   1030 <notifyEvent@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sesc_sysconf>:
lea    0xee9(%rip),%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <notifyEvent@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"sesc_sysconf\00"
define void @sesc_sysconf(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @notifyEvent(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 0, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"sesc_sysconf\00"
define void @sesc_sysconf(i32 %0, i32 %1) {
%3 = tail call i32 @notifyEvent(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 0, i32 0, i32 0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
scalar_t__ EEXIST;
scalar_t__ errno;
scalar_t__ mkdir(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ warn(char *);
void mkdirv(const char *path, mode_t mode) {
  errno = 0;
  if (mkdir(path, mode) != 0) {
    if (errno != EEXIST)
      warn("mkdir");
  }
}


x86 assembly (clang, -O0):
<mkdirv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2ea2(%rip),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <mkdir@plt>
cmp    $0x0,%rax
je     117e <mkdirv+0x5e>
mov    0x2e7e(%rip),%rax
mov    (%rax),%rax
mov    0x2e7c(%rip),%rcx
cmp    (%rcx),%rax
je     1179 <mkdirv+0x59>
lea    0xe8c(%rip),%rdi
call   1030 <warn@plt>
jmp    117e <mkdirv+0x5e>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkdirv>:
push   %rbx
mov    0x2eb0(%rip),%rbx
movq   $0x0,(%rbx)
call   1040 <mkdir@plt>
test   %rax,%rax
je     1148 <mkdirv+0x28>
mov    (%rbx),%rax
mov    0x2e9d(%rip),%rcx
cmp    (%rcx),%rax
jne    114a <mkdirv+0x2a>
pop    %rbx
ret
lea    0xeaf(%rip),%rdi
pop    %rbx
jmp    1030 <warn@plt>

LLVM IR (-O0):
@errno = global i64 0
@EEXIST = global i64 0
@.str = [6 x i8] c"mkdir\00"
define void @mkdirv(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i64 0, i64* @errno
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i64 @mkdir(i8* %5, i32 %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %2
%10 = load i64, i64* @errno
%11 = load i64, i64* @EEXIST
%12 = icmp ne i64 %10, %11
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 @warn(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %9
br label %16
16: ; preds = %15, %2
ret void
}

LLVM IR (-O2):
@errno = global i64 0
@EEXIST = global i64 0
@.str = [6 x i8] c"mkdir\00"
define void @mkdirv(i8* nocapture %0, i32 %1) {
store i64 0, i64* @errno
%3 = tail call i64 @mkdir(i8* %0, i32 %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %11, label %5
5: ; preds = %2
%6 = load i64, i64* @errno
%7 = load i64, i64* @EEXIST
%8 = icmp eq i64 %6, %7
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = tail call i32 @warn(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %5, %9, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i;
  for (i = 15; i < 100; i++) {
    if (i % 15 == 0)
      printf("%d ", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xf,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    1166 <main+0x56>
mov    -0x8(%rbp),%eax
mov    $0xf,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1153 <main+0x43>
mov    -0x8(%rbp),%esi
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
jmp    1158 <main+0x48>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0xf,%ebx
lea    0xee0(%rip),%r14
jmp    1138 <main+0x28>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
cmp    $0x64,%ebx
je     115b <main+0x4b>
movzbl %bl,%eax
imul   $0x89,%eax,%ecx
shr    $0xb,%ecx
mov    %ecx,%edx
shl    $0x4,%edx
sub    %edx,%ecx
add    %cl,%al
jne    1130 <main+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
jmp    1130 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 15, i32* %2
br label %3
3: ; preds = %14, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 100
br i1 %5, label %6, label %17
6: ; preds = %3
%7 = load i32, i32* %2
%8 = srem i32 %7, 15
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = load i32, i32* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %10, %6
br label %14
14: ; preds = %13
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %3
17: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define i32 @main() {
br label %1
1: ; preds = %0, %8
%2 = phi i32 [ 15, %0 ], [ %9, %8 ]
%3 = trunc i32 %2 to i8
%4 = urem i8 %3, 15
%5 = icmp eq i8 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %8
8: ; preds = %1, %6
%9 = add nuw nsw i32 %2, 1
%10 = icmp eq i32 %9, 100
br i1 %10, label %11, label %1
11: ; preds = %8
ret i32 0
}
/* Variables and functions */
int do_protectedmain();
int /*<<< orphan*/ lua_closestring();
int /*<<< orphan*/ lua_openstring(char *);
int lua_dostring(char *str) {
  int status;
  if (str == 0)
    return 1;
  lua_openstring(str);
  status = do_protectedmain();
  lua_closestring();
  return status;
}


x86 assembly (clang, -O0):
<lua_dostring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1153 <lua_dostring+0x23>
movl   $0x1,-0x4(%rbp)
jmp    1173 <lua_dostring+0x43>
mov    -0x10(%rbp),%rdi
call   1040 <lua_openstring@plt>
mov    $0x0,%al
call   1050 <do_protectedmain@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <lua_closestring@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lua_dostring>:
test   %rdi,%rdi
je     114f <lua_dostring+0x1f>
push   %rbx
call   1040 <lua_openstring@plt>
xor    %eax,%eax
call   1050 <do_protectedmain@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <lua_closestring@plt>
mov    %ebx,%eax
pop    %rbx
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @lua_dostring(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %2
br label %14
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i32 @lua_openstring(i8* %9)
%11 = call i32 (...) @do_protectedmain()
store i32 %11, i32* %4
%12 = call i32 (...) @lua_closestring()
%13 = load i32, i32* %4
store i32 %13, i32* %2
br label %14
14: ; preds = %8, %7
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @lua_dostring(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i32 @lua_openstring(i8* %0)
%5 = tail call i32 (...) @do_protectedmain()
%6 = tail call i32 (...) @lua_closestring()
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %5, %3 ], [ 1, %1 ]
ret i32 %8
}
/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int
sd_bus_set_address(void *bus, const char *address) {
  return -EINVAL;
}


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

x86 assembly (clang, -O2):
<sd_bus_set_address>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sd_bus_set_address(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @EINVAL
%6 = sub nsw i32 0, %5
ret i32 %6
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_bus_set_address(i8* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @EINVAL
%4 = sub nsw i32 0, %3
ret i32 %4
}
void dis_assemble_21(as21, x) unsigned int as21, *x;
{
  unsigned long temp;
  temp = (as21 & 0x100000) >> 20;
  temp |= (as21 & 0x0ffe00) >> 8;
  temp |= (as21 & 0x000180) << 7;
  temp |= (as21 & 0x00007c) << 14;
  temp |= (as21 & 0x000003) << 12;
  *x = temp;
}


x86 assembly (clang, -O0):
<dis_assemble_21>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0x100000,%eax
shr    $0x14,%eax
mov    %eax,%eax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffe00,%eax
shr    $0x8,%eax
mov    %eax,%eax
or     -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
and    $0x180,%eax
shl    $0x7,%eax
mov    %eax,%eax
or     -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7c,%eax
shl    $0xe,%eax
mov    %eax,%eax
or     -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
and    $0x3,%eax
shl    $0xc,%eax
mov    %eax,%eax
or     -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<dis_assemble_21>:
mov    %edi,%eax
shr    $0x14,%eax
and    $0x1,%eax
mov    %edi,%ecx
shr    $0x8,%ecx
and    $0xffe,%ecx
or     %eax,%ecx
mov    %edi,%eax
shl    $0x7,%eax
and    $0xc000,%eax
or     %ecx,%eax
mov    %edi,%ecx
and    $0x7c,%ecx
shl    $0xe,%ecx
or     %eax,%ecx
and    $0x3,%edi
shl    $0xc,%edi
or     %ecx,%edi
mov    %edi,(%rsi)
ret

LLVM IR (-O0):
define void @dis_assemble_21(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i64
store i32 %0, i32* %3
store i32* %1, i32** %4
%6 = load i32, i32* %3
%7 = and i32 %6, 1048576
%8 = lshr i32 %7, 20
%9 = zext i32 %8 to i64
store i64 %9, i64* %5
%10 = load i32, i32* %3
%11 = and i32 %10, 1048064
%12 = lshr i32 %11, 8
%13 = zext i32 %12 to i64
%14 = load i64, i64* %5
%15 = or i64 %14, %13
store i64 %15, i64* %5
%16 = load i32, i32* %3
%17 = and i32 %16, 384
%18 = shl i32 %17, 7
%19 = zext i32 %18 to i64
%20 = load i64, i64* %5
%21 = or i64 %20, %19
store i64 %21, i64* %5
%22 = load i32, i32* %3
%23 = and i32 %22, 124
%24 = shl i32 %23, 14
%25 = zext i32 %24 to i64
%26 = load i64, i64* %5
%27 = or i64 %26, %25
store i64 %27, i64* %5
%28 = load i32, i32* %3
%29 = and i32 %28, 3
%30 = shl i32 %29, 12
%31 = zext i32 %30 to i64
%32 = load i64, i64* %5
%33 = or i64 %32, %31
store i64 %33, i64* %5
%34 = load i64, i64* %5
%35 = trunc i64 %34 to i32
%36 = load i32*, i32** %4
store i32 %35, i32* %36
ret void
}

LLVM IR (-O2):
define void @dis_assemble_21(i32 %0, i32* nocapture writeonly %1) {
%3 = lshr i32 %0, 20
%4 = and i32 %3, 1
%5 = lshr i32 %0, 8
%6 = and i32 %5, 4094
%7 = or i32 %4, %6
%8 = shl i32 %0, 7
%9 = and i32 %8, 49152
%10 = or i32 %7, %9
%11 = shl i32 %0, 14
%12 = and i32 %11, 2031616
%13 = or i32 %10, %12
%14 = shl i32 %0, 12
%15 = and i32 %14, 12288
%16 = or i32 %13, %15
store i32 %16, i32* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ parse_action(char *, int);
int /*<<< orphan*/ show_prompts();
char *skipspace(char *);
void cmd_prompt(char *arg) {
  arg = skipspace(arg);
  if (!*arg)
    show_prompts();
  else
    parse_action(arg, 1);
}


x86 assembly (clang, -O0):
<cmd_prompt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <skipspace@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1162 <cmd_prompt+0x32>
mov    $0x0,%al
call   1040 <show_prompts@plt>
jmp    1170 <cmd_prompt+0x40>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1030 <parse_action@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_prompt>:
push   %rax
call   1050 <skipspace@plt>
cmpb   $0x0,(%rax)
je     1149 <cmd_prompt+0x19>
mov    %rax,%rdi
mov    $0x1,%esi
pop    %rax
jmp    1030 <parse_action@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <show_prompts@plt>

LLVM IR (-O0):
define void @cmd_prompt(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @skipspace(i8* %3)
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 (...) @show_prompts()
br label %13
10: ; preds = %1
%11 = load i8*, i8** %2
%12 = call i32 @parse_action(i8* %11, i32 1)
br label %13
13: ; preds = %10, %8
ret void
}

LLVM IR (-O2):
define void @cmd_prompt(i8* %0) {
%2 = tail call i8* @skipspace(i8* %0)
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 (...) @show_prompts()
br label %9
7: ; preds = %1
%8 = tail call i32 @parse_action(i8* %2, i32 1)
br label %9
9: ; preds = %7, %5
ret void
}
/* Variables and functions */
int foobar();
int main() { return foobar(); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @foobar()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ is_separator(char const, char);
char *vle_cmds_past_arg(const char args[]) {
  while (!is_separator(*args, ' ') && *args != '\0') {
    ++args;
  }
  return (char *)args;
}


x86 assembly (clang, -O0):
<vle_cmds_past_arg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x20,%esi
movsbl (%rax),%edi
call   1030 <is_separator@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
jne    114d <vle_cmds_past_arg+0x3d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    115d <vle_cmds_past_arg+0x4d>
jmp    116e <vle_cmds_past_arg+0x5e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <vle_cmds_past_arg+0xc>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vle_cmds_past_arg>:
push   %rbx
mov    %rdi,%rbx
movsbl (%rdi),%edi
nopw   0x0(%rax,%rax,1)
mov    $0x20,%esi
call   1030 <is_separator@plt>
test   %eax,%eax
jne    113d <vle_cmds_past_arg+0x2d>
cmpb   $0x0,(%rbx)
je     113d <vle_cmds_past_arg+0x2d>
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
jmp    1120 <vle_cmds_past_arg+0x10>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @vle_cmds_past_arg(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %15, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = call i32 @is_separator(i8 signext %5, i8 signext 32)
%7 = icmp ne i32 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br label %13
13: ; preds = %8, %3
%14 = phi i1 [ false, %3 ], [ %12, %8 ]
br i1 %14, label %15, label %18
15: ; preds = %13
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %2
br label %3
18: ; preds = %13
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
define i8* @vle_cmds_past_arg(i8* %0) {
%2 = load i8, i8* %0
%3 = tail call i32 @is_separator(i8 signext %2, i8 signext 32)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %14
5: ; preds = %1, %9
%6 = phi i8* [ %10, %9 ], [ %0, %1 ]
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %5
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = load i8, i8* %10
%12 = tail call i32 @is_separator(i8 signext %11, i8 signext 32)
%13 = icmp eq i32 %12, 0
br i1 %13, label %5, label %14
14: ; preds = %5, %9, %1
%15 = phi i8* [ %0, %1 ], [ %10, %9 ], [ %6, %5 ]
ret i8* %15
}
void uppercase(char *s) {
  int c;
  while ((c = *s++))
    if (c >= 'a' && c <= 'z')
      *(s - 1) = c + 'A' - 'a';
}


x86 assembly (clang, -O0):
<uppercase>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
je     1151 <uppercase+0x51>
cmpl   $0x61,-0xc(%rbp)
jl     114c <uppercase+0x4c>
cmpl   $0x7a,-0xc(%rbp)
jg     114c <uppercase+0x4c>
mov    -0xc(%rbp),%eax
add    $0x41,%eax
sub    $0x61,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,-0x1(%rax)
jmp    1108 <uppercase+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<uppercase>:
mov    (%rdi),%al
test   %al,%al
je     112a <uppercase+0x2a>
add    $0x1,%rdi
jmp    111b <uppercase+0x1b>
nopl   0x0(%rax)
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
je     112a <uppercase+0x2a>
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
ja     1110 <uppercase+0x10>
add    $0xe0,%al
mov    %al,-0x1(%rdi)
jmp    1110 <uppercase+0x10>
ret

LLVM IR (-O0):
define void @uppercase(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
br label %4
4: ; preds = %23, %1
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i32 1
store i8* %6, i8** %2
%7 = load i8, i8* %5
%8 = sext i8 %7 to i32
store i32 %8, i32* %3
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %24
10: ; preds = %4
%11 = load i32, i32* %3
%12 = icmp sge i32 %11, 97
br i1 %12, label %13, label %23
13: ; preds = %10
%14 = load i32, i32* %3
%15 = icmp sle i32 %14, 122
br i1 %15, label %16, label %23
16: ; preds = %13
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 65
%19 = sub nsw i32 %18, 97
%20 = trunc i32 %19 to i8
%21 = load i8*, i8** %2
%22 = getelementptr inbounds i8, i8* %21, i64 -1
store i8 %20, i8* %22
br label %23
23: ; preds = %16, %13, %10
br label %4
24: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @uppercase(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %12
%5 = phi i8 [ %13, %12 ], [ %2, %1 ]
%6 = phi i8* [ %7, %12 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add i8 %5, -97
%9 = icmp ult i8 %8, 26
br i1 %9, label %10, label %12
10: ; preds = %4
%11 = add nsw i8 %5, -32
store i8 %11, i8* %6
br label %12
12: ; preds = %10, %4
%13 = load i8, i8* %7
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %12, %1
ret void
}
/* Variables and functions */
scalar_t__ INT_MAX;
int main(void) {
  (long long)0 || INT_MAX + 1;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@INT_MAX = global i64 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i64, i64* @INT_MAX
%3 = add nsw i64 %2, 1
%4 = icmp ne i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 0
}

LLVM IR (-O2):
@INT_MAX = global i64 0
define i32 @main() {
ret i32 0
}
int get_flash_params_count(void) { return 108; }


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

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

LLVM IR (-O0):
define i32 @get_flash_params_count() {
ret i32 108
}

LLVM IR (-O2):
define i32 @get_flash_params_count() {
ret i32 108
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void help(char const *progname) {
  printf(
      "Usage: %s [OPTION...] /path/to/device/file\n\n"
      "SCSI device identification.\n\n"
      "  -h --help                        Print this message\n"
      "     --version                     Print version of the program\n\n"
      "  -d --device=                     Device node for SG_IO commands\n"
      "  -f --config=                     Location of config file\n"
      "  -p --page=0x80|0x83|pre-spc3-83  SCSI page (0x80, 0x83, pre-spc3-83)\n"
      "  -s --sg-version=3|4              Use SGv3 or SGv4\n"
      "  -u --replace-whitespace          Replace all whitespace by "
      "underscores\n"
      "  -v --verbose                     Verbose logging\n",
      progname);
}


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

x86 assembly (clang, -O2):
<help>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [565 x i8] c"Usage: %s [OPTION...] /path/to/device/file\0A\0ASCSI device identification.\0A\0A -h --help Print this message\0A --version Print version of the program\0A\0A -d --device= Device node for SG_IO commands\0A -f --config= Location of config file\0A -p --page=0x80|0x83|pre-spc3-83 SCSI page (0x80, 0x83, pre-spc3-83)\0A -s --sg-version=3|4 Use SGv3 or SGv4\0A -u --replace-whitespace Replace all whitespace by underscores\0A -v --verbose Verbose logging\0A\00"
define void @help(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([565 x i8], [565 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [565 x i8] c"Usage: %s [OPTION...] /path/to/device/file\0A\0ASCSI device identification.\0A\0A -h --help Print this message\0A --version Print version of the program\0A\0A -d --device= Device node for SG_IO commands\0A -f --config= Location of config file\0A -p --page=0x80|0x83|pre-spc3-83 SCSI page (0x80, 0x83, pre-spc3-83)\0A -s --sg-version=3|4 Use SGv3 or SGv4\0A -u --replace-whitespace Replace all whitespace by underscores\0A -v --verbose Verbose logging\0A\00"
define void @help(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([565 x i8], [565 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, long);
char *itoa(long i, char *buffer) {
  sprintf(buffer, "%li", i);
  return buffer;
}


x86 assembly (clang, -O0):
<itoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xed1(%rip),%rsi
call   1030 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<itoa>:
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%rdx
lea    0xee2(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%li\00"
define i8* @itoa(i64 %0, i8* returned writeonly %1) {
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %0)
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ camera_accessory_init();
int /*<<< orphan*/ sleep(int);
int main(int argc, char **argv) {
  camera_accessory_init();
  while (1) {
    sleep(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <camera_accessory_init@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
jmp    113d <main+0x1d>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <camera_accessory_init@plt>
nopl   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1040 <sleep@plt>
jmp    1130 <main+0x10>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @camera_accessory_init()
br label %7
7: ; preds = %2, %7
%8 = call i32 @sleep(i32 1)
br label %7
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @camera_accessory_init()
br label %4
4: ; preds = %2, %4
%5 = tail call i32 @sleep(i32 1)
br label %4
}
void foo2(void) {
  int i;
#pragma acc parallel firstprivate(i)
  { i = 1; }
}


x86 assembly (clang, -O0):
<foo2>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @foo2() {
ret void
}
float v3sqlength(const float *v) {
  return v[0] * v[0] + v[1] * v[1] + v[2] * v[2];
}


x86 assembly (clang, -O0):
<v3sqlength>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x8(%rbp),%rax
mulss  0x4(%rax),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<v3sqlength>:
movss  (%rdi),%xmm1
movss  0x4(%rdi),%xmm0
mulss  %xmm0,%xmm0
mulss  %xmm1,%xmm1
addss  %xmm0,%xmm1
movss  0x8(%rdi),%xmm0
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @v3sqlength(float* %0) {
%2 = alloca float*
store float* %0, float** %2
%3 = load float*, float** %2
%4 = getelementptr inbounds float, float* %3, i64 0
%5 = load float, float* %4
%6 = load float*, float** %2
%7 = getelementptr inbounds float, float* %6, i64 0
%8 = load float, float* %7
%9 = load float*, float** %2
%10 = getelementptr inbounds float, float* %9, i64 1
%11 = load float, float* %10
%12 = load float*, float** %2
%13 = getelementptr inbounds float, float* %12, i64 1
%14 = load float, float* %13
%15 = fmul float %11, %14
%16 = call float @llvm.fmuladd.f32(float %5, float %8, float %15)
%17 = load float*, float** %2
%18 = getelementptr inbounds float, float* %17, i64 2
%19 = load float, float* %18
%20 = load float*, float** %2
%21 = getelementptr inbounds float, float* %20, i64 2
%22 = load float, float* %21
%23 = call float @llvm.fmuladd.f32(float %19, float %22, float %16)
ret float %23
}

LLVM IR (-O2):
define float @v3sqlength(float* nocapture %0) {
%2 = load float, float* %0
%3 = getelementptr inbounds float, float* %0, i64 1
%4 = load float, float* %3
%5 = fmul float %4, %4
%6 = tail call float @llvm.fmuladd.f32(float %2, float %2, float %5)
%7 = getelementptr inbounds float, float* %0, i64 2
%8 = load float, float* %7
%9 = tail call float @llvm.fmuladd.f32(float %8, float %8, float %6)
ret float %9
}
char *ckctoa(char c) {
  static char buf[32];
  static int current = 0;
  if (current >= 30)
    current = 0;
  buf[current++] = c;
  buf[current++] = '\0';
  return ((char *)(buf + current - 2));
}


x86 assembly (clang, -O0):
<ckctoa>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
cmpl   $0x1e,0x2f3f(%rip)
jl     1121 <ckctoa+0x21>
movl   $0x0,0x2f2f(%rip)
mov    -0x1(%rbp),%dl
mov    0x2f26(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2f1b(%rip)
movslq %eax,%rcx
lea    0x2ef1(%rip),%rax
mov    %dl,(%rax,%rcx,1)
mov    0x2f08(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2efd(%rip)
movslq %eax,%rcx
lea    0x2ed3(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
movslq 0x2ee8(%rip),%rcx
lea    0x2ec1(%rip),%rax
add    %rcx,%rax
add    $0xfffffffffffffffe,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ckctoa>:
mov    0x2f4a(%rip),%eax
xor    %ecx,%ecx
cmp    $0x1e,%eax
cmovl  %eax,%ecx
movslq %ecx,%rcx
lea    0x2f18(%rip),%rdx
lea    (%rdx,%rcx,1),%rax
mov    %dil,(%rcx,%rdx,1)
lea    0x2(%rcx),%esi
mov    %esi,0x2f27(%rip)
movb   $0x0,0x1(%rcx,%rdx,1)
ret

LLVM IR (-O0):
@ckctoa.buf = internal global [32 x i8] zeroinitializer
@ckctoa.current = internal global i32 0
define i8* @ckctoa(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i32, i32* @ckctoa.current
%4 = icmp sge i32 %3, 30
br i1 %4, label %5, label %6
5: ; preds = %1
store i32 0, i32* @ckctoa.current
br label %6
6: ; preds = %5, %1
%7 = load i8, i8* %2
%8 = load i32, i32* @ckctoa.current
%9 = add nsw i32 %8, 1
store i32 %9, i32* @ckctoa.current
%10 = sext i32 %8 to i64
%11 = getelementptr inbounds [32 x i8], [32 x i8]* @ckctoa.buf, i64 0, i64 %10
store i8 %7, i8* %11
%12 = load i32, i32* @ckctoa.current
%13 = add nsw i32 %12, 1
store i32 %13, i32* @ckctoa.current
%14 = sext i32 %12 to i64
%15 = getelementptr inbounds [32 x i8], [32 x i8]* @ckctoa.buf, i64 0, i64 %14
store i8 0, i8* %15
%16 = load i32, i32* @ckctoa.current
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @ckctoa.buf, i64 0, i64 0), i64 %17
%19 = getelementptr inbounds i8, i8* %18, i64 -2
ret i8* %19
}

LLVM IR (-O2):
@ckctoa.buf = internal global [32 x i8] zeroinitializer
@ckctoa.current = internal unnamed_addr global i32 0
define i8* @ckctoa(i8 signext %0) {
%2 = load i32, i32* @ckctoa.current
%3 = icmp sgt i32 %2, 29
%4 = select i1 %3, i32 0, i32 %2
%5 = add nsw i32 %4, 1
%6 = sext i32 %4 to i64
%7 = getelementptr inbounds [32 x i8], [32 x i8]* @ckctoa.buf, i64 0, i64 %6
store i8 %0, i8* %7
%8 = add nsw i32 %4, 2
store i32 %8, i32* @ckctoa.current
%9 = sext i32 %5 to i64
%10 = getelementptr inbounds [32 x i8], [32 x i8]* @ckctoa.buf, i64 0, i64 %9
store i8 0, i8* %10
%11 = sext i32 %8 to i64
%12 = getelementptr inbounds [32 x i8], [32 x i8]* @ckctoa.buf, i64 0, i64 %11
%13 = getelementptr inbounds i8, i8* %12, i64 -2
ret i8* %13
}
int d_ne_mm1(double *a1, double *a2) { return (((*a1) != (*a2))); }


x86 assembly (clang, -O0):
<d_ne_mm1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
ucomisd (%rax),%xmm0
setne  %al
setp   %cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_ne_mm1>:
movsd  (%rsi),%xmm0
cmpneqsd (%rdi),%xmm0
movq   %xmm0,%rax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @d_ne_mm1(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %3
%6 = load double, double* %5
%7 = load double*, double** %4
%8 = load double, double* %7
%9 = fcmp une double %6, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @d_ne_mm1(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = fcmp une double %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int chdir(char *);
int /*<<< orphan*/ perror(char *);
void cmd_chdir(int argc, char *argv[]) {
  if (chdir(argv[1]) == -1)
    perror("chdir");
}


x86 assembly (clang, -O0):
<cmd_chdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <chdir@plt>
cmp    $0xffffffff,%eax
jne    1151 <cmd_chdir+0x31>
lea    0xeb4(%rip),%rdi
call   1040 <perror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_chdir>:
push   %rax
mov    0x8(%rsi),%rdi
call   1030 <chdir@plt>
cmp    $0xffffffff,%eax
je     1131 <cmd_chdir+0x11>
pop    %rax
ret
lea    0xec8(%rip),%rdi
pop    %rax
jmp    1040 <perror@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"chdir\00"
define void @cmd_chdir(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @chdir(i8* %4)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ unlock();
void unlock_bandwidth_semaphore(void) { unlock(); }


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

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

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

LLVM IR (-O2):
define void @unlock_bandwidth_semaphore() {
%1 = tail call i32 (...) @unlock()
ret void
}
/* Type definitions */
struct sigaction {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ setup_signals(struct sigaction *, int);
void setup_parent_signals() {
  struct sigaction signal_action;
  setup_signals(&signal_action, 0x0 | 0x0);
}


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

x86 assembly (clang, -O2):
<setup_parent_signals>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <setup_signals@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.sigaction = type { i32 }
define void @setup_parent_signals() {
%1 = alloca %struct.sigaction
%2 = call i32 @setup_signals(%struct.sigaction* %1, i32 0)
ret void
}

LLVM IR (-O2):
%struct.sigaction = type { i32 }
define void @setup_parent_signals() {
%1 = alloca %struct.sigaction
%2 = bitcast %struct.sigaction* %1 to i8*
%3 = call i32 @setup_signals(%struct.sigaction* %1, i32 0)
ret void
}
int f(long long a, int b) {
  int c = (short)a * b;
  return c;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cwtl
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
movswl %di,%eax
imul   %esi,%eax
ret

LLVM IR (-O0):
define i32 @f(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%6 = load i64, i64* %3
%7 = trunc i64 %6 to i16
%8 = sext i16 %7 to i32
%9 = load i32, i32* %4
%10 = mul nsw i32 %8, %9
store i32 %10, i32* %5
%11 = load i32, i32* %5
ret i32 %11
}

LLVM IR (-O2):
define i32 @f(i64 %0, i32 %1) {
%3 = trunc i64 %0 to i32
%4 = shl i32 %3, 16
%5 = ashr exact i32 %4, 16
%6 = mul nsw i32 %5, %1
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ removeSelectorFromMethodLookupCache(int);
int primitiveBehavior_AddSelector_WithMethod_(int receiver, int *arguments) {
  removeSelectorFromMethodLookupCache(arguments[0]);
  return (1 << 2);
}


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

x86 assembly (clang, -O2):
<primitiveBehavior_AddSelector_WithMethod_>:
push   %rax
mov    (%rsi),%edi
call   1030 <removeSelectorFromMethodLookupCache@plt>
mov    $0x4,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @primitiveBehavior_AddSelector_WithMethod_(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%5 = load i32*, i32** %4
%6 = getelementptr inbounds i32, i32* %5, i64 0
%7 = load i32, i32* %6
%8 = call i32 @removeSelectorFromMethodLookupCache(i32 %7)
ret i32 4
}

LLVM IR (-O2):
define i32 @primitiveBehavior_AddSelector_WithMethod_(i32 %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = tail call i32 @removeSelectorFromMethodLookupCache(i32 %3)
ret i32 4
}
int M(int x) { return x * 2; }


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

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

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

LLVM IR (-O2):
define i32 @M(i32 %0) {
%2 = shl nsw i32 %0, 1
ret i32 %2
}