xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ strncat(char *, char const *, size_t);
void s_strncat(char *dest, const char *src, size_t _size) {
  strncat(dest, src, _size);
  dest[_size - 1] = '\0';
}


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

x86 assembly (clang, -O2):
<s_strncat>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
call   1030 <strncat@plt>
movb   $0x0,-0x1(%r14,%rbx,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @s_strncat(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i32 @strncat(i8* %7, i8* %8, i64 %9)
%11 = load i8*, i8** %4
%12 = load i64, i64* %6
%13 = sub i64 %12, 1
%14 = getelementptr inbounds i8, i8* %11, i64 %13
store i8 0, i8* %14
ret void
}

LLVM IR (-O2):
define void @s_strncat(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @strncat(i8* %0, i8* %1, i64 %2)
%5 = add i64 %2, -1
%6 = getelementptr inbounds i8, i8* %0, i64 %5
store i8 0, i8* %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ substr(char *, char *, int, int);
int main() {
  char a[] = "abcdefgh";
  char b[8];
  substr(b, a, 4, 2);
  printf("%s\n", b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x9(%rbp)
mov    0xecf(%rip),%al
mov    %al,-0x1(%rbp)
lea    -0x11(%rbp),%rdi
lea    -0x9(%rbp),%rsi
mov    $0x4,%edx
mov    $0x2,%ecx
call   1030 <substr@plt>
lea    -0x11(%rbp),%rsi
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movabs $0x6867666564636261,%rax
66 67 68
mov    %rax,0x8(%rsp)
movb   $0x0,0x10(%rsp)
lea    0x18(%rsp),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
mov    $0x2,%ecx
call   1030 <substr@plt>
lea    0xead(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.a = [9 x i8] c"abcdefgh\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [9 x i8]
%2 = alloca [8 x i8]
%3 = bitcast [9 x i8]* %1 to i8*
%4 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%6 = call i32 @substr(i8* %4, i8* %5, i32 4, i32 2)
%7 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [9 x i8] c"abcdefgh\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [9 x i8]
%2 = alloca [8 x i8]
%3 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%5 = call i32 @substr(i8* %4, i8* %3, i32 4, i32 2)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}
int test_imm_DEuint16_mem(unsigned short *val) {
  return ((*val) & (0xDE << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_DEuint16_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, 222
%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_DEuint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 222
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
int /*<<< orphan*/ printid(int);
int main() {
  int c;
  int mm[2] = {11, 2};
  c = mm[1] <= mm[0];
  print("c 1");
  printid(c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
setle  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
lea    0xeb6(%rip),%rdi
call   1030 <print@plt>
mov    -0x8(%rbp),%edi
call   1040 <printid@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <print@plt>
mov    $0x1,%edi
call   1040 <printid@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.mm = [2 x i32] [i32 11, i32 2]
@.str = [4 x i8] c"c 1\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [2 x i32]
store i32 0, i32* %1
%4 = bitcast [2 x i32]* %3 to i8*
%5 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%6 = load i32, i32* %5
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%8 = load i32, i32* %7
%9 = icmp sle i32 %6, %8
%10 = zext i1 %9 to i32
store i32 %10, i32* %2
%11 = call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %2
%13 = call i32 @printid(i32 %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"c 1\00"
define i32 @main() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printid(i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() { printf("\c"); }


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

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

LLVM IR (-O0):
@.str = [2 x i8] c"c\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @putchar(i32 99)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
unsigned long vsnprintf(char *, unsigned long, char const *,
                        int /*<<< orphan*/);
unsigned long log_fd_write_args(char *buf, unsigned long free_bytes,
                                char const *fmt, va_list ap) {
  return vsnprintf(buf, free_bytes, fmt, ap);
}


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

x86 assembly (clang, -O2):
<log_fd_write_args>:
jmp    1030 <vsnprintf@plt>

LLVM IR (-O0):
define i64 @log_fd_write_args(i8* %0, i64 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = load i8*, i8** %7
%12 = load i32, i32* %8
%13 = call i64 @vsnprintf(i8* %9, i64 %10, i8* %11, i32 %12)
ret i64 %13
}

LLVM IR (-O2):
define i64 @log_fd_write_args(i8* nocapture %0, i64 %1, i8* nocapture %2, i32 %3) {
%5 = tail call i64 @vsnprintf(i8* %0, i64 %1, i8* %2, i32 %3)
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  (void)fprintf(stderr, "usage: fish [-p]\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"usage: fish [-p]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"usage: fish [-p]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
void gtk_layout_get_size() {}


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

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

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

LLVM IR (-O2):
define void @gtk_layout_get_size() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ return_struct_s2();
int /*<<< orphan*/ take_struct_s2(int /*<<< orphan*/);
void test_struct_s2() { take_struct_s2(return_struct_s2()); }


x86 assembly (clang, -O0):
<test_struct_s2>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <return_struct_s2@plt>
mov    %eax,%edi
call   1030 <take_struct_s2@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_struct_s2>:
push   %rax
xor    %eax,%eax
call   1040 <return_struct_s2@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <take_struct_s2@plt>

LLVM IR (-O0):
define void @test_struct_s2() {
%1 = call i32 (...) @return_struct_s2()
%2 = call i32 @take_struct_s2(i32 %1)
ret void
}

LLVM IR (-O2):
define void @test_struct_s2() {
%1 = tail call i32 (...) @return_struct_s2()
%2 = tail call i32 @take_struct_s2(i32 %1)
ret void
}
int any_odd_one(unsigned x) { return !!(0xAAAAAAAA & x); }


x86 assembly (clang, -O0):
<any_odd_one>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xaaaaaaaa,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<any_odd_one>:
xor    %eax,%eax
test   $0xaaaaaaaa,%edi
setne  %al
ret

LLVM IR (-O0):
define i32 @any_odd_one(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 -1431655766, %3
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = xor i1 %6, true
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @any_odd_one(i32 %0) {
%2 = and i32 %0, -1431655766
%3 = icmp ne i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ SWAP(unsigned char *, unsigned char *);
void SWAP64(void *i_in) {
  unsigned char *inptr = (unsigned char *)i_in;
  SWAP(inptr, &inptr[7]);
  SWAP(&inptr[1], &inptr[6]);
  SWAP(&inptr[2], &inptr[5]);
  SWAP(&inptr[3], &inptr[4]);
}


x86 assembly (clang, -O0):
<SWAP64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x7,%rsi
call   1030 <SWAP@plt>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
add    $0x6,%rsi
call   1030 <SWAP@plt>
mov    -0x10(%rbp),%rdi
add    $0x2,%rdi
mov    -0x10(%rbp),%rsi
add    $0x5,%rsi
call   1030 <SWAP@plt>
mov    -0x10(%rbp),%rdi
add    $0x3,%rdi
mov    -0x10(%rbp),%rsi
add    $0x4,%rsi
call   1030 <SWAP@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SWAP64>:
push   %rbx
mov    %rdi,%rbx
lea    0x7(%rdi),%rsi
call   1030 <SWAP@plt>
lea    0x1(%rbx),%rdi
lea    0x6(%rbx),%rsi
call   1030 <SWAP@plt>
lea    0x2(%rbx),%rdi
lea    0x5(%rbx),%rsi
call   1030 <SWAP@plt>
lea    0x3(%rbx),%rdi
add    $0x4,%rbx
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <SWAP@plt>

LLVM IR (-O0):
define void @SWAP64(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 7
%8 = call i32 @SWAP(i8* %5, i8* %7)
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i64 6
%13 = call i32 @SWAP(i8* %10, i8* %12)
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i64 2
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 5
%18 = call i32 @SWAP(i8* %15, i8* %17)
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i64 3
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i64 4
%23 = call i32 @SWAP(i8* %20, i8* %22)
ret void
}

LLVM IR (-O2):
define void @SWAP64(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 7
%3 = tail call i32 @SWAP(i8* %0, i8* %2)
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = getelementptr inbounds i8, i8* %0, i64 6
%6 = tail call i32 @SWAP(i8* %4, i8* %5)
%7 = getelementptr inbounds i8, i8* %0, i64 2
%8 = getelementptr inbounds i8, i8* %0, i64 5
%9 = tail call i32 @SWAP(i8* %7, i8* %8)
%10 = getelementptr inbounds i8, i8* %0, i64 3
%11 = getelementptr inbounds i8, i8* %0, i64 4
%12 = tail call i32 @SWAP(i8* %10, i8* %11)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main(void) {
  puts("\n"
       "****************************************************************\n"
       " This program has been compiled without :\n"
       "	1) FFTW (http://www.fftw.org/).\n"
       "	2) libsndfile (http://www.zip.com.au/~erikd/libsndfile/).\n"
       " Without these two libraries there is not much it can do.\n"
       "****************************************************************\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <puts@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 = [324 x i8] c"\0A****************************************************************\0A This program has been compiled without :\0A\091) FFTW (http://www.fftw.org/).\0A\092) libsndfile (http://www.zip.com.au/~erikd/libsndfile/).\0A Without these two libraries there is not much it can do.\0A****************************************************************\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @puts(i8* getelementptr inbounds ([324 x i8], [324 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [324 x i8] c"\0A****************************************************************\0A This program has been compiled without :\0A\091) FFTW (http://www.fftw.org/).\0A\092) libsndfile (http://www.zip.com.au/~erikd/libsndfile/).\0A Without these two libraries there is not much it can do.\0A****************************************************************\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([324 x i8], [324 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
scalar_t__ isalnum(unsigned char);
int is_base64(unsigned char c) {
  return (isalnum(c) || (c == '+') || (c == '/'));
}


x86 assembly (clang, -O0):
<is_base64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edi
call   1030 <isalnum@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x2(%rbp)
jne    1158 <is_base64+0x48>
movzbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2b,%ecx
mov    %al,-0x2(%rbp)
je     1158 <is_base64+0x48>
movzbl -0x1(%rbp),%eax
cmp    $0x2f,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_base64>:
push   %rbx
mov    %edi,%ebx
call   1030 <isalnum@plt>
test   %rax,%rax
setne  %al
and    $0xfb,%bl
cmp    $0x2b,%bl
sete   %cl
or     %al,%cl
movzbl %cl,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @is_base64(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @isalnum(i8 zeroext %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %14, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = zext i8 %7 to i32
%9 = icmp eq i32 %8, 43
br i1 %9, label %14, label %10
10: ; preds = %6
%11 = load i8, i8* %2
%12 = zext i8 %11 to i32
%13 = icmp eq i32 %12, 47
br label %14
14: ; preds = %10, %6, %1
%15 = phi i1 [ true, %6 ], [ true, %1 ], [ %13, %10 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @is_base64(i8 zeroext %0) {
%2 = tail call i64 @isalnum(i8 zeroext %0)
%3 = icmp ne i64 %2, 0
%4 = and i8 %0, -5
%5 = icmp eq i8 %4, 43
%6 = or i1 %5, %3
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
float atan2(float, int);
float atanf(float x) { return atan2(x, 1.); }


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

x86 assembly (clang, -O2):
<atanf>:
mov    $0x1,%edi
jmp    1030 <atan2@plt>

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

LLVM IR (-O2):
define float @atanf(float %0) {
%2 = tail call float @atan2(float %0, i32 1)
ret float %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fwrite(int *, int, int, int /*<<< orphan*/ *);
int cgiWriteInt(FILE *out, int i) {
  if (!fwrite(&i, sizeof(int), 1, out)) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<cgiWriteInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fwrite@plt>
cmp    $0x0,%eax
jne    114b <cgiWriteInt+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    1152 <cgiWriteInt+0x42>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgiWriteInt>:
push   %rax
mov    %rdi,%rcx
mov    %esi,0x4(%rsp)
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fwrite@plt>
xor    %ecx,%ecx
test   %eax,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @cgiWriteInt(i32* nocapture %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = call i32 @fwrite(i32* %3, i32 4, i32 1, i32* %0)
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ swap(int *, int *);
int gcd(int m, int n) {
  if (m < n)
    swap(&m, &n);
  while (n) {
    m %= n;
    swap(&m, &n);
  }
  return m;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1137 <gcd+0x27>
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <swap@plt>
jmp    113c <gcd+0x2c>
cmpl   $0x0,-0x8(%rbp)
je     1164 <gcd+0x54>
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <swap@plt>
jmp    113c <gcd+0x2c>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
push   %r14
push   %rbx
push   %rax
mov    %edi,(%rsp)
mov    %esi,0x4(%rsp)
cmp    %esi,%edi
jge    1130 <gcd+0x20>
mov    %rsp,%rdi
lea    0x4(%rsp),%rsi
call   1030 <swap@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
je     115c <gcd+0x4c>
mov    %rsp,%r14
lea    0x4(%rsp),%rbx
nopl   0x0(%rax)
mov    (%rsp),%eax
cltd
idiv   %esi
mov    %edx,(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <swap@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
jne    1140 <gcd+0x30>
mov    (%rsp),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = icmp slt i32 %0, %1
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = call i32 @swap(i32* %3, i32* %4)
%8 = load i32, i32* %4
br label %9
9: ; preds = %6, %2
%10 = phi i32 [ %8, %6 ], [ %1, %2 ]
%11 = icmp eq i32 %10, 0
br i1 %11, label %19, label %12
12: ; preds = %9, %12
%13 = phi i32 [ %17, %12 ], [ %10, %9 ]
%14 = load i32, i32* %3
%15 = srem i32 %14, %13
store i32 %15, i32* %3
%16 = call i32 @swap(i32* %3, i32* %4)
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %12
19: ; preds = %12, %9
%20 = load i32, i32* %3
ret i32 %20
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ islower(int);
void t_islower_0xfb() {
  Assert_real((islower(251) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_islower.c",
              1260, ("islower should be 0 for 0xfb"));
}


x86 assembly (clang, -O0):
<t_islower_0xfb>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfb,%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x4ec,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_islower_0xfb>:
push   %rax
mov    $0xfb,%edi
call   1030 <islower@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x4ec,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_islower.c\00"
@.str.1 = [29 x i8] c"islower should be 0 for 0xfb\00"
define void @t_islower_0xfb() {
%1 = call i64 @islower(i32 251)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1260, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_islower.c\00"
@.str.1 = [29 x i8] c"islower should be 0 for 0xfb\00"
define void @t_islower_0xfb() {
%1 = tail call i64 @islower(i32 251)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1260, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ XOpenDisplay(char *);
int main() {
  (void)XOpenDisplay("");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @XOpenDisplay(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i32 @main() {
%1 = tail call i32 @XOpenDisplay(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int fun(int *, int, int);
int /*<<< orphan*/ printf(char *, int);
void main() {
  int a[] = {1, 2, 3, 4, 5, 6};
  printf("%d", fun(a, 4, 6));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x4,%esi
mov    $0x6,%edx
call   1030 <fun@plt>
mov    %eax,%esi
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xee5(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x4,%esi
mov    $0x6,%edx
call   1030 <fun@plt>
lea    0xec4(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [6 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6]
@.str = [3 x i8] c"%d\00"
define void @main() {
%1 = alloca [6 x i32]
%2 = bitcast [6 x i32]* %1 to i8*
%3 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%4 = call i32 @fun(i32* %3, i32 4, i32 6)
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@__const.main.a = [6 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6]
@.str = [3 x i8] c"%d\00"
define void @main() {
%1 = alloca [6 x i32]
%2 = bitcast [6 x i32]* %1 to i8*
%3 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%4 = call i32 @fun(i32* %3, i32 4, i32 6)
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}
/* Type definitions */
struct lrt_trans {
  int dummy;
};

/* Variables and functions */
uintptr_t lrt_trans_lt2id(struct lrt_trans *t) { return (uintptr_t)(t); }


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

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

LLVM IR (-O0):
%struct.lrt_trans = type { i32 }
define i64 @lrt_trans_lt2id(%struct.lrt_trans* %0) {
%2 = alloca %struct.lrt_trans*
store %struct.lrt_trans* %0, %struct.lrt_trans** %2
%3 = load %struct.lrt_trans*, %struct.lrt_trans** %2
%4 = ptrtoint %struct.lrt_trans* %3 to i64
ret i64 %4
}

LLVM IR (-O2):
%struct.lrt_trans = type { i32 }
define i64 @lrt_trans_lt2id(%struct.lrt_trans* %0) {
%2 = ptrtoint %struct.lrt_trans* %0 to i64
ret i64 %2
}
/* Variables and functions */
const char *RAND_file_name(char *buf, size_t num) { return NULL; }


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

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

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

LLVM IR (-O2):
define noalias i8* @RAND_file_name(i8* nocapture readnone %0, i64 %1) {
ret i8* null
}
int *test_00(int *s) {
  if (s[0] == 0)
    if (!s[3])
      s = 0;
  return s;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1130 <test_00+0x30>
mov    -0x8(%rbp),%rax
cmpl   $0x0,0xc(%rax)
jne    112b <test_00+0x2b>
movq   $0x0,-0x8(%rbp)
jmp    1130 <test_00+0x30>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    %rdi,%rax
cmpl   $0x0,(%rdi)
je     1109 <test_00+0x9>
ret
xor    %ecx,%ecx
cmpl   $0x0,0xc(%rax)
cmove  %rcx,%rax
ret

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

LLVM IR (-O2):
define i32* @test_00(i32* %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = getelementptr inbounds i32, i32* %0, i64 3
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i32* null, i32* %0
br label %9
9: ; preds = %4, %1
%10 = phi i32* [ %8, %4 ], [ %0, %1 ]
ret i32* %10
}
unsigned long __hide(unsigned long x) {
  asm volatile("" : "=&r"(x) : "0"(x));
  return x;
}


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

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

LLVM IR (-O0):
define i64 @__hide(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 asm sideeffect "", "=&r,0,~{dirflag},~{fpsr},~{flags}"(i64 %3)
store i64 %4, i64* %2
%5 = load i64, i64* %2
ret i64 %5
}

LLVM IR (-O2):
define i64 @__hide(i64 %0) {
%2 = tail call i64 asm sideeffect "", "=&r,0,~{dirflag},~{fpsr},~{flags}"(i64 %0)
ret i64 %2
}
void glScalef(int a, int b, int c) {}


x86 assembly (clang, -O0):
<glScalef>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @glScalef(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret void
}

LLVM IR (-O2):
define void @glScalef(i32 %0, i32 %1, i32 %2) {
ret void
}
extern char file_separator() { return '/'; }


x86 assembly (clang, -O0):
<file_separator>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2f,%al
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_separator>:
mov    $0x2f,%al
ret

LLVM IR (-O0):
define signext i8 @file_separator() {
ret i8 47
}

LLVM IR (-O2):
define signext i8 @file_separator() {
ret i8 47
}
unsigned int endian_swap32(unsigned int x) {
  return (x >> 24) | ((x << 8) & 0x00FF0000) | ((x >> 8) & 0x0000FF00) |
         (x << 24);
}


x86 assembly (clang, -O0):
<endian_swap32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x18,%eax
mov    -0x4(%rbp),%ecx
shl    $0x8,%ecx
and    $0xff0000,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
shr    $0x8,%ecx
and    $0xff00,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @endian_swap32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = lshr i32 %3, 24
%5 = load i32, i32* %2
%6 = shl i32 %5, 8
%7 = and i32 %6, 16711680
%8 = or i32 %4, %7
%9 = load i32, i32* %2
%10 = lshr i32 %9, 8
%11 = and i32 %10, 65280
%12 = or i32 %8, %11
%13 = load i32, i32* %2
%14 = shl i32 %13, 24
%15 = or i32 %12, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @endian_swap32(i32 %0) {
%2 = tail call i32 @llvm.bswap.i32(i32 %0)
ret i32 %2
}
void callee(int j) { j++; }


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

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

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

LLVM IR (-O2):
define void @callee(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ default_handler();
__attribute__((weak)) void DMA1_Stream5_IRQHandler() { default_handler(); }


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

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

LLVM IR (-O0):
define weak void @DMA1_Stream5_IRQHandler() {
%1 = call i32 (...) @default_handler()
ret void
}

LLVM IR (-O2):
define weak void @DMA1_Stream5_IRQHandler() {
%1 = tail call i32 (...) @default_handler()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ unrom_switch_prg(unsigned char);
void unrom_access(unsigned int address, unsigned char data) {
  if (address > 0x7fff && address < 0x10000) {
    unrom_switch_prg(data);
  }
}


x86 assembly (clang, -O0):
<unrom_access>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
cmpl   $0x7fff,-0x4(%rbp)
jbe    1144 <unrom_access+0x34>
cmpl   $0x10000,-0x4(%rbp)
jae    1144 <unrom_access+0x34>
movzbl -0x5(%rbp),%edi
call   1030 <unrom_switch_prg@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unrom_access>:
and    $0xffff8000,%edi
cmp    $0x8000,%edi
jne    1127 <unrom_access+0x17>
movzbl %sil,%edi
jmp    1030 <unrom_switch_prg@plt>
ret

LLVM IR (-O0):
define void @unrom_access(i32 %0, i8 zeroext %1) {
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %3
store i8 %1, i8* %4
%5 = load i32, i32* %3
%6 = icmp ugt i32 %5, 32767
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i32, i32* %3
%9 = icmp ult i32 %8, 65536
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i8, i8* %4
%12 = call i32 @unrom_switch_prg(i8 zeroext %11)
br label %13
13: ; preds = %10, %7, %2
ret void
}

LLVM IR (-O2):
define void @unrom_access(i32 %0, i8 zeroext %1) {
%3 = and i32 %0, -32768
%4 = icmp eq i32 %3, 32768
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @unrom_switch_prg(i8 zeroext %1)
br label %7
7: ; preds = %5, %2
ret void
}
__attribute__((no, noclone)) void f1(int i) {
  volatile int j;
  char *p, *orig;
  orig = p = (char *)__builtin_calloc(20, 1);
  j = *(p + i);
  j = p[i];
  p++;
  j = p[i - 1];
  j = *(p + i - 1);
  __builtin_free(orig);
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x14,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,-0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsbl -0x1(%rax,%rcx,1),%eax
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
movl   $0x0,-0x4(%rsp)
movl   $0x0,-0x4(%rsp)
movl   $0x0,-0x4(%rsp)
movl   $0x0,-0x4(%rsp)
ret

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

LLVM IR (-O2):
define void @f1(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store volatile i32 0, i32* %2
store volatile i32 0, i32* %2
store volatile i32 0, i32* %2
store volatile i32 0, i32* %2
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void I2CMasterDisable(uint32_t ui32Base) {
  ;
  (*((volatile uint32_t *)(ui32Base + 0x00000020))) &= ~(0x00000010);
}


x86 assembly (clang, -O0):
<I2CMasterDisable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%eax
cltq
mov    (%rax),%ecx
and    $0xffffffef,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2CMasterDisable>:
movslq %edi,%rax
andl   $0xffffffef,0x20(%rax)
ret

LLVM IR (-O0):
define void @I2CMasterDisable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 32
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
%7 = load volatile i32, i32* %6
%8 = and i32 %7, -17
store volatile i32 %8, i32* %6
ret void
}

LLVM IR (-O2):
define void @I2CMasterDisable(i32 %0) {
%2 = add nsw i32 %0, 32
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
%5 = load volatile i32, i32* %4
%6 = and i32 %5, -17
store volatile i32 %6, i32* %4
ret void
}
int test_thumb_ptr_routine(int b) { return b + 1; }


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

x86 assembly (clang, -O2):
<test_thumb_ptr_routine>:
lea    0x1(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @test_thumb_ptr_routine(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
__attribute__((weak)) void SVC_Handler(void) {
  while (1) {
  }
}


x86 assembly (clang, -O0):
<SVC_Handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <SVC_Handler+0x9>
jmp    1109 <SVC_Handler+0x9>

x86 assembly (clang, -O2):
<SVC_Handler>:
jmp    1100 <SVC_Handler>

LLVM IR (-O0):
define weak void @SVC_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define weak void @SVC_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}
int test1(int i, int j) {
  if (i >= j)
    if (i != j)
      return 0;
  return -1;
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1133 <test1+0x33>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     112e <test1+0x2e>
movl   $0x0,-0x4(%rbp)
jmp    113a <test1+0x3a>
jmp    1133 <test1+0x33>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
xor    %eax,%eax
cmp    %esi,%edi
setle  %al
neg    %eax
ret

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

LLVM IR (-O2):
define i32 @test1(i32 %0, i32 %1) {
%3 = icmp sle i32 %0, %1
%4 = sext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void usage(char *prog_name) { printf("Usage: %s <input file>\n", prog_name); }


x86 assembly (clang, -O0):
<usage>:
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):
<usage>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"Usage: %s <input file>\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"Usage: %s <input file>\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int get_randnum(int /*<<< orphan*/, int);
int find_syscall(void) {
  int x;
badcall:
  x = get_randnum(0, 384);
  switch (x) { goto badcall; }
  return x;
}


x86 assembly (clang, -O0):
<find_syscall>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
mov    $0x180,%esi
call   1030 <get_randnum@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_syscall>:
xor    %edi,%edi
mov    $0x180,%esi
jmp    1030 <get_randnum@plt>

LLVM IR (-O0):
define i32 @find_syscall() {
%1 = alloca i32
br label %2
2: ; preds = %0
%3 = call i32 @get_randnum(i32 0, i32 384)
store i32 %3, i32* %1
%4 = load i32, i32* %1
switch i32 %4, label %5 [
]
5: ; preds = %2
%6 = load i32, i32* %1
ret i32 %6
}

LLVM IR (-O2):
define i32 @find_syscall() {
%1 = tail call i32 @get_randnum(i32 0, i32 384)
ret i32 %1
}
void rot(int n, int *x, int *y, int rx, int ry) {
  int t;
  if (ry == 0) {
    if (rx == 1) {
      *x = n - 1 - *x;
      *y = n - 1 - *y;
    }
    t = *x;
    *x = *y;
    *y = t;
  }
}


x86 assembly (clang, -O0):
<rot>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    116c <rot+0x6c>
cmpl   $0x1,-0x1c(%rbp)
jne    114e <rot+0x4e>
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x10(%rbp),%rax
sub    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x18(%rbp),%rax
sub    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x24(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rot>:
test   %r8d,%r8d
je     1106 <rot+0x6>
ret
cmp    $0x1,%ecx
jne    111a <rot+0x1a>
add    $0xffffffff,%edi
mov    %edi,%eax
sub    (%rsi),%eax
mov    %eax,(%rsi)
sub    (%rdx),%edi
mov    %edi,(%rdx)
jmp    111c <rot+0x1c>
mov    (%rdx),%edi
mov    (%rsi),%eax
mov    %edi,(%rsi)
mov    %eax,(%rdx)
ret

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

LLVM IR (-O2):
define void @rot(i32 %0, i32* nocapture %1, i32* nocapture %2, i32 %3, i32 %4) {
%6 = icmp eq i32 %4, 0
br i1 %6, label %7, label %20
7: ; preds = %5
%8 = icmp eq i32 %3, 1
br i1 %8, label %11, label %9
9: ; preds = %7
%10 = load i32, i32* %2
br label %17
11: ; preds = %7
%12 = add nsw i32 %0, -1
%13 = load i32, i32* %1
%14 = sub nsw i32 %12, %13
store i32 %14, i32* %1
%15 = load i32, i32* %2
%16 = sub nsw i32 %12, %15
store i32 %16, i32* %2
br label %17
17: ; preds = %9, %11
%18 = phi i32 [ %10, %9 ], [ %16, %11 ]
%19 = load i32, i32* %1
store i32 %18, i32* %1
store i32 %19, i32* %2
br label %20
20: ; preds = %17, %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, void *, int);
int *proximo_da_media(int *, int);
int main() {
  int tabela[10] = {20, 30, 43, 5, 400, 1999, 9, 360, 3, 8};
  int *posicao = proximo_da_media(tabela, 10);
  printf("O endreco do ponteiro que aponta para o numero mais proximo da media "
         "e o %p e tem o valor %d\n",
         (void *)posicao, *posicao);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1040 <proximo_da_media@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rsi
mov    -0x38(%rbp),%rax
mov    (%rax),%edx
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0xef5(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebd(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xa,%esi
call   1040 <proximo_da_media@plt>
mov    (%rax),%edx
lea    0xecb(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.tabela = [10 x i32] [i32 20, i32 30, i32 43, i32 5, i32 400, i32 1999, i32 9, i32 360, i32 3, i32 8]
@.str = [94 x i8] c"O endreco do ponteiro que aponta para o numero mais proximo da media e o %p e tem o valor %d\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca i32*
%3 = bitcast [10 x i32]* %1 to i8*
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%5 = call i32* @proximo_da_media(i32* %4, i32 10)
store i32* %5, i32** %2
%6 = load i32*, i32** %2
%7 = bitcast i32* %6 to i8*
%8 = load i32*, i32** %2
%9 = load i32, i32* %8
%10 = call i32 @printf(i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@__const.main.tabela = [10 x i32] [i32 20, i32 30, i32 43, i32 5, i32 400, i32 1999, i32 9, i32 360, i32 3, i32 8]
@.str = [94 x i8] c"O endreco do ponteiro que aponta para o numero mais proximo da media e o %p e tem o valor %d\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32* @proximo_da_media(i32* %3, i32 10)
%5 = bitcast i32* %4 to i8*
%6 = load i32, i32* %4
%7 = call i32 @printf(i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6)
ret i32 0
}