xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isxdigit(int);
void t_isxdigit_0x43() {
  Assert_real((isxdigit(67)),
              "/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_isxdigit.c",
              340, ("isxdigit should be 1 for C"));
}


x86 assembly (clang, -O0):
<t_isxdigit_0x43>:
push   %rbp
mov    %rsp,%rbp
mov    $0x43,%edi
call   1030 <isxdigit@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x154,%edx
lea    0xf66(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isxdigit_0x43>:
push   %rax
mov    $0x43,%edi
call   1030 <isxdigit@plt>
lea    0xece(%rip),%rsi
lea    0xf70(%rip),%rcx
mov    %eax,%edi
mov    $0x154,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 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_isxdigit.c\00"
@.str.1 = [27 x i8] c"isxdigit should be 1 for C\00"
define void @t_isxdigit_0x43() {
%1 = call i32 @isxdigit(i32 67)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 340, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 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_isxdigit.c\00"
@.str.1 = [27 x i8] c"isxdigit should be 1 for C\00"
define void @t_isxdigit_0x43() {
%1 = tail call i32 @isxdigit(i32 67)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 340, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
int is_little_endian() {
  union {
    uint16_t i;
    char c[2];
  } u;
  u.i = 0x0001;
  return u.c[0];
}


x86 assembly (clang, -O0):
<is_little_endian>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x8(%rbp)
movsbl -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%union.anon = type { i32 }
define i32 @is_little_endian() {
%1 = alloca %union.anon
%2 = bitcast %union.anon* %1 to i32*
store i32 1, i32* %2
%3 = bitcast %union.anon* %1 to [2 x i8]*
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @is_little_endian() {
ret i32 1
}
double HECMW_degree_to_radian(double deg) {
  return deg * 3.1415926535897932 / 180;
}


x86 assembly (clang, -O0):
<HECMW_degree_to_radian>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef7(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xee2(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<HECMW_degree_to_radian>:
mulsd  0xef8(%rip),%xmm0
divsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @HECMW_degree_to_radian(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 0x400921FB54442D18
%5 = fdiv double %4, 1.800000e+02
ret double %5
}

LLVM IR (-O2):
define double @HECMW_degree_to_radian(double %0) {
%2 = fmul double %0, 0x400921FB54442D18
%3 = fdiv double %2, 1.800000e+02
ret double %3
}
/* Variables and functions */
char *strrchr(char const *, char);
int isVisible(const char *filename) {
  const char *p = strrchr(filename, '/');
  return (p != NULL && p[1] != '.');
}


x86 assembly (clang, -O0):
<isVisible>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     114f <isVisible+0x3f>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2e,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isVisible>:
push   %rax
mov    $0x2f,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     112e <isVisible+0x1e>
mov    %rax,%rcx
xor    %eax,%eax
cmpb   $0x2e,0x1(%rcx)
setne  %al
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @isVisible(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %2, i64 1
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 46
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %4, %1
%10 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %10
}
void EntrarDato(int dato, int ind_p) {
  extern int buffer[100];
  buffer[ind_p] = dato;
}


x86 assembly (clang, -O0):
<EntrarDato>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edx
movslq -0x8(%rbp),%rcx
mov    0x2ec8(%rip),%rax
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<EntrarDato>:
movslq %esi,%rax
mov    0x2ed6(%rip),%rcx
mov    %edi,(%rcx,%rax,4)
ret

LLVM IR (-O0):
@buffer = external global [100 x i32]
define void @EntrarDato(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 = sext i32 %6 to i64
%8 = getelementptr inbounds [100 x i32], [100 x i32]* @buffer, i64 0, i64 %7
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
@buffer = external global [100 x i32]
define void @EntrarDato(i32 %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds [100 x i32], [100 x i32]* @buffer, i64 0, i64 %3
store i32 %0, i32* %4
ret void
}
/* Variables and functions */
size_t HAL_EEPROM_Length() { return 0x200; }


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

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

LLVM IR (-O0):
define i64 @HAL_EEPROM_Length() {
ret i64 512
}

LLVM IR (-O2):
define i64 @HAL_EEPROM_Length() {
ret i64 512
}
/* Variables and functions */
int /*<<< orphan*/ milli_delay(int);
void TestC() {
  int i = 0x2000;
  while (1) {
    milli_delay(10);
  }
}


x86 assembly (clang, -O0):
<TestC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x2000,-0x4(%rbp)
mov    $0xa,%edi
call   1030 <milli_delay@plt>
jmp    111f <TestC+0xf>

x86 assembly (clang, -O2):
<TestC>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <milli_delay@plt>
jmp    1120 <TestC+0x10>

LLVM IR (-O0):
define void @TestC() {
%1 = alloca i32
store i32 8192, i32* %1
br label %2
2: ; preds = %0, %2
%3 = call i32 @milli_delay(i32 10)
br label %2
}

LLVM IR (-O2):
define void @TestC() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @milli_delay(i32 10)
br label %1
}
int fun1131() { return 1131; }


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

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

LLVM IR (-O0):
define i32 @fun1131() {
ret i32 1131
}

LLVM IR (-O2):
define i32 @fun1131() {
ret i32 1131
}
int test_imm_B2uint16_reg(unsigned short val) {
  return ((val) & (-0xB2 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_B2uint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffff4e,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_B2uint16_reg>:
test   $0xff4e,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_B2uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -178
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void f6(_Bool b) {
  switch (b) {
  case 3:
    break;
  }
  switch (!b) {
  case 3:
    break;
  }
  switch (b++) {
  case 3:
    break;
  }
}


x86 assembly (clang, -O0):
<f6>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
and    $0x1,%al
mov    %al,-0x1(%rbp)
mov    $0x1,%al
test   %al,%al
jne    1120 <f6+0x20>
jmp    111b <f6+0x1b>
jmp    1120 <f6+0x20>
mov    $0x1,%al
test   %al,%al
jne    1134 <f6+0x34>
jmp    112f <f6+0x2f>
jmp    1134 <f6+0x34>
movb   $0x1,-0x1(%rbp)
mov    $0x1,%al
test   %al,%al
jne    114c <f6+0x4c>
jmp    1147 <f6+0x47>
jmp    114c <f6+0x4c>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f6(i1 zeroext %0) {
%2 = alloca i8
%3 = zext i1 %0 to i8
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = trunc i8 %4 to i1
%6 = zext i1 %5 to i32
switch i32 %6, label %8 [
i32 3, label %7
]
7: ; preds = %1
br label %8
8: ; preds = %1, %7
%9 = load i8, i8* %2
%10 = trunc i8 %9 to i1
%11 = xor i1 %10, true
%12 = zext i1 %11 to i32
switch i32 %12, label %14 [
i32 3, label %13
]
13: ; preds = %8
br label %14
14: ; preds = %8, %13
%15 = load i8, i8* %2
%16 = trunc i8 %15 to i1
store i8 1, i8* %2
%17 = zext i1 %16 to i32
switch i32 %17, label %19 [
i32 3, label %18
]
18: ; preds = %14
br label %19
19: ; preds = %14, %18
ret void
}

LLVM IR (-O2):
define void @f6(i1 zeroext %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ STDERR_FILENO;
int /*<<< orphan*/ _write(int /*<<< orphan*/, char *, int);
void longjmperror() {
  (void)_write(STDERR_FILENO, "longjmp botch.\n",
               sizeof("longjmp botch.\n") - 1);
}


x86 assembly (clang, -O0):
<longjmperror>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
mov    $0xf,%edx
call   1030 <_write@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<longjmperror>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
mov    $0xf,%edx
jmp    1030 <_write@plt>

LLVM IR (-O0):
@STDERR_FILENO = global i32 0
@.str = [16 x i8] c"longjmp botch.\0A\00"
define void @longjmperror() {
%1 = load i32, i32* @STDERR_FILENO
%2 = call i32 @_write(i32 %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 15)
ret void
}

LLVM IR (-O2):
@STDERR_FILENO = global i32 0
@.str = [16 x i8] c"longjmp botch.\0A\00"
define void @longjmperror() {
%1 = load i32, i32* @STDERR_FILENO
%2 = tail call i32 @_write(i32 %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 15)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ a(int);
int /*<<< orphan*/ b(int);
int main(int argc, char **argv) {
  a(3);
  b(5);
  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    $0x3,%edi
call   1040 <a@plt>
mov    $0x5,%edi
call   1030 <b@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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 @a(i32 3)
%7 = call i32 @b(i32 5)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @a(i32 3)
%4 = tail call i32 @b(i32 5)
ret i32 0
}
unsigned long intmap_hash(const char *str) {
  unsigned long hash = 5381;
  int c = 0;
  while ((c = *str++)) {
    hash = ((hash << 5) + hash) + c;
  }
  return hash;
}


x86 assembly (clang, -O0):
<intmap_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x1505,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     1151 <intmap_hash+0x51>
mov    -0x10(%rbp),%rax
shl    $0x5,%rax
add    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    1117 <intmap_hash+0x17>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<intmap_hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     112d <intmap_hash+0x2d>
add    $0x1,%rdi
mov    $0x1505,%eax
nop
mov    %rax,%rdx
shl    $0x5,%rdx
add    %rax,%rdx
movsbq %cl,%rax
add    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <intmap_hash+0x10>
ret
mov    $0x1505,%eax
ret

LLVM IR (-O0):
define i64 @intmap_hash(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i32
store i8* %0, i8** %2
store i64 5381, i64* %3
store i32 0, i32* %4
br label %5
5: ; preds = %11, %1
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %2
%8 = load i8, i8* %6
%9 = sext i8 %8 to i32
store i32 %9, i32* %4
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %19
11: ; preds = %5
%12 = load i64, i64* %3
%13 = shl i64 %12, 5
%14 = load i64, i64* %3
%15 = add i64 %13, %14
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = add i64 %15, %17
store i64 %18, i64* %3
br label %5
19: ; preds = %5
%20 = load i64, i64* %3
ret i64 %20
}

LLVM IR (-O2):
define i64 @intmap_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i64 [ %11, %4 ], [ 5381, %1 ]
%7 = phi i8* [ %8, %4 ], [ %0, %1 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = mul i64 %6, 33
%10 = sext i8 %5 to i64
%11 = add i64 %9, %10
%12 = load i8, i8* %8
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i64 [ 5381, %1 ], [ %11, %4 ]
ret i64 %15
}
/* Variables and functions */
int /*<<< orphan*/ print_indent(int);
int /*<<< orphan*/ printf(char *, char const *);
void print_name(int indent, const char *name) {
  print_indent(indent);
  if (name) {
    printf("%s: ", name);
  }
}


x86 assembly (clang, -O0):
<print_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <print_indent@plt>
cmpq   $0x0,-0x10(%rbp)
je     1152 <print_name+0x32>
mov    -0x10(%rbp),%rsi
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_name>:
push   %rbx
mov    %rsi,%rbx
call   1030 <print_indent@plt>
test   %rbx,%rbx
je     113e <print_name+0x1e>
lea    0xecb(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <printf@plt>
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%s: \00"
define void @print_name(i32 %0, i8* %1) {
%3 = tail call i32 @print_indent(i32 %0)
%4 = icmp eq i8* %1, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %7
7: ; preds = %5, %2
ret void
}
/* Variables and functions */
scalar_t__ strlen(char const *);
scalar_t__ strncmp(char const *, char const *, scalar_t__);
int check_prefix(const char *str, const char *prefix) {
  return strlen(str) > strlen(prefix) &&
         strncmp(str, prefix, strlen(prefix)) == 0;
}


x86 assembly (clang, -O0):
<check_prefix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rcx
mov    %rax,%rdx
xor    %eax,%eax
cmp    %rdx,%rcx
mov    %al,-0x11(%rbp)
jle    118e <check_prefix+0x6e>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    %rax,%rdx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_prefix>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1040 <strlen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rax,%rdx
xor    %eax,%eax
cmp    %rdx,%rbx
jle    115b <check_prefix+0x3b>
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @check_prefix(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 = call i64 @strlen(i8* %5)
%7 = load i8*, i8** %4
%8 = call i64 @strlen(i8* %7)
%9 = icmp sgt i64 %6, %8
br i1 %9, label %10, label %17
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = load i8*, i8** %4
%13 = load i8*, i8** %4
%14 = call i64 @strlen(i8* %13)
%15 = call i64 @strncmp(i8* %11, i8* %12, i64 %14)
%16 = icmp eq i64 %15, 0
br label %17
17: ; preds = %10, %2
%18 = phi i1 [ false, %2 ], [ %16, %10 ]
%19 = zext i1 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
define i32 @check_prefix(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = icmp sgt i64 %3, %4
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = tail call i64 @strncmp(i8* %0, i8* %1, i64 %4)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %2
%11 = phi i32 [ 0, %2 ], [ %9, %6 ]
ret i32 %11
}
int cpu(void *attr) {}


x86 assembly (clang, -O0):
<cpu>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @cpu(i8* nocapture readnone %0) {
ret i32 undef
}
/* Variables and functions */
float log(float);
float logdist(float x, float offset) {
  return (log(x + offset) - log(offset)) / (log(1 + offset) - log(offset));
}


x86 assembly (clang, -O0):
<logdist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
call   1030 <log@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xea7(%rip),%xmm0
addss  -0x8(%rbp),%xmm0
call   1030 <log@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <log@plt>
movss  -0x10(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0xc(%rbp),%xmm0
subss  %xmm2,%xmm1
divss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logdist>:
sub    $0x18,%rsp
movss  %xmm1,0xc(%rsp)
addss  %xmm1,%xmm0
call   1030 <log@plt>
movss  %xmm0,0x10(%rsp)
movss  0xc(%rsp),%xmm0
call   1030 <log@plt>
movss  0x10(%rsp),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,0x10(%rsp)
movss  0xeb4(%rip),%xmm0
addss  0xc(%rsp),%xmm0
call   1030 <log@plt>
movss  %xmm0,0x14(%rsp)
movss  0xc(%rsp),%xmm0
call   1030 <log@plt>
movss  0x14(%rsp),%xmm1
subss  %xmm0,%xmm1
movss  0x10(%rsp),%xmm0
divss  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @logdist(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fadd float %5, %6
%8 = call float @log(float %7)
%9 = load float, float* %4
%10 = call float @log(float %9)
%11 = fsub float %8, %10
%12 = load float, float* %4
%13 = fadd float 1.000000e+00, %12
%14 = call float @log(float %13)
%15 = load float, float* %4
%16 = call float @log(float %15)
%17 = fsub float %14, %16
%18 = fdiv float %11, %17
ret float %18
}

LLVM IR (-O2):
define float @logdist(float %0, float %1) {
%3 = fadd float %0, %1
%4 = tail call float @log(float %3)
%5 = tail call float @log(float %1)
%6 = fsub float %4, %5
%7 = fadd float %1, 1.000000e+00
%8 = tail call float @log(float %7)
%9 = tail call float @log(float %1)
%10 = fsub float %8, %9
%11 = fdiv float %6, %10
ret float %11
}
unsigned get_percentage(unsigned current, unsigned max) {
  return 100 * current / max;
}


x86 assembly (clang, -O0):
<get_percentage>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
imul   $0x64,-0x4(%rbp),%eax
xor    %edx,%edx
divl   -0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_percentage>:
imul   $0x64,%edi,%eax
xor    %edx,%edx
div    %esi
ret

LLVM IR (-O0):
define i32 @get_percentage(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 = mul i32 100, %5
%7 = load i32, i32* %4
%8 = udiv i32 %6, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @get_percentage(i32 %0, i32 %1) {
%3 = mul i32 %0, 100
%4 = udiv i32 %3, %1
ret i32 %4
}
/* Variables and functions */
int RMQUtil(int *, int /*<<< orphan*/, int, int, int, int /*<<< orphan*/);
int RMQ(int *st, int n, int qs, int qe) {
  if (qs < 0 || qe > n - 1 || qs > qe) {
    return -1;
  }
  return RMQUtil(st, 0, n - 1, qs, qe, 0);
}


x86 assembly (clang, -O0):
<RMQ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     114c <RMQ+0x3c>
mov    -0x1c(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     114c <RMQ+0x3c>
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    1158 <RMQ+0x48>
movl   $0xffffffff,-0x4(%rbp)
jmp    1177 <RMQ+0x67>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
xor    %r9d,%r9d
mov    %r9d,%esi
call   1030 <RMQUtil@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RMQ>:
mov    %ecx,%r8d
mov    %edx,%ecx
test   %edx,%edx
js     1132 <RMQ+0x22>
mov    %esi,%edx
cmp    %r8d,%esi
jle    1132 <RMQ+0x22>
cmp    %r8d,%ecx
jg     1132 <RMQ+0x22>
add    $0xffffffff,%edx
xor    %esi,%esi
xor    %r9d,%r9d
jmp    1030 <RMQUtil@plt>
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @RMQ(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%10 = load i32, i32* %8
%11 = icmp slt i32 %10, 0
br i1 %11, label %21, label %12
12: ; preds = %4
%13 = load i32, i32* %9
%14 = load i32, i32* %7
%15 = sub nsw i32 %14, 1
%16 = icmp sgt i32 %13, %15
br i1 %16, label %21, label %17
17: ; preds = %12
%18 = load i32, i32* %8
%19 = load i32, i32* %9
%20 = icmp sgt i32 %18, %19
br i1 %20, label %21, label %22
21: ; preds = %17, %12, %4
store i32 -1, i32* %5
br label %29
22: ; preds = %17
%23 = load i32*, i32** %6
%24 = load i32, i32* %7
%25 = sub nsw i32 %24, 1
%26 = load i32, i32* %8
%27 = load i32, i32* %9
%28 = call i32 @RMQUtil(i32* %23, i32 0, i32 %25, i32 %26, i32 %27, i32 0)
store i32 %28, i32* %5
br label %29
29: ; preds = %22, %21
%30 = load i32, i32* %5
ret i32 %30
}

LLVM IR (-O2):
define i32 @RMQ(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp slt i32 %2, 0
br i1 %5, label %13, label %6
6: ; preds = %4
%7 = icmp sle i32 %1, %3
%8 = icmp sgt i32 %2, %3
%9 = or i1 %7, %8
br i1 %9, label %13, label %10
10: ; preds = %6
%11 = add nsw i32 %1, -1
%12 = tail call i32 @RMQUtil(i32* %0, i32 0, i32 %11, i32 %2, i32 %3, i32 0)
br label %13
13: ; preds = %4, %6, %10
%14 = phi i32 [ %12, %10 ], [ -1, %6 ], [ -1, %4 ]
ret i32 %14
}
long long f5(long long j, int *b, long long i) { return j + b[i]; }


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

x86 assembly (clang, -O2):
<f5>:
movslq (%rsi,%rdx,4),%rax
add    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @f5(i64 %0, i32* %1, i64 %2) {
%4 = alloca i64
%5 = alloca i32*
%6 = alloca i64
store i64 %0, i64* %4
store i32* %1, i32** %5
store i64 %2, i64* %6
%7 = load i64, i64* %4
%8 = load i32*, i32** %5
%9 = load i64, i64* %6
%10 = getelementptr inbounds i32, i32* %8, i64 %9
%11 = load i32, i32* %10
%12 = sext i32 %11 to i64
%13 = add nsw i64 %7, %12
ret i64 %13
}

LLVM IR (-O2):
define i64 @f5(i64 %0, i32* nocapture %1, i64 %2) {
%4 = getelementptr inbounds i32, i32* %1, i64 %2
%5 = load i32, i32* %4
%6 = sext i32 %5 to i64
%7 = add nsw i64 %6, %0
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ UART2_send(char);
void EasyVR_Start(void) {
  UART2_send('i');
  UART2_send('D');
}


x86 assembly (clang, -O0):
<EasyVR_Start>:
push   %rbp
mov    %rsp,%rbp
mov    $0x69,%edi
call   1030 <UART2_send@plt>
mov    $0x44,%edi
call   1030 <UART2_send@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<EasyVR_Start>:
push   %rax
mov    $0x69,%edi
call   1030 <UART2_send@plt>
mov    $0x44,%edi
pop    %rax
jmp    1030 <UART2_send@plt>

LLVM IR (-O0):
define void @EasyVR_Start() {
%1 = call i32 @UART2_send(i8 signext 105)
%2 = call i32 @UART2_send(i8 signext 68)
ret void
}

LLVM IR (-O2):
define void @EasyVR_Start() {
%1 = tail call i32 @UART2_send(i8 signext 105)
%2 = tail call i32 @UART2_send(i8 signext 68)
ret void
}
/* Variables and functions */
scalar_t__ printf(char *, char const *);
int puts(const char *s) { return printf("%s\n", s) > 0 ? 1 : -1; }


x86 assembly (clang, -O0):
<puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
mov    %rax,%rdx
mov    $0xffffffff,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmovg  %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<puts>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
xor    %ecx,%ecx
test   %rax,%rax
setg   %cl
lea    (%rcx,%rcx,1),%eax
add    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @puts(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = icmp sgt i64 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 1, i32 -1
ret i32 %7
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @puts(i8* %0) {
%2 = tail call i64 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = icmp sgt i64 %2, 0
%4 = select i1 %3, i32 1, i32 -1
ret i32 %4
}
void set_dvfm_constraint(void) {}


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

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

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

LLVM IR (-O2):
define void @set_dvfm_constraint() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int /*<<< orphan*/ str2uint32(char const *);
mode_t str2modet(const char *str) { return (mode_t)str2uint32(str); }


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

x86 assembly (clang, -O2):
<str2modet>:
jmp    1030 <str2uint32@plt>

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

LLVM IR (-O2):
define i32 @str2modet(i8* %0) {
%2 = tail call i32 @str2uint32(i8* %0)
ret i32 %2
}
void init_char_vec(char *vector, int dim) {
  int i;
  for (i = 0; i < dim; i++)
    vector[i] = 0;
}


x86 assembly (clang, -O0):
<init_char_vec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1138 <init_char_vec+0x38>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <init_char_vec+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_char_vec>:
test   %esi,%esi
jle    1122 <init_char_vec+0x12>
push   %rax
mov    %esi,%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define void @init_char_vec(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %15, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %18
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
store i8 0, i8* %14
br label %15
15: ; preds = %10
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 1
store i32 %17, i32* %5
br label %6
18: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @init_char_vec(i8* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %2
ret void
}
/* Variables and functions */
unsigned long ULONG_MAX;
unsigned long saturateAddBound(unsigned long a, unsigned long b) {
  return ULONG_MAX - a < b ? ULONG_MAX : a + b;
}


x86 assembly (clang, -O0):
<saturateAddBound>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec5(%rip),%rax
mov    (%rax),%rax
sub    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1137 <saturateAddBound+0x37>
mov    0x2ead(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1143 <saturateAddBound+0x43>
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<saturateAddBound>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%rcx
mov    %rcx,%rdx
sub    %rdi,%rdx
lea    (%rdi,%rsi,1),%rax
cmp    %rsi,%rdx
cmovb  %rcx,%rax
ret

LLVM IR (-O0):
@ULONG_MAX = global i64 0
define i64 @saturateAddBound(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* @ULONG_MAX
%6 = load i64, i64* %3
%7 = sub i64 %5, %6
%8 = load i64, i64* %4
%9 = icmp ult i64 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load i64, i64* @ULONG_MAX
br label %16
12: ; preds = %2
%13 = load i64, i64* %3
%14 = load i64, i64* %4
%15 = add i64 %13, %14
br label %16
16: ; preds = %12, %10
%17 = phi i64 [ %11, %10 ], [ %15, %12 ]
ret i64 %17
}

LLVM IR (-O2):
@ULONG_MAX = global i64 0
define i64 @saturateAddBound(i64 %0, i64 %1) {
%3 = load i64, i64* @ULONG_MAX
%4 = sub i64 %3, %0
%5 = icmp ult i64 %4, %1
%6 = add i64 %1, %0
%7 = select i1 %5, i64 %3, i64 %6
ret i64 %7
}
char *strcat(char *dest, const char *src) {
  char *tmp = dest;
  while (*dest)
    dest++;
  while ((*dest++ = *src++) != '\0')
    ;
  return tmp;
}


x86 assembly (clang, -O0):
<strcat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1132 <strcat+0x32>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1114 <strcat+0x14>
jmp    1137 <strcat+0x37>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     116a <strcat+0x6a>
jmp    1137 <strcat+0x37>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat>:
mov    %rdi,%rax
mov    %rdi,%rcx
cs nopw 0x0(%rax,%rax,1)
cmpb   $0x0,(%rcx)
lea    0x1(%rcx),%rcx
jne    1110 <strcat+0x10>
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
movzbl (%rsi,%rdx,1),%edi
mov    %dil,-0x1(%rcx,%rdx,1)
add    $0x1,%rdx
test   %dil,%dil
jne    1120 <strcat+0x20>
ret

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

LLVM IR (-O2):
define i8* @strcat(i8* returned %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %7, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %6, label %8, label %3
8: ; preds = %3, %8
%9 = phi i8* [ %11, %8 ], [ %1, %3 ]
%10 = phi i8* [ %13, %8 ], [ %4, %3 ]
%11 = getelementptr inbounds i8, i8* %9, i64 1
%12 = load i8, i8* %9
%13 = getelementptr inbounds i8, i8* %10, i64 1
store i8 %12, i8* %10
%14 = icmp eq i8 %12, 0
br i1 %14, label %15, label %8
15: ; preds = %8
ret i8* %0
}
/* Variables and functions */
int strlen(char *);
int truncate(char *s1, char *s2) {
  int a, b;
  a = strlen(s1);
  b = strlen(s2);
  if (a > b) {
    s1[b] = '\0';
  }
  if (a < b) {
    s2[a] = '\0';
  }
  return 0;
}


x86 assembly (clang, -O0):
<truncate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    1150 <truncate+0x40>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1168 <truncate+0x58>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<truncate>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <strlen@plt>
cmp    %eax,%ebp
jle    1134 <truncate+0x24>
movslq %eax,%rcx
movb   $0x0,(%rbx,%rcx,1)
cmp    %eax,%ebp
jge    1140 <truncate+0x30>
movslq %ebp,%rax
movb   $0x0,(%r14,%rax,1)
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @truncate(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %1)
%5 = icmp sgt i32 %3, %4
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = sext i32 %4 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
store i8 0, i8* %8
br label %9
9: ; preds = %6, %2
%10 = icmp slt i32 %3, %4
br i1 %10, label %11, label %14
11: ; preds = %9
%12 = sext i32 %3 to i64
%13 = getelementptr inbounds i8, i8* %1, i64 %12
store i8 0, i8* %13
br label %14
14: ; preds = %11, %9
ret i32 0
}
int test_imm_BDint32_reg(int val) { return ((val) & (0xBD << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_BDint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0xbd,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_BDint32_reg(i32 %0) {
%2 = and i32 %0, 189
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct timespec {
  int dummy;
};

/* Variables and functions */
double posix_clock(void) {
  int ierr;
  struct timespec ts;
  double tnow;
  tnow = 0.0;
  return tnow;
}


x86 assembly (clang, -O0):
<posix_clock>:
push   %rbp
mov    %rsp,%rbp
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<posix_clock>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
define double @posix_clock() {
%1 = alloca i32
%2 = alloca %struct.timespec
%3 = alloca double
store double 0.000000e+00, double* %3
%4 = load double, double* %3
ret double %4
}

LLVM IR (-O2):
define double @posix_clock() {
ret double 0.000000e+00
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a;
  printf("Enter the number");
  scanf("%d", &a);
  if ((a & (1 << 20 - 1)) == 1)
    printf("Bit is set");
  else
    printf("Bit  is clear");
  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 <printf@plt>
lea    0xecf(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
and    $0x80000,%eax
cmp    $0x1,%eax
jne    116d <main+0x4d>
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
jmp    1179 <main+0x59>
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Enter the number\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [11 x i8] c"Bit is set\00"
@.str.3 = [14 x i8] c"Bit is clear\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = and i32 %5, 524288
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter the number\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [14 x i8] c"Bit is clear\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  extern char *__progname;
  fprintf(stderr, "usage: %s [-p port]\n", __progname);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
mov    0x2e9c(%rip),%rax
mov    (%rax),%rdx
lea    0xec2(%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
mov    0x2e9f(%rip),%rax
mov    (%rax),%rdx
lea    0xec5(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"usage: %s [-p port]\0A\00"
@__progname = external global i8*
define void @usage() {
%1 = load i32, i32* @stderr
%2 = load i8*, i8** @__progname
%3 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *emalloc(size_t amt) {
  void *v = malloc(amt);
  if (!v) {
    fprintf(stderr, "out of mem\n");
    exit(-1);
  }
  return v;
}


x86 assembly (clang, -O0):
<emalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1173 <emalloc+0x43>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emalloc>:
push   %rax
call   1040 <malloc@plt>
test   %rax,%rax
je     113d <emalloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [12 x i8] c"out of mem\0A\00"
define i8* @emalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %12, label %8
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 -1)
unreachable
12: ; preds = %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [12 x i8] c"out of mem\0A\00"
define noalias i8* @emalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 -1)
unreachable
8: ; preds = %1
ret i8* %2
}
/* Type definitions */
struct rq_settlement_information {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct rq_settlement_information *);
int /*<<< orphan*/
rq_settlement_information_clear(struct rq_settlement_information *);
void rq_settlement_information_free(struct rq_settlement_information *p) {
  rq_settlement_information_clear(p);
  free(p);
}


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

x86 assembly (clang, -O2):
<rq_settlement_information_free>:
push   %rbx
mov    %rdi,%rbx
call   1040 <rq_settlement_information_clear@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.rq_settlement_information = type { i32 }
define void @rq_settlement_information_free(%struct.rq_settlement_information* %0) {
%2 = alloca %struct.rq_settlement_information*
store %struct.rq_settlement_information* %0, %struct.rq_settlement_information** %2
%3 = load %struct.rq_settlement_information*, %struct.rq_settlement_information** %2
%4 = call i32 @rq_settlement_information_clear(%struct.rq_settlement_information* %3)
%5 = load %struct.rq_settlement_information*, %struct.rq_settlement_information** %2
%6 = call i32 @free(%struct.rq_settlement_information* %5)
ret void
}

LLVM IR (-O2):
%struct.rq_settlement_information = type { i32 }
define void @rq_settlement_information_free(%struct.rq_settlement_information* %0) {
%2 = tail call i32 @rq_settlement_information_clear(%struct.rq_settlement_information* %0)
%3 = tail call i32 @free(%struct.rq_settlement_information* %0)
ret void
}
void foo(char *p) {}


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

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

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

LLVM IR (-O2):
define void @foo(i8* nocapture %0) {
ret void
}
void adis16080_remove_trigger(struct iio_dev *indio_dev) {}


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

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

LLVM IR (-O0):
%struct.iio_dev = type opaque
define void @adis16080_remove_trigger(%struct.iio_dev* %0) {
%2 = alloca %struct.iio_dev*
store %struct.iio_dev* %0, %struct.iio_dev** %2
ret void
}

LLVM IR (-O2):
%struct.iio_dev = type opaque
define void @adis16080_remove_trigger(%struct.iio_dev* nocapture %0) {
ret void
}
void cdoProcessTime(double *utime, double *stime) {
  *utime = 0;
  *stime = 0;
}


x86 assembly (clang, -O0):
<cdoProcessTime>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdoProcessTime>:
movq   $0x0,(%rdi)
movq   $0x0,(%rsi)
ret

LLVM IR (-O0):
define void @cdoProcessTime(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
store double 0.000000e+00, double* %5
%6 = load double*, double** %4
store double 0.000000e+00, double* %6
ret void
}

LLVM IR (-O2):
define void @cdoProcessTime(double* nocapture writeonly %0, double* nocapture writeonly %1) {
store double 0.000000e+00, double* %0
store double 0.000000e+00, double* %1
ret void
}