xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ isascii(int);
int islower(int c) {
  if (!isascii(c))
    return 0;
  if (((unsigned char)c >= 'a') && ((unsigned char)c <= 'z'))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<islower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <isascii@plt>
cmp    $0x0,%eax
jne    1138 <islower+0x28>
movl   $0x0,-0x4(%rbp)
jmp    1169 <islower+0x59>
mov    -0x8(%rbp),%eax
movzbl %al,%eax
cmp    $0x61,%eax
jl     1162 <islower+0x52>
mov    -0x8(%rbp),%eax
movzbl %al,%eax
cmp    $0x7a,%eax
jg     1162 <islower+0x52>
movl   $0x1,-0x4(%rbp)
jmp    1169 <islower+0x59>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<islower>:
add    $0xffffff9f,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @islower(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i32 @isascii(i32 %4)
%6 = icmp ne i32 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %1
store i32 0, i32* %2
br label %20
8: ; preds = %1
%9 = load i32, i32* %3
%10 = trunc i32 %9 to i8
%11 = zext i8 %10 to i32
%12 = icmp sge i32 %11, 97
br i1 %12, label %13, label %19
13: ; preds = %8
%14 = load i32, i32* %3
%15 = trunc i32 %14 to i8
%16 = zext i8 %15 to i32
%17 = icmp sle i32 %16, 122
br i1 %17, label %18, label %19
18: ; preds = %13
store i32 1, i32* %2
br label %20
19: ; preds = %13, %8
store i32 0, i32* %2
br label %20
20: ; preds = %19, %18, %7
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
define i32 @islower(i32 %0) {
%2 = add i32 %0, -97
%3 = icmp ult i32 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ SXNETID;

/* Variables and functions */
scalar_t__ ASN1_item_new(int /*<<< orphan*/ *);
int /*<<< orphan*/ SXNETID_it;
SXNETID *SXNETID_new(void) { return (SXNETID *)ASN1_item_new(&SXNETID_it); }


x86 assembly (clang, -O0):
<SXNETID_new>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ebd(%rip),%rdi
call   1030 <ASN1_item_new@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SXNETID_new>:
mov    0x2ec1(%rip),%rdi
jmp    1030 <ASN1_item_new@plt>

LLVM IR (-O0):
@SXNETID_it = global i32 0
define i32* @SXNETID_new() {
%1 = call i64 @ASN1_item_new(i32* @SXNETID_it)
%2 = inttoptr i64 %1 to i32*
ret i32* %2
}

LLVM IR (-O2):
@SXNETID_it = global i32 0
define i32* @SXNETID_new() {
%1 = tail call i64 @ASN1_item_new(i32* @SXNETID_it)
%2 = inttoptr i64 %1 to i32*
ret i32* %2
}
/* Type definitions */
typedef scalar_t__ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ wcscspn(scalar_t__ const *, scalar_t__ const *);
wchar_t *wcspbrk(const wchar_t *s, const wchar_t *b) {
  s += wcscspn(s, b);
  return *s ? (wchar_t *)s : NULL;
}


x86 assembly (clang, -O0):
<wcspbrk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <wcscspn@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     115c <wcspbrk+0x4c>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1167 <wcspbrk+0x57>
xor    %eax,%eax
mov    %rax,-0x18(%rbp)
jmp    1167 <wcspbrk+0x57>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcspbrk>:
push   %rbx
mov    %rdi,%rbx
call   1030 <wcscspn@plt>
movslq %eax,%rcx
lea    (%rbx,%rcx,8),%rax
mov    (%rbx,%rcx,8),%rcx
test   %rcx,%rcx
cmove  %rcx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i64* @wcspbrk(i64* %0, i64* %1) {
%3 = tail call i32 @wcscspn(i64* %0, i64* %1)
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i64, i64* %0, i64 %4
%6 = load i64, i64* %5
%7 = icmp eq i64 %6, 0
%8 = select i1 %7, i64* null, i64* %5
ret i64* %8
}
/* Variables and functions */
int /*<<< orphan*/ RTLD_LAZY;
int /*<<< orphan*/ dlopen(char *, int /*<<< orphan*/);
int /*<<< orphan*/ setState(int);
int /*<<< orphan*/ waitForState(int);
void *work(void *arg) {
  waitForState(1);
  dlopen("libbar.dylib", RTLD_LAZY);
  setState(2);
  return NULL;
}


x86 assembly (clang, -O0):
<work>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%edi
call   1050 <waitForState@plt>
mov    0x2e93(%rip),%rax
mov    (%rax),%esi
lea    0xeaa(%rip),%rdi
call   1030 <dlopen@plt>
mov    $0x2,%edi
call   1040 <setState@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<work>:
push   %rax
mov    $0x1,%edi
call   1050 <waitForState@plt>
mov    0x2e9e(%rip),%rax
mov    (%rax),%esi
lea    0xeb5(%rip),%rdi
call   1030 <dlopen@plt>
mov    $0x2,%edi
call   1040 <setState@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"libbar.dylib\00"
@RTLD_LAZY = global i32 0
define i8* @work(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @waitForState(i32 1)
%4 = load i32, i32* @RTLD_LAZY
%5 = call i32 @dlopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @setState(i32 2)
ret i8* null
}

LLVM IR (-O2):
@.str = [13 x i8] c"libbar.dylib\00"
@RTLD_LAZY = global i32 0
define noalias i8* @work(i8* nocapture readnone %0) {
%2 = tail call i32 @waitForState(i32 1)
%3 = load i32, i32* @RTLD_LAZY
%4 = tail call i32 @dlopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @setState(i32 2)
ret i8* null
}
void swapInt(int *a, int *b) {
  if (a == b)
    return;
  *a ^= *b;
  *b ^= *a;
  *a ^= *b;
}


x86 assembly (clang, -O0):
<swapInt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    111f <swapInt+0x1f>
jmp    1149 <swapInt+0x49>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swapInt>:
cmp    %rsi,%rdi
je     1111 <swapInt+0x11>
mov    (%rdi),%eax
xor    (%rsi),%eax
mov    %eax,(%rdi)
xor    (%rsi),%eax
mov    %eax,(%rsi)
xor    %eax,(%rdi)
ret

LLVM IR (-O0):
define void @swapInt(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 eq i32* %5, %6
br i1 %7, label %8, label %9
8: ; preds = %2
br label %25
9: ; preds = %2
%10 = load i32*, i32** %4
%11 = load i32, i32* %10
%12 = load i32*, i32** %3
%13 = load i32, i32* %12
%14 = xor i32 %13, %11
store i32 %14, i32* %12
%15 = load i32*, i32** %3
%16 = load i32, i32* %15
%17 = load i32*, i32** %4
%18 = load i32, i32* %17
%19 = xor i32 %18, %16
store i32 %19, i32* %17
%20 = load i32*, i32** %4
%21 = load i32, i32* %20
%22 = load i32*, i32** %3
%23 = load i32, i32* %22
%24 = xor i32 %23, %21
store i32 %24, i32* %22
br label %25
25: ; preds = %9, %8
ret void
}

LLVM IR (-O2):
define void @swapInt(i32* %0, i32* %1) {
%3 = icmp eq i32* %0, %1
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = load i32, i32* %1
%6 = load i32, i32* %0
%7 = xor i32 %6, %5
store i32 %7, i32* %0
%8 = load i32, i32* %1
%9 = xor i32 %8, %7
store i32 %9, i32* %1
%10 = load i32, i32* %0
%11 = xor i32 %10, %9
store i32 %11, i32* %0
br label %12
12: ; preds = %2, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ do_n_times(int);
void do_2_times_Good() { do_n_times(2); }


x86 assembly (clang, -O0):
<do_2_times_Good>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1030 <do_n_times@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_2_times_Good>:
mov    $0x2,%edi
jmp    1030 <do_n_times@plt>

LLVM IR (-O0):
define void @do_2_times_Good() {
%1 = call i32 @do_n_times(i32 2)
ret void
}

LLVM IR (-O2):
define void @do_2_times_Good() {
%1 = tail call i32 @do_n_times(i32 2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char *);
int write_chunk(int, char *, int /*<<< orphan*/);
int write_string(int fd, char *s) { return write_chunk(fd, s, strlen(s)); }


x86 assembly (clang, -O0):
<write_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1040 <write_chunk@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_string>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <write_chunk@plt>

LLVM IR (-O0):
define i32 @write_string(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 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @write_chunk(i32 %5, i8* %6, i32 %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @write_string(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @write_chunk(i32 %0, i8* %1, i32 %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void imprimir_vetor(int vetor[], int N) {
  int i;
  for (i = 0; i < N; i++) {
    printf("%d\t", vetor[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<imprimir_vetor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <imprimir_vetor+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <imprimir_vetor+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imprimir_vetor>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <imprimir_vetor+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <imprimir_vetor+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\09\00"
define void @imprimir_vetor(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
int main() {
  int beta_sysenter();
  int ret;
  int beta_notify();
  while (1) {
    asm("" ::"a"(1), "b"(2), "c"(3), "d"(4), "D"(5));
    ret = beta_sysenter();
    asm("" ::"a"(ret));
    int i = 100000;
    while (i--)
      ;
    beta_notify();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x18,%rsp
movl   $0x0,-0xc(%rbp)
mov    $0x1,%eax
mov    $0x2,%ebx
mov    $0x3,%ecx
mov    $0x4,%edx
mov    $0x5,%edi
mov    $0x0,%al
call   1040 <beta_sysenter@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
movl   $0x186a0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
je     1176 <main+0x56>
jmp    115d <main+0x3d>
mov    $0x0,%al
call   1030 <beta_notify@plt>
jmp    1130 <main+0x10>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x2,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0x1,%eax
mov    $0x3,%ecx
mov    $0x4,%edx
mov    $0x5,%edi
xor    %eax,%eax
call   1040 <beta_sysenter@plt>
xor    %eax,%eax
call   1030 <beta_notify@plt>
jmp    1130 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %0, %12
%5 = call i32 (...) @beta_sysenter()
store i32 %5, i32* %2
%6 = load i32, i32* %2
store i32 100000, i32* %3
br label %7
7: ; preds = %11, %4
%8 = load i32, i32* %3
%9 = add nsw i32 %8, -1
store i32 %9, i32* %3
%10 = icmp ne i32 %8, 0
br i1 %10, label %11, label %12
11: ; preds = %7
br label %7
12: ; preds = %7
%13 = call i32 (...) @beta_notify()
br label %4
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
tail call void asm sideeffect "", "{ax},{bx},{cx},{dx},{di},~{dirflag},~{fpsr},~{flags}"(i32 1, i32 2, i32 3, i32 4, i32 5)
%2 = tail call i32 (...) @beta_sysenter()
tail call void asm sideeffect "", "{ax},~{dirflag},~{fpsr},~{flags}"(i32 %2)
%3 = tail call i32 (...) @beta_notify()
br label %1
}
__attribute__((no, noclone)) unsigned __int128 t102_4sub(signed char x) {
  unsigned short y = (5);
  unsigned __int128 r;
  if (__builtin_sub_overflow(x, y, &r))
    bar();
  return r;
}


x86 assembly (clang, -O0):
<t102_4sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dil,%al
mov    %al,-0x11(%rbp)
movw   $0x5,-0x14(%rbp)
movsbq -0x11(%rbp),%rdx
mov    %rdx,%r9
sar    $0x3f,%r9
movzwl -0x14(%rbp),%eax
sub    %rax,%rdx
mov    %r9,%rcx
sbb    $0x0,%rcx
mov    %r9,%r8
sbb    $0x0,%r8
sbb    $0x0,%r9
mov    %r8d,%eax
and    $0x1,%eax
mov    %eax,%esi
mov    %rsi,%rax
neg    %rax
mov    %rax,%rdi
xor    %r9,%rdi
xor    %r8,%rax
or     %rdi,%rax
or     %rsi,%rax
setne  %al
mov    %rdx,-0x30(%rbp)
mov    %rcx,-0x28(%rbp)
test   $0x1,%al
jne    117e <t102_4sub+0x6e>
jmp    1185 <t102_4sub+0x75>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t102_4sub>:
push   %r14
push   %rbx
push   %rax
movslq %edi,%r14
mov    %r14,%rbx
sar    $0x3f,%rbx
add    $0xfffffffffffffffb,%r14
adc    $0xffffffffffffffff,%rbx
cmp    $0x4,%dil
jg     1133 <t102_4sub+0x23>
xor    %eax,%eax
call   1030 <bar@plt>
mov    %r14,%rax
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define { i64, i64 } @t102_4sub(i8 signext %0) {
%2 = alloca i128
%3 = alloca i8
%4 = alloca i16
%5 = alloca i128
store i8 %0, i8* %3
store i16 5, i16* %4
%6 = load i8, i8* %3
%7 = load i16, i16* %4
%8 = sext i8 %6 to i129
%9 = zext i16 %7 to i129
%10 = call { i129, i1 } @llvm.ssub.with.overflow.i129(i129 %8, i129 %9)
%11 = extractvalue { i129, i1 } %10, 1
%12 = extractvalue { i129, i1 } %10, 0
%13 = trunc i129 %12 to i128
%14 = zext i128 %13 to i129
%15 = icmp ne i129 %12, %14
%16 = or i1 %11, %15
store i128 %13, i128* %5
br i1 %16, label %17, label %19
17: ; preds = %1
%18 = call i32 (...) @bar()
br label %19
19: ; preds = %17, %1
%20 = load i128, i128* %5
store i128 %20, i128* %2
%21 = bitcast i128* %2 to { i64, i64 }*
%22 = load { i64, i64 }, { i64, i64 }* %21
ret { i64, i64 } %22
}

LLVM IR (-O2):
define { i64, i64 } @t102_4sub(i8 signext %0) {
%2 = sext i8 %0 to i129
%3 = add nsw i129 %2, -5
%4 = icmp slt i8 %0, 5
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 (...) @bar()
br label %7
7: ; preds = %5, %1
%8 = trunc i129 %3 to i64
%9 = lshr i129 %3, 64
%10 = trunc i129 %9 to i64
%11 = insertvalue { i64, i64 } poison, i64 %8, 0
%12 = insertvalue { i64, i64 } %11, i64 %10, 1
ret { i64, i64 } %12
}
void legal() {
  short q[][3][2] = {{1}, {2, 3}, {4, 5, 6}};
  int q_sizecheck[(sizeof(q) / sizeof(short[3][2])) == 3 ? 1 : -1];
}


x86 assembly (clang, -O0):
<legal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x24,%edx
call   1030 <memset@plt>
movw   $0x1,-0x30(%rbp)
movw   $0x2,-0x24(%rbp)
movw   $0x3,-0x22(%rbp)
movw   $0x4,-0x18(%rbp)
movw   $0x5,-0x16(%rbp)
movw   $0x6,-0x14(%rbp)
add    $0x40,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @legal() {
%1 = alloca [3 x [3 x [2 x i16]]]
%2 = alloca [1 x i32]
%3 = bitcast [3 x [3 x [2 x i16]]]* %1 to i8*
%4 = bitcast i8* %3 to [3 x [3 x [2 x i16]]]*
%5 = getelementptr inbounds [3 x [3 x [2 x i16]]], [3 x [3 x [2 x i16]]]* %4, i32 0, i32 0
%6 = getelementptr inbounds [3 x [2 x i16]], [3 x [2 x i16]]* %5, i32 0, i32 0
%7 = getelementptr inbounds [2 x i16], [2 x i16]* %6, i32 0, i32 0
store i16 1, i16* %7
%8 = getelementptr inbounds [3 x [3 x [2 x i16]]], [3 x [3 x [2 x i16]]]* %4, i32 0, i32 1
%9 = getelementptr inbounds [3 x [2 x i16]], [3 x [2 x i16]]* %8, i32 0, i32 0
%10 = getelementptr inbounds [2 x i16], [2 x i16]* %9, i32 0, i32 0
store i16 2, i16* %10
%11 = getelementptr inbounds [2 x i16], [2 x i16]* %9, i32 0, i32 1
store i16 3, i16* %11
%12 = getelementptr inbounds [3 x [3 x [2 x i16]]], [3 x [3 x [2 x i16]]]* %4, i32 0, i32 2
%13 = getelementptr inbounds [3 x [2 x i16]], [3 x [2 x i16]]* %12, i32 0, i32 0
%14 = getelementptr inbounds [2 x i16], [2 x i16]* %13, i32 0, i32 0
store i16 4, i16* %14
%15 = getelementptr inbounds [2 x i16], [2 x i16]* %13, i32 0, i32 1
store i16 5, i16* %15
%16 = getelementptr inbounds [3 x [2 x i16]], [3 x [2 x i16]]* %12, i32 0, i32 1
%17 = getelementptr inbounds [2 x i16], [2 x i16]* %16, i32 0, i32 0
store i16 6, i16* %17
ret void
}

LLVM IR (-O2):
define void @legal() {
ret void
}
/* Variables and functions */
int strcmp(char const *const, char const *const);
int gca_search_charptr(const void *aa, void *bb) {
  const char *const a = *(const char *const *)aa;
  const char *const b = *(char *const *)bb;
  return strcmp(a, b);
}


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

x86 assembly (clang, -O2):
<gca_search_charptr>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @gca_search_charptr(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(1) %6)
ret i32 %7
}
int dec2bcd(int dec) { return ((dec / 10) << 4) + dec % 10; }


x86 assembly (clang, -O0):
<dec2bcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
shl    $0x4,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%eax
add    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dec2bcd>:
movslq %edi,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
mov    %ecx,%edx
shl    $0x4,%edx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    %edx,%eax
ret

LLVM IR (-O0):
define i32 @dec2bcd(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sdiv i32 %3, 10
%5 = shl i32 %4, 4
%6 = load i32, i32* %2
%7 = srem i32 %6, 10
%8 = add nsw i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @dec2bcd(i32 %0) {
%2 = sdiv i32 %0, 10
%3 = shl i32 %2, 4
%4 = srem i32 %0, 10
%5 = add nsw i32 %3, %4
ret i32 %5
}
/* Variables and functions */
int f2(int);
int func(int y, int z) {
  int x;
  int __cil_tmp4;
  {
    { x = f2(x); }
    {
      __cil_tmp4 = x + y;
      return (__cil_tmp4 + z);
    }
  }
}


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

x86 assembly (clang, -O2):
<func>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <f2@plt>
add    %ebx,%ebp
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @func(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %5
%8 = call i32 @f2(i32 %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = load i32, i32* %3
%11 = add nsw i32 %9, %10
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = load i32, i32* %4
%14 = add nsw i32 %12, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @func(i32 %0, i32 %1) {
%3 = tail call i32 @f2(i32 undef)
%4 = add i32 %1, %0
%5 = add i32 %4, %3
ret i32 %5
}
unsigned xrop3_232_1_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk2 = S ^ T;
  stk3 = D ^ S;
  stk2 = stk2 & stk3;
  stk1 = S ^ stk2;
  return (stk1 & (~S)) | (D & S);
}


x86 assembly (clang, -O0):
<xrop3_232_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
and    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_232_1_0>:
mov    %edi,%eax
shl    $0x8,%eax
or     %edi,%eax
mov    %esi,%ecx
shl    $0x8,%ecx
or     %esi,%ecx
xor    %eax,%ecx
not    %eax
and    %ecx,%eax
movzbl %al,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_232_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = xor i32 %23, %24
store i32 %25, i32* %9
%26 = load i32, i32* %5
%27 = load i32, i32* %6
%28 = xor i32 %26, %27
store i32 %28, i32* %10
%29 = load i32, i32* %9
%30 = load i32, i32* %10
%31 = and i32 %29, %30
store i32 %31, i32* %9
%32 = load i32, i32* %6
%33 = load i32, i32* %9
%34 = xor i32 %32, %33
store i32 %34, i32* %8
%35 = load i32, i32* %8
%36 = load i32, i32* %6
%37 = xor i32 %36, -1
%38 = and i32 %35, %37
%39 = load i32, i32* %5
%40 = load i32, i32* %6
%41 = and i32 %39, %40
%42 = or i32 %38, %41
ret i32 %42
}

LLVM IR (-O2):
define i32 @xrop3_232_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = xor i32 %6, %4
%8 = and i32 %4, 255
%9 = xor i32 %8, 255
%10 = and i32 %9, %7
%11 = or i32 %10, %3
ret i32 %11
}
int mus_mixer_get_level(int device) {
  printf("%s not implemented\n", __func__);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [20 x i8] c"%s not implemented\0A\00"
@__func__.mus_mixer_get_level = [20 x i8] c"mus_mixer_get_level\00"
define i32 @mus_mixer_get_level(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @__func__.mus_mixer_get_level, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"%s not implemented\0A\00"
@__func__.mus_mixer_get_level = [20 x i8] c"mus_mixer_get_level\00"
define i32 @mus_mixer_get_level(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @__func__.mus_mixer_get_level, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int __gpio_cansleep(unsigned int);
int gpio_cansleep(unsigned gpio) { return __gpio_cansleep(gpio); }


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

x86 assembly (clang, -O2):
<gpio_cansleep>:
jmp    1030 <__gpio_cansleep@plt>

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

LLVM IR (-O2):
define i32 @gpio_cansleep(i32 %0) {
%2 = tail call i32 @__gpio_cansleep(i32 %0)
ret i32 %2
}
int cycle_is_check_spr_disp(unsigned int flags) {
  return (flags & 0x0e000000) == 0x04000000;
}


x86 assembly (clang, -O0):
<cycle_is_check_spr_disp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xe000000,%eax
cmp    $0x4000000,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cycle_is_check_spr_disp>:
and    $0xe000000,%edi
xor    %eax,%eax
cmp    $0x4000000,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @cycle_is_check_spr_disp(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 234881024
%5 = icmp eq i32 %4, 67108864
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @cycle_is_check_spr_disp(i32 %0) {
%2 = and i32 %0, 234881024
%3 = icmp eq i32 %2, 67108864
%4 = zext i1 %3 to i32
ret i32 %4
}
int my_strlen(char *str) {
  int i;
  i = 0;
  if (str)
    while (str[i])
      i++;
  return (i);
}


x86 assembly (clang, -O0):
<my_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1144 <my_strlen+0x44>
jmp    111f <my_strlen+0x1f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     113f <my_strlen+0x3f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    111f <my_strlen+0x1f>
jmp    1144 <my_strlen+0x44>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strlen>:
test   %rdi,%rdi
je     111d <my_strlen+0x1d>
mov    $0xffffffff,%eax
nopw   0x0(%rax,%rax,1)
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <my_strlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @my_strlen(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %8, %3 ], [ 0, %1 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = add nuw i64 %4, 1
br i1 %7, label %9, label %3
9: ; preds = %3
%10 = trunc i64 %4 to i32
br label %11
11: ; preds = %9, %1
%12 = phi i32 [ 0, %1 ], [ %10, %9 ]
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, double, double);
void GPS_Fmt_Print_Position(double lat, double lon, FILE *outf) {
  (void)fprintf(outf, "Latitude: %f   Longitude %f\n", lat, lon);
  fflush(outf);
  return;
}


x86 assembly (clang, -O0):
<GPS_Fmt_Print_Position>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
lea    0xeb5(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fflush@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPS_Fmt_Print_Position>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rsi
call   1030 <fprintf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"Latitude: %f Longitude %f\0A\00"
define void @GPS_Fmt_Print_Position(double %0, double %1, i32* %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca i32*
store double %0, double* %4
store double %1, double* %5
store i32* %2, i32** %6
%7 = load i32*, i32** %6
%8 = load double, double* %4
%9 = load double, double* %5
%10 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), double %8, double %9)
%11 = load i32*, i32** %6
%12 = call i32 @fflush(i32* %11)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"Latitude: %f Longitude %f\0A\00"
define void @GPS_Fmt_Print_Position(double %0, double %1, i32* nocapture %2) {
%4 = tail call i32 @fprintf(i32* %2, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), double %0, double %1)
%5 = tail call i32 @fflush(i32* %2)
ret void
}
/* Variables and functions */
double __nv_dsub_rn(double, double);
double __dsub_rn(double __a, double __b) { return __nv_dsub_rn(__a, __b); }


x86 assembly (clang, -O0):
<__dsub_rn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <__nv_dsub_rn@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__dsub_rn>:
jmp    1030 <__nv_dsub_rn@plt>

LLVM IR (-O0):
define double @__dsub_rn(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = call double @__nv_dsub_rn(double %5, double %6)
ret double %7
}

LLVM IR (-O2):
define double @__dsub_rn(double %0, double %1) {
%3 = tail call double @__nv_dsub_rn(double %0, double %1)
ret double %3
}
void fun(float *a, float *b) {
  a[17] = a[0] + a[18];
  b[17] = b[1] + a[18];
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
addss  0x48(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x44(%rax)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x8(%rbp),%rax
addss  0x48(%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x44(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
movss  0x48(%rdi),%xmm0
movss  (%rdi),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x44(%rdi)
addss  0x4(%rsi),%xmm0
movss  %xmm0,0x44(%rsi)
ret

LLVM IR (-O0):
define void @fun(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 = getelementptr inbounds float, float* %5, i64 0
%7 = load float, float* %6
%8 = load float*, float** %3
%9 = getelementptr inbounds float, float* %8, i64 18
%10 = load float, float* %9
%11 = fadd float %7, %10
%12 = load float*, float** %3
%13 = getelementptr inbounds float, float* %12, i64 17
store float %11, float* %13
%14 = load float*, float** %4
%15 = getelementptr inbounds float, float* %14, i64 1
%16 = load float, float* %15
%17 = load float*, float** %3
%18 = getelementptr inbounds float, float* %17, i64 18
%19 = load float, float* %18
%20 = fadd float %16, %19
%21 = load float*, float** %4
%22 = getelementptr inbounds float, float* %21, i64 17
store float %20, float* %22
ret void
}

LLVM IR (-O2):
define void @fun(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = getelementptr inbounds float, float* %0, i64 18
%5 = load float, float* %4
%6 = fadd float %3, %5
%7 = getelementptr inbounds float, float* %0, i64 17
store float %6, float* %7
%8 = getelementptr inbounds float, float* %1, i64 1
%9 = load float, float* %8
%10 = fadd float %5, %9
%11 = getelementptr inbounds float, float* %1, i64 17
store float %10, float* %11
ret void
}
/* Variables and functions */
scalar_t__ malloc(long);
int /*<<< orphan*/ nrerror(char *);
float *vector(long nl, long nh) {
  float *v;
  v = (float *)malloc(((nh - nl + 1 + 1) * sizeof(float)));
  if (!v)
    nrerror("Error(vector): allocation failure\n");
  return v - nl + 1;
}


x86 assembly (clang, -O0):
<vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
sub    -0x8(%rbp),%rdi
add    $0x1,%rdi
add    $0x1,%rdi
shl    $0x2,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1164 <vector+0x44>
lea    0xea1(%rip),%rdi
call   1030 <nrerror@plt>
mov    -0x18(%rbp),%rax
xor    %ecx,%ecx
sub    -0x8(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
add    $0x4,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vector>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
sub    %rdi,%rsi
lea    0x8(,%rsi,4),%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114b <vector+0x2b>
lea    0xeba(%rip),%rdi
call   1030 <nrerror@plt>
shl    $0x2,%r14
sub    %r14,%rbx
add    $0x4,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Error(vector): allocation failure\0A\00"
define float* @vector(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca float*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = load i64, i64* %3
%8 = sub nsw i64 %6, %7
%9 = add nsw i64 %8, 1
%10 = add nsw i64 %9, 1
%11 = mul i64 %10, 4
%12 = call i64 @malloc(i64 %11)
%13 = inttoptr i64 %12 to float*
store float* %13, float** %5
%14 = load float*, float** %5
%15 = icmp ne float* %14, null
br i1 %15, label %18, label %16
16: ; preds = %2
%17 = call i32 @nrerror(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %2
%19 = load float*, float** %5
%20 = load i64, i64* %3
%21 = sub i64 0, %20
%22 = getelementptr inbounds float, float* %19, i64 %21
%23 = getelementptr inbounds float, float* %22, i64 1
ret float* %23
}

LLVM IR (-O2):
@.str = [35 x i8] c"Error(vector): allocation failure\0A\00"
define float* @vector(i64 %0, i64 %1) {
%3 = sub nsw i64 %1, %0
%4 = shl i64 %3, 2
%5 = add i64 %4, 8
%6 = tail call i64 @malloc(i64 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @nrerror(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = inttoptr i64 %6 to float*
%12 = sub i64 0, %0
%13 = getelementptr inbounds float, float* %11, i64 %12
%14 = getelementptr inbounds float, float* %13, i64 1
ret float* %14
}
char int_to_char(int i) { return i + '0'; }


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

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

LLVM IR (-O0):
define signext i8 @int_to_char(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 48
%5 = trunc i32 %4 to i8
ret i8 %5
}

LLVM IR (-O2):
define signext i8 @int_to_char(i32 %0) {
%2 = trunc i32 %0 to i8
%3 = add i8 %2, 48
ret i8 %3
}
/* Type definitions */
struct kfifo {
  int dummy;
};

/* Variables and functions */
int kfifo_free(struct kfifo *);
int kfifo_size(struct kfifo *);
int kfifo_ready(struct kfifo *kfifo) {
  if (kfifo) {
    return kfifo_size(kfifo) - kfifo_free(kfifo);
  }
  return 0;
}


x86 assembly (clang, -O0):
<kfifo_ready>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     115b <kfifo_ready+0x3b>
mov    -0x10(%rbp),%rdi
call   1040 <kfifo_size@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <kfifo_free@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1162 <kfifo_ready+0x42>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kfifo_ready>:
push   %rbp
push   %rbx
push   %rax
test   %rdi,%rdi
je     113e <kfifo_ready+0x1e>
mov    %rdi,%rbx
call   1040 <kfifo_size@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <kfifo_free@plt>
sub    %eax,%ebp
jmp    1140 <kfifo_ready+0x20>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.kfifo = type { i32 }
define i32 @kfifo_ready(%struct.kfifo* %0) {
%2 = alloca i32
%3 = alloca %struct.kfifo*
store %struct.kfifo* %0, %struct.kfifo** %3
%4 = load %struct.kfifo*, %struct.kfifo** %3
%5 = icmp ne %struct.kfifo* %4, null
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load %struct.kfifo*, %struct.kfifo** %3
%8 = call i32 @kfifo_size(%struct.kfifo* %7)
%9 = load %struct.kfifo*, %struct.kfifo** %3
%10 = call i32 @kfifo_free(%struct.kfifo* %9)
%11 = sub nsw i32 %8, %10
store i32 %11, i32* %2
br label %13
12: ; preds = %1
store i32 0, i32* %2
br label %13
13: ; preds = %12, %6
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
%struct.kfifo = type { i32 }
define i32 @kfifo_ready(%struct.kfifo* %0) {
%2 = icmp eq %struct.kfifo* %0, null
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i32 @kfifo_size(%struct.kfifo* %0)
%5 = tail call i32 @kfifo_free(%struct.kfifo* %0)
%6 = sub nsw i32 %4, %5
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ 0, %1 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_line(char str[]) {
  int i = 0;
  while (str[i] != '\0') {
    printf("%c", str[i]);
    i++;
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1160 <print_line+0x50>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <print_line+0x13>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_line(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %12, %1
%5 = load i8*, i8** %2
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %22
12: ; preds = %4
%13 = load i8*, i8** %2
%14 = load i32, i32* %3
%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
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %4
22: ; preds = %4
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
define void @print_line(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %9, %4 ], [ 0, %1 ]
%6 = phi i8 [ %11, %4 ], [ %2, %1 ]
%7 = sext i8 %6 to i32
%8 = tail call i32 @putchar(i32 %7)
%9 = add nuw i64 %5, 1
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %1
%14 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
char *_itoa(int, char *, int, int);
char *itoa(int n, char *buf, int base) { return _itoa(n, buf, base, 1); }


x86 assembly (clang, -O0):
<itoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    $0x1,%ecx
call   1030 <_itoa@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<itoa>:
mov    $0x1,%ecx
jmp    1030 <_itoa@plt>

LLVM IR (-O0):
define i8* @itoa(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i8* @_itoa(i32 %7, i8* %8, i32 %9, i32 1)
ret i8* %10
}

LLVM IR (-O2):
define i8* @itoa(i32 %0, i8* %1, i32 %2) {
%4 = tail call i8* @_itoa(i32 %0, i8* %1, i32 %2, i32 1)
ret i8* %4
}
/* Variables and functions */
float sqrt(int);
float dis(int x1, int y1, int x2, int y2) {
  float a;
  a = sqrt(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
  return a;
}


x86 assembly (clang, -O0):
<dis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
sub    -0xc(%rbp),%edi
mov    -0x4(%rbp),%eax
sub    -0xc(%rbp),%eax
imul   %eax,%edi
mov    -0x8(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    -0x10(%rbp),%ecx
imul   %ecx,%eax
add    %eax,%edi
call   1030 <sqrt@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dis>:
sub    %edx,%edi
imul   %edi,%edi
sub    %ecx,%esi
imul   %esi,%esi
add    %esi,%edi
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define float @dis(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca float
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %5
%11 = load i32, i32* %7
%12 = sub nsw i32 %10, %11
%13 = load i32, i32* %5
%14 = load i32, i32* %7
%15 = sub nsw i32 %13, %14
%16 = mul nsw i32 %12, %15
%17 = load i32, i32* %6
%18 = load i32, i32* %8
%19 = sub nsw i32 %17, %18
%20 = load i32, i32* %6
%21 = load i32, i32* %8
%22 = sub nsw i32 %20, %21
%23 = mul nsw i32 %19, %22
%24 = add nsw i32 %16, %23
%25 = call float @sqrt(i32 %24)
store float %25, float* %9
%26 = load float, float* %9
ret float %26
}

LLVM IR (-O2):
define float @dis(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = sub nsw i32 %0, %2
%6 = mul nsw i32 %5, %5
%7 = sub nsw i32 %1, %3
%8 = mul nsw i32 %7, %7
%9 = add nuw nsw i32 %8, %6
%10 = tail call float @sqrt(i32 %9)
ret float %10
}
/* Variables and functions */
int /*<<< orphan*/ process_arg(int *, char **);
void process_args(int argc, char **argv) {
  int i;
  if (argc > 1) {
    for (i = 1; i < argc; ++i)
      process_arg(&i, argv);
  }
}


x86 assembly (clang, -O0):
<process_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x4(%rbp)
jle    115c <process_args+0x4c>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1157 <process_args+0x47>
mov    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdi
call   1030 <process_arg@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1130 <process_args+0x20>
jmp    115c <process_args+0x4c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_args>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
cmp    $0x2,%edi
jl     114a <process_args+0x3a>
mov    %rsi,%rbx
mov    %edi,%ebp
movl   $0x1,0xc(%rsp)
lea    0xc(%rsp),%r14
nop
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <process_arg@plt>
mov    0xc(%rsp),%eax
add    $0x1,%eax
mov    %eax,0xc(%rsp)
cmp    %ebp,%eax
jl     1130 <process_args+0x20>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @process_args(i32 %0, i8** %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %12
6: ; preds = %2
store i32 1, i32* %3
br label %7
7: ; preds = %6, %7
%8 = call i32 @process_arg(i32* %3, i8** %1)
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
store i32 %10, i32* %3
%11 = icmp slt i32 %10, %0
br i1 %11, label %7, label %12
12: ; preds = %7, %2
ret void
}