xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ stdin;
int vfwscanf(int /*<<< orphan*/, int /*<<< orphan*/ const *,
             int /*<<< orphan*/);
int vwscanf(const wchar_t *__restrict__ format, va_list arg) {
  return vfwscanf(stdin, format, arg);
}


x86 assembly (clang, -O0):
<vwscanf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <vfwscanf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vwscanf>:
mov    %esi,%edx
mov    %rdi,%rsi
mov    0x2ecc(%rip),%rax
mov    (%rax),%edi
jmp    1030 <vfwscanf@plt>

LLVM IR (-O0):
@stdin = global i32 0
define i32 @vwscanf(i32* noalias %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* @stdin
%6 = load i32*, i32** %3
%7 = load i32, i32* %4
%8 = call i32 @vfwscanf(i32 %5, i32* %6, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
@stdin = global i32 0
define i32 @vwscanf(i32* noalias %0, i32 %1) {
%3 = load i32, i32* @stdin
%4 = tail call i32 @vfwscanf(i32 %3, i32* %0, i32 %1)
ret i32 %4
}
int main() {
  unsigned int a = 0;
  unsigned int counter = 10;
  while (counter > 0) {
    a++;
    counter--;
  }
  return a;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jbe    113a <main+0x3a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1119 <main+0x19>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 10
}
float testf(float x, int sel1, int sel2) {
  float input = sel1 ? -x : __builtin_fabsf(x);
  if (sel2)
    return __builtin_cosf(input);
  else
    return __builtin_sinf(input);
}


x86 assembly (clang, -O0):
<testf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1159 <testf+0x39>
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    116e <testf+0x4e>
movss  -0x8(%rbp),%xmm0
movaps 0xe9b(%rip),%xmm1
pand   %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1196 <testf+0x76>
movss  -0x14(%rbp),%xmm0
call   1040 <cosf@plt>
movss  %xmm0,-0x4(%rbp)
jmp    11a5 <testf+0x85>
movss  -0x14(%rbp),%xmm0
call   1030 <sinf@plt>
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testf>:
test   %edi,%edi
je     1134 <testf+0x14>
xorps  0xed5(%rip),%xmm0
test   %esi,%esi
je     113f <testf+0x1f>
jmp    1040 <cosf@plt>
andps  0xed5(%rip),%xmm0
test   %esi,%esi
jne    112f <testf+0xf>
jmp    1030 <sinf@plt>

LLVM IR (-O0):
define float @testf(float %0, i32 %1, i32 %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca i32
%7 = alloca i32
%8 = alloca float
store float %0, float* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%9 = load i32, i32* %6
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %3
%12 = load float, float* %5
%13 = fneg float %12
br label %17
14: ; preds = %3
%15 = load float, float* %5
%16 = call float @llvm.fabs.f32(float %15)
br label %17
17: ; preds = %14, %11
%18 = phi float [ %13, %11 ], [ %16, %14 ]
store float %18, float* %8
%19 = load i32, i32* %7
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load float, float* %8
%23 = call float @cosf(float %22)
store float %23, float* %4
br label %27
24: ; preds = %17
%25 = load float, float* %8
%26 = call float @sinf(float %25)
store float %26, float* %4
br label %27
27: ; preds = %24, %21
%28 = load float, float* %4
ret float %28
}

LLVM IR (-O2):
define float @testf(float %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, 0
%5 = fneg float %0
%6 = tail call float @llvm.fabs.f32(float %0)
%7 = select i1 %4, float %6, float %5
%8 = icmp eq i32 %2, 0
br i1 %8, label %11, label %9
9: ; preds = %3
%10 = tail call float @cosf(float %7)
br label %13
11: ; preds = %3
%12 = tail call float @sinf(float %7)
br label %13
13: ; preds = %11, %9
%14 = phi float [ %10, %9 ], [ %12, %11 ]
ret float %14
}
/* Variables and functions */
int wavToRawEx(char *, char *, int /*<<< orphan*/);
int wavToRaw(char *fin, char *fout) { return wavToRawEx(fin, fout, 0); }


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

x86 assembly (clang, -O2):
<wavToRaw>:
xor    %edx,%edx
jmp    1030 <wavToRawEx@plt>

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

LLVM IR (-O2):
define i32 @wavToRaw(i8* %0, i8* %1) {
%3 = tail call i32 @wavToRawEx(i8* %0, i8* %1, i32 0)
ret i32 %3
}
int seq_utils_clamp(int val, int min, int max) {
  if (val < min) {
    return min;
  }
  if (val > max) {
    return max;
  }
  return val;
}


x86 assembly (clang, -O0):
<seq_utils_clamp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1124 <seq_utils_clamp+0x24>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <seq_utils_clamp+0x41>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    113b <seq_utils_clamp+0x3b>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <seq_utils_clamp+0x41>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<seq_utils_clamp>:
mov    %edx,%eax
cmp    %edx,%edi
cmovle %edi,%eax
cmp    %esi,%edi
cmovl  %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @seq_utils_clamp(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, %1
%5 = icmp sgt i32 %0, %2
%6 = select i1 %5, i32 %2, i32 %0
%7 = select i1 %4, i32 %1, i32 %6
ret i32 %7
}
int main() {
  unsigned int ui = 12;
  unsigned long ul = 34;
  return ui + ul;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0xc,-0x8(%rbp)
movq   $0x22,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
store i32 0, i32* %1
store i32 12, i32* %2
store i64 34, i64* %3
%4 = load i32, i32* %2
%5 = zext i32 %4 to i64
%6 = load i64, i64* %3
%7 = add i64 %5, %6
%8 = trunc i64 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @main() {
ret i32 46
}
/* Variables and functions */
int /*<<< orphan*/ nrand(int);
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
int /*<<< orphan*/ sleep(int /*<<< orphan*/);
void *suprabhat(void *threadid) {
  long tid;
  tid = (long)threadid;
  printf("Suprabhat, thread #%ld!\n", tid);
  sleep(nrand(4));
  printf("Dhanyawad, thread #%ld!\n", tid);
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<suprabhat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xea1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x4,%edi
call   1030 <nrand@plt>
mov    %eax,%edi
call   1060 <sleep@plt>
mov    -0x18(%rbp),%rsi
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<suprabhat>:
push   %rbx
mov    %rdi,%rbx
lea    0xeb5(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    $0x4,%edi
call   1030 <nrand@plt>
mov    %eax,%edi
call   1060 <sleep@plt>
lea    0xeae(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %edi,%edi
pop    %rbx
jmp    1050 <pthread_exit@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Suprabhat, thread #%ld!\0A\00"
@.str.1 = [25 x i8] c"Dhanyawad, thread #%ld!\0A\00"
define i8* @suprabhat(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = ptrtoint i8* %5 to i64
store i64 %6, i64* %4
%7 = load i64, i64* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i64 %7)
%9 = call i32 @nrand(i32 4)
%10 = call i32 @sleep(i32 %9)
%11 = load i64, i64* %4
%12 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i64 %11)
%13 = call i32 @pthread_exit(i32* null)
%14 = load i8*, i8** %2
ret i8* %14
}

LLVM IR (-O2):
@.str = [25 x i8] c"Suprabhat, thread #%ld!\0A\00"
@.str.1 = [25 x i8] c"Dhanyawad, thread #%ld!\0A\00"
define noalias i8* @suprabhat(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i64 %2)
%4 = tail call i32 @nrand(i32 4)
%5 = tail call i32 @sleep(i32 %4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i64 %2)
%7 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void ft_strdel(char **as) {
  if (!as)
    return;
  free(*as);
  if (*as != NULL)
    *as = NULL;
}


x86 assembly (clang, -O0):
<ft_strdel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112c <ft_strdel+0x1c>
jmp    1151 <ft_strdel+0x41>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1151 <ft_strdel+0x41>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strdel>:
push   %rbx
test   %rdi,%rdi
je     112e <ft_strdel+0x1e>
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <free@plt>
cmpq   $0x0,(%rbx)
je     112e <ft_strdel+0x1e>
movq   $0x0,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @ft_strdel(i8** %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = load i8*, i8** %0
%5 = tail call i32 @free(i8* %4)
%6 = load i8*, i8** %0
%7 = icmp eq i8* %6, null
br i1 %7, label %9, label %8
8: ; preds = %3
store i8* null, i8** %0
br label %9
9: ; preds = %1, %8, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void main(void) { printf("Greet World\n"); }


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

x86 assembly (clang, -O2):
<main>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@str = [12 x i8] c"Greet World\00"
define void @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ getline(char *);
int main() {
  char c[100];
  getline(c);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
sub    $0x68,%rsp
mov    %rsp,%rdi
call   1030 <getline@plt>
xor    %eax,%eax
add    $0x68,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = call i32 @getline(i8* %3)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @getline(i8* %2)
ret i32 0
}
/* Type definitions */
typedef int off_t;

/* Variables and functions */
int /*<<< orphan*/ SEEK_CUR;
int /*<<< orphan*/ STDIN_FILENO;
int lseek(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int main(void) {
  off_t stdin_offset;
  stdin_offset = lseek(STDIN_FILENO, 0, SEEK_CUR);
  if (stdin_offset == -1) {
    perror("stdin is not seekable");
  } else {
    printf("stdin is seekable\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
mov    0x2e99(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <lseek@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    1176 <main+0x46>
lea    0xe94(%rip),%rdi
call   1050 <perror@plt>
jmp    1182 <main+0x52>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
mov    0x2ea7(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <lseek@plt>
cmp    $0xffffffff,%eax
je     115f <main+0x2f>
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xe9a(%rip),%rdi
call   1050 <perror@plt>
jmp    115b <main+0x2b>

LLVM IR (-O0):
@STDIN_FILENO = global i32 0
@SEEK_CUR = global i32 0
@.str = [22 x i8] c"stdin is not seekable\00"
@.str.1 = [19 x i8] c"stdin is seekable\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* @STDIN_FILENO
%4 = load i32, i32* @SEEK_CUR
%5 = call i32 @lseek(i32 %3, i32 0, i32 %4)
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
ret i32 0
}

LLVM IR (-O2):
@STDIN_FILENO = global i32 0
@SEEK_CUR = global i32 0
@.str = [22 x i8] c"stdin is not seekable\00"
@str = [18 x i8] c"stdin is seekable\00"
define i32 @main() {
%1 = load i32, i32* @STDIN_FILENO
%2 = load i32, i32* @SEEK_CUR
%3 = tail call i32 @lseek(i32 %1, i32 0, i32 %2)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = tail call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %9
7: ; preds = %0
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %9
9: ; preds = %7, %5
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ failed(char const *, char *);
void error(const char *s) { failed(s, ((char *)0)); }


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

x86 assembly (clang, -O2):
<error>:
xor    %esi,%esi
jmp    1030 <failed@plt>

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

LLVM IR (-O2):
define void @error(i8* %0) {
%2 = tail call i32 @failed(i8* %0, i8* null)
ret void
}
void dcache_clean_all(void) {}


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

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

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

LLVM IR (-O2):
define void @dcache_clean_all() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ i2c_start();
int /*<<< orphan*/ i2c_stop();
int /*<<< orphan*/ i2c_write(unsigned char);
void ds1337_write_register(unsigned char reg, unsigned char data) {
  i2c_start();
  i2c_write(0b11010000);
  i2c_write(reg);
  i2c_write(data);
  i2c_stop();
}


x86 assembly (clang, -O0):
<ds1337_write_register>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    $0x0,%al
call   1050 <i2c_start@plt>
mov    $0xd0,%edi
call   1030 <i2c_write@plt>
movzbl -0x1(%rbp),%edi
call   1030 <i2c_write@plt>
movzbl -0x2(%rbp),%edi
call   1030 <i2c_write@plt>
mov    $0x0,%al
call   1040 <i2c_stop@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ds1337_write_register>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1050 <i2c_start@plt>
mov    $0xd0,%edi
call   1030 <i2c_write@plt>
mov    %ebp,%edi
call   1030 <i2c_write@plt>
mov    %ebx,%edi
call   1030 <i2c_write@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <i2c_stop@plt>

LLVM IR (-O0):
define void @ds1337_write_register(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = call i32 (...) @i2c_start()
%6 = call i32 @i2c_write(i8 zeroext -48)
%7 = load i8, i8* %3
%8 = call i32 @i2c_write(i8 zeroext %7)
%9 = load i8, i8* %4
%10 = call i32 @i2c_write(i8 zeroext %9)
%11 = call i32 (...) @i2c_stop()
ret void
}

LLVM IR (-O2):
define void @ds1337_write_register(i8 zeroext %0, i8 zeroext %1) {
%3 = tail call i32 (...) @i2c_start()
%4 = tail call i32 @i2c_write(i8 zeroext -48)
%5 = tail call i32 @i2c_write(i8 zeroext %0)
%6 = tail call i32 @i2c_write(i8 zeroext %1)
%7 = tail call i32 (...) @i2c_stop()
ret void
}
int fun400() { return 400; }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    $0x190,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    $0x190,%eax
ret

LLVM IR (-O0):
define i32 @fun400() {
ret i32 400
}

LLVM IR (-O2):
define i32 @fun400() {
ret i32 400
}
double quarticEaseOutd(double p) {
  double f = (p - 1);
  return f * f * f * (1 - p) + 1;
}


x86 assembly (clang, -O0):
<quarticEaseOutd>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xeca(%rip),%xmm1
subsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeb9(%rip),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<quarticEaseOutd>:
movsd  0xef8(%rip),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm1,%xmm2
movsd  0xee8(%rip),%xmm3
movapd %xmm3,%xmm1
subsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm3,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @quarticEaseOutd(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fsub double %4, 1.000000e+00
store double %5, double* %3
%6 = load double, double* %3
%7 = load double, double* %3
%8 = fmul double %6, %7
%9 = load double, double* %3
%10 = fmul double %8, %9
%11 = load double, double* %2
%12 = fsub double 1.000000e+00, %11
%13 = call double @llvm.fmuladd.f64(double %10, double %12, double 1.000000e+00)
ret double %13
}

LLVM IR (-O2):
define double @quarticEaseOutd(double %0) {
%2 = fadd double %0, -1.000000e+00
%3 = fmul double %2, %2
%4 = fmul double %2, %3
%5 = fsub double 1.000000e+00, %0
%6 = tail call double @llvm.fmuladd.f64(double %4, double %5, double 1.000000e+00)
ret double %6
}
/* Variables and functions */
int strnlen(char *, int);
void strnlen_constant0() {
  if (strnlen("123", 10) != 3)
    (void)*(char *)0;
}


x86 assembly (clang, -O0):
<strnlen_constant0>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0xa,%esi
call   1030 <strnlen@plt>
cmp    $0x3,%eax
je     112e <strnlen_constant0+0x1e>
pop    %rbp
ret

x86 assembly (clang, -O2):
<strnlen_constant0>:
lea    0xee9(%rip),%rdi
mov    $0xa,%esi
jmp    1030 <strnlen@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"123\00"
define void @strnlen_constant0() {
%1 = call i32 @strnlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 10)
%2 = icmp ne i32 %1, 3
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = load i8, i8* null
br label %5
5: ; preds = %3, %0
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"123\00"
define void @strnlen_constant0() {
%1 = tail call i32 @strnlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 10)
ret void
}
int econv(int n) { return n % 3 ? 1 : n - (int)(n / 3); }


x86 assembly (clang, -O0):
<econv>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1128 <econv+0x28>
mov    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1143 <econv+0x43>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<econv>:
imul   $0xaaaaaaab,%edi,%ecx
add    $0x2aaaaaaa,%ecx
mov    $0x1,%eax
cmp    $0x55555554,%ecx
jbe    111a <econv+0x1a>
ret
movslq %edi,%rax
imul   $0x55555555,%rax,%rax
shr    $0x20,%rax
sub    %edi,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    %eax
add    %ecx,%eax
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @econv(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = srem i32 %3, 3
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
br label %12
7: ; preds = %1
%8 = load i32, i32* %2
%9 = load i32, i32* %2
%10 = sdiv i32 %9, 3
%11 = sub nsw i32 %8, %10
br label %12
12: ; preds = %7, %6
%13 = phi i32 [ 1, %6 ], [ %11, %7 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @econv(i32 %0) {
%2 = srem i32 %0, 3
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = sdiv i32 %0, -3
%6 = add i32 %5, %0
br label %7
7: ; preds = %1, %4
%8 = phi i32 [ %6, %4 ], [ 1, %1 ]
ret i32 %8
}
/* Variables and functions */
scalar_t__ isdigit(int /*<<< orphan*/);
int hasfloat(const char *p) {
  while (isdigit(*p++)) {
    if (*p == '.' || *p == ',')
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<hasfloat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     116e <hasfloat+0x5e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
je     115d <hasfloat+0x4d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2c,%eax
jne    1169 <hasfloat+0x59>
movl   $0x1,-0x4(%rbp)
jmp    1175 <hasfloat+0x65>
jmp    111c <hasfloat+0xc>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hasfloat>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%al
add    $0x1,%rbx
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     1145 <hasfloat+0x35>
movzbl (%rbx),%eax
add    $0x1,%rbx
mov    %eax,%ecx
or     $0x2,%cl
cmp    $0x2e,%cl
jne    1120 <hasfloat+0x10>
mov    $0x1,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @hasfloat(i8* nocapture %0) {
%2 = load i8, i8* %0
br label %3
3: ; preds = %10, %1
%4 = phi i8 [ %2, %1 ], [ %11, %10 ]
%5 = phi i8* [ %0, %1 ], [ %6, %10 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = sext i8 %4 to i32
%8 = tail call i64 @isdigit(i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %3
%11 = load i8, i8* %6
switch i8 %11, label %3 [
i8 46, label %12
i8 44, label %12
]
12: ; preds = %3, %10, %10
%13 = phi i32 [ 1, %10 ], [ 1, %10 ], [ 0, %3 ]
ret i32 %13
}
/* Variables and functions */
int fork();
int /*<<< orphan*/ warn(char *);
int parent() {
  register int i;
  i = fork();
  if (i != 0) {
    if (i == -1)
      warn("try again");
  }
  return (i);
}


x86 assembly (clang, -O0):
<parent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <fork@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1157 <parent+0x37>
cmpl   $0xffffffff,-0x4(%rbp)
jne    1152 <parent+0x32>
lea    0xeb3(%rip),%rdi
call   1030 <warn@plt>
jmp    1157 <parent+0x37>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parent>:
push   %rbx
xor    %eax,%eax
call   1040 <fork@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    113b <parent+0x1b>
lea    0xeca(%rip),%rdi
call   1030 <warn@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"try again\00"
define i32 @parent() {
%1 = tail call i32 (...) @fork()
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @warn(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
ret i32 %1
}
void menuFunc(int dummy0) { return; }


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

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

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

LLVM IR (-O2):
define void @menuFunc(i32 %0) {
ret void
}
/* Variables and functions */
float sqrtf(float);
float Magnitude(float *arVec) {
  return sqrtf(arVec[0] * arVec[0] + arVec[1] * arVec[1] + arVec[2] * arVec[2]);
}


x86 assembly (clang, -O0):
<Magnitude>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x8(%rbp),%rax
mulss  0x4(%rax),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrtf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Magnitude>:
movss  (%rdi),%xmm1
movss  0x4(%rdi),%xmm0
mulss  %xmm0,%xmm0
mulss  %xmm1,%xmm1
addss  %xmm0,%xmm1
movss  0x8(%rdi),%xmm0
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     113f <Magnitude+0x2f>
sqrtss %xmm0,%xmm0
ret
jmp    1030 <sqrtf@plt>

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

LLVM IR (-O2):
define float @Magnitude(float* nocapture %0) {
%2 = load float, float* %0
%3 = getelementptr inbounds float, float* %0, i64 1
%4 = load float, float* %3
%5 = fmul float %4, %4
%6 = tail call float @llvm.fmuladd.f32(float %2, float %2, float %5)
%7 = getelementptr inbounds float, float* %0, i64 2
%8 = load float, float* %7
%9 = tail call float @llvm.fmuladd.f32(float %8, float %8, float %6)
%10 = tail call float @sqrtf(float %9)
ret float %10
}
float f_abs(float value) {
  if (value < 0.0) {
    return -value;
  }
  return value;
}


x86 assembly (clang, -O0):
<f_abs>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    113b <f_abs+0x3b>
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1145 <f_abs+0x45>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_abs>:
movaps 0xef9(%rip),%xmm2
xorps  %xmm0,%xmm2
xorps  %xmm3,%xmm3
movaps %xmm0,%xmm1
cmpltss %xmm3,%xmm1
andps  %xmm1,%xmm2
andnps %xmm0,%xmm1
orps   %xmm2,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @f_abs(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = fpext float %4 to double
%6 = fcmp olt double %5, 0.000000e+00
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load float, float* %3
%9 = fneg float %8
store float %9, float* %2
br label %12
10: ; preds = %1
%11 = load float, float* %3
store float %11, float* %2
br label %12
12: ; preds = %10, %7
%13 = load float, float* %2
ret float %13
}

LLVM IR (-O2):
define float @f_abs(float %0) {
%2 = fcmp olt float %0, 0.000000e+00
%3 = fneg float %0
%4 = select i1 %2, float %3, float %0
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void cdb_free_val(void **val) {
  if (*val)
    free(*val);
  *val = NULL;
}


x86 assembly (clang, -O0):
<cdb_free_val>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1136 <cdb_free_val+0x26>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdb_free_val>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1121 <cdb_free_val+0x11>
call   1030 <free@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @cdb_free_val(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @free(i8* %2)
br label %6
6: ; preds = %4, %1
store i8* null, i8** %0
ret void
}
int test_imm_B6uint8_mem(unsigned char *val) {
  return ((*val) & (-0xB6 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_B6uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 74
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void caller_1_1_2_2_1_2_1() {}


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

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

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

LLVM IR (-O2):
define void @caller_1_1_2_2_1_2_1() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("main hello world\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [17 x i8] c"main hello world\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ forwardC(unsigned int, unsigned int);
void forward_mm(unsigned int speed, unsigned int distance_mm) {
  forwardC(speed, distance_mm * 4);
}


x86 assembly (clang, -O0):
<forward_mm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
shl    $0x2,%esi
call   1030 <forwardC@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<forward_mm>:
shl    $0x2,%esi
jmp    1030 <forwardC@plt>

LLVM IR (-O0):
define void @forward_mm(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 = mul i32 %6, 4
%8 = call i32 @forwardC(i32 %5, i32 %7)
ret void
}

LLVM IR (-O2):
define void @forward_mm(i32 %0, i32 %1) {
%3 = shl i32 %1, 2
%4 = tail call i32 @forwardC(i32 %0, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int num;
  num = 1;
  while (num < 101) {
    printf("%d - ", num);
    num = num + 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x65,-0x8(%rbp)
jge    114d <main+0x3d>
mov    -0x8(%rbp),%esi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
lea    0xee0(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x65,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%d - \00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 1, %0 ], [ %4, %1 ]
%3 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 101
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 0
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int chars_matched;
};
typedef TYPE_1__ XComposeStatus;

/* Variables and functions */
void set_XComposeStatus_chars_matched(void *_p, int _v) {
  ((XComposeStatus *)_p)->chars_matched = (int)_v;
}


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

x86 assembly (clang, -O2):
<set_XComposeStatus_chars_matched>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XComposeStatus_chars_matched(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XComposeStatus_chars_matched(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
int f(void) {
  register int ri asm("edi");
  return ri;
}


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

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

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

LLVM IR (-O2):
define i32 @f() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
int test(char *cmd, int fd) { write(fd, cmd, strlen(cmd)); }


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = load i8*, i8** %4
%8 = load i8*, i8** %4
%9 = call i32 @strlen(i8* %8)
%10 = call i32 @write(i32 %6, i8* %7, i32 %9)
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
define i32 @test(i8* %0, i32 %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @write(i32 %1, i8* %0, i32 %3)
ret i32 undef
}
int MPI_Request_free(int *request) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @MPI_Request_free(i32* nocapture readnone %0) {
ret i32 0
}
void omap_pm_clear_dsp_wake_up(void) {}


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

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

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

LLVM IR (-O2):
define void @omap_pm_clear_dsp_wake_up() {
ret void
}
int test_imm_BAuint16_mem(unsigned short *val) {
  return ((*val) & (0xBA << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_BAuint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 186
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t smpte_hbrmt_get_frate(const uint8_t *p_hbrmt) {
  return ((p_hbrmt[5] & 0xf) << 4) | (p_hbrmt[6] >> 4);
}


x86 assembly (clang, -O0):
<smpte_hbrmt_get_frate>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%eax
and    $0xf,%eax
shl    $0x4,%eax
mov    -0x8(%rbp),%rcx
mov    0x18(%rcx),%ecx
sar    $0x4,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<smpte_hbrmt_get_frate>:
mov    0x14(%rdi),%ecx
mov    0x18(%rdi),%eax
shl    $0x4,%ecx
movzbl %cl,%ecx
sar    $0x4,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @smpte_hbrmt_get_frate(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 5
%5 = load i32, i32* %4
%6 = and i32 %5, 15
%7 = shl i32 %6, 4
%8 = load i32*, i32** %2
%9 = getelementptr inbounds i32, i32* %8, i64 6
%10 = load i32, i32* %9
%11 = ashr i32 %10, 4
%12 = or i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @smpte_hbrmt_get_frate(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 5
%3 = load i32, i32* %2
%4 = shl i32 %3, 4
%5 = and i32 %4, 240
%6 = getelementptr inbounds i32, i32* %0, i64 6
%7 = load i32, i32* %6
%8 = ashr i32 %7, 4
%9 = or i32 %5, %8
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ getpid();
__attribute__((__weak__, __always___)) pid_t softboundmpx_getpid(void) {
  return getpid();
}


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

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

LLVM IR (-O0):
define weak i32 @softboundmpx_getpid() {
%1 = call i32 (...) @getpid()
ret i32 %1
}

LLVM IR (-O2):
define weak i32 @softboundmpx_getpid() {
%1 = tail call i32 (...) @getpid()
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
off_t _lseek(int a __attribute__((unused)), off_t b,
             int c __attribute__((unused))) {
  return b;
}


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

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

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

LLVM IR (-O2):
define i32 @_lseek(i32 %0, i32 returned %1, i32 %2) {
ret i32 %1
}
/* Variables and functions */
scalar_t__ EINPROGRESS;
scalar_t__ errno;
int connection_inprogress() { return errno == EINPROGRESS; }


x86 assembly (clang, -O0):
<connection_inprogress>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%rax
mov    0x2ed3(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<connection_inprogress>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%rcx
mov    0x2ed7(%rip),%rdx
xor    %eax,%eax
cmp    (%rdx),%rcx
sete   %al
ret

LLVM IR (-O0):
@errno = global i64 0
@EINPROGRESS = global i64 0
define i32 @connection_inprogress() {
%1 = load i64, i64* @errno
%2 = load i64, i64* @EINPROGRESS
%3 = icmp eq i64 %1, %2
%4 = zext i1 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
@errno = global i64 0
@EINPROGRESS = global i64 0
define i32 @connection_inprogress() {
%1 = load i64, i64* @errno
%2 = load i64, i64* @EINPROGRESS
%3 = icmp eq i64 %1, %2
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void CWE78_OS_Command_Injection__char_console_execl_41_badSink(char *data) {
  system(data);
}


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

x86 assembly (clang, -O2):
<CWE78_OS_Command_Injection__char_console_execl_41_badSink>:
jmp    1030 <system@plt>

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

LLVM IR (-O2):
define void @CWE78_OS_Command_Injection__char_console_execl_41_badSink(i8* nocapture %0) {
%2 = tail call i32 @system(i8* %0)
ret void
}