xunge/DecIR huggingface dataset:
/* Type definitions */
struct ifreq {
  int ifr_ifindex;
  int /*<<< orphan*/ ifr_name;
};

/* Variables and functions */
int /*<<< orphan*/ SIOCGIFINDEX;
scalar_t__ ioctl(int, int /*<<< orphan*/, struct ifreq *);
int /*<<< orphan*/ strncpy(int /*<<< orphan*/, char *, int);
int get_device_index(int sockfd, char *device_name) {
  struct ifreq ifr;
  strncpy(ifr.ifr_name, device_name, 16);
  if (ioctl(sockfd, SIOCGIFINDEX, &ifr) != 0) {
    return -1;
  }
  return ifr.ifr_ifindex;
}


x86 assembly (clang, -O0):
<get_device_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x10,%edx
call   1030 <strncpy@plt>
mov    -0x8(%rbp),%edi
mov    0x2e8e(%rip),%rax
mov    (%rax),%esi
lea    -0x18(%rbp),%rdx
call   1040 <ioctl@plt>
cmp    $0x0,%rax
je     116b <get_device_index+0x4b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1171 <get_device_index+0x51>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_device_index>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
mov    $0x10,%edx
call   1030 <strncpy@plt>
mov    0x2ea0(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
mov    %ebx,%edi
call   1040 <ioctl@plt>
neg    %rax
sbb    %eax,%eax
or     0x8(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.ifreq = type { i32, i32 }
@SIOCGIFINDEX = global i32 0
define i32 @get_device_index(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca %struct.ifreq
store i32 %0, i32* %4
store i8* %1, i8** %5
%7 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %6, i32 0, i32 1
%8 = load i32, i32* %7
%9 = load i8*, i8** %5
%10 = call i32 @strncpy(i32 %8, i8* %9, i32 16)
%11 = load i32, i32* %4
%12 = load i32, i32* @SIOCGIFINDEX
%13 = call i64 @ioctl(i32 %11, i32 %12, %struct.ifreq* %6)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %2
store i32 -1, i32* %3
br label %19
16: ; preds = %2
%17 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %6, i32 0, i32 0
%18 = load i32, i32* %17
store i32 %18, i32* %3
br label %19
19: ; preds = %16, %15
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
%struct.ifreq = type { i32, i32 }
@SIOCGIFINDEX = global i32 0
define i32 @get_device_index(i32 %0, i8* %1) {
%3 = alloca %struct.ifreq
%4 = bitcast %struct.ifreq* %3 to i8*
%5 = tail call i32 @strncpy(i32 undef, i8* %1, i32 16)
%6 = load i32, i32* @SIOCGIFINDEX
%7 = call i64 @ioctl(i32 %0, i32 %6, %struct.ifreq* %3)
%8 = icmp eq i64 %7, 0
%9 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %3, i64 0, i32 0
%10 = load i32, i32* %9
%11 = select i1 %8, i32 %10, i32 -1
ret i32 %11
}
int compare1(int a, int b) {
  if (a < b)
    return -1;
  else if (a > b)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<compare1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1122 <compare1+0x22>
movl   $0xffffffff,-0x4(%rbp)
jmp    1141 <compare1+0x41>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    113a <compare1+0x3a>
movl   $0x1,-0x4(%rbp)
jmp    1141 <compare1+0x41>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare1>:
xor    %ecx,%ecx
cmp    %esi,%edi
setg   %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @compare1(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = icmp sgt i32 %0, %1
%5 = zext i1 %4 to i32
%6 = select i1 %3, i32 -1, i32 %5
ret i32 %6
}
/* Variables and functions */
int EOF;
int getchar();
yes() {
  int i, b;
  i = b = getchar();
  while (b != '\n' && b != EOF)
    b = getchar();
  return (i == 'y');
}


x86 assembly (clang, -O0):
<yes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    %eax,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0xa,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     1146 <yes+0x36>
mov    -0x8(%rbp),%eax
mov    0x2eaa(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1156 <yes+0x46>
jmp    1165 <yes+0x55>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x8(%rbp)
jmp    1125 <yes+0x15>
cmpl   $0x79,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yes>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %eax,%ebp
cmp    $0xa,%eax
je     1140 <yes+0x30>
mov    0x2ec0(%rip),%rbx
cmp    (%rbx),%ebp
je     1140 <yes+0x30>
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%eax
je     1140 <yes+0x30>
cmp    (%rbx),%eax
jne    1130 <yes+0x20>
xor    %eax,%eax
cmp    $0x79,%ebp
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @yes() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @getchar()
store i32 %3, i32* %2
store i32 %3, i32* %1
br label %4
4: ; preds = %13, %0
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 10
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = load i32, i32* %2
%9 = load i32, i32* @EOF
%10 = icmp ne i32 %8, %9
br label %11
11: ; preds = %7, %4
%12 = phi i1 [ false, %4 ], [ %10, %7 ]
br i1 %12, label %13, label %15
13: ; preds = %11
%14 = call i32 (...) @getchar()
store i32 %14, i32* %2
br label %4
15: ; preds = %11
%16 = load i32, i32* %1
%17 = icmp eq i32 %16, 121
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @yes() {
%1 = tail call i32 (...) @getchar()
%2 = icmp ne i32 %1, 10
%3 = load i32, i32* @EOF
%4 = icmp ne i32 %1, %3
%5 = select i1 %2, i1 %4, i1 false
br i1 %5, label %6, label %12
6: ; preds = %0, %6
%7 = tail call i32 (...) @getchar()
%8 = icmp ne i32 %7, 10
%9 = load i32, i32* @EOF
%10 = icmp ne i32 %7, %9
%11 = select i1 %8, i1 %10, i1 false
br i1 %11, label %6, label %12
12: ; preds = %6, %0
%13 = icmp eq i32 %1, 121
%14 = zext i1 %13 to i32
ret i32 %14
}
/* Variables and functions */
char const *cache_get_mime_type_for_data(void const *, size_t, int *,
                                         int /*<<< orphan*/ *,
                                         int /*<<< orphan*/);
const char *_xdg_mime_cache_get_mime_type_for_data(const void *data, size_t len,
                                                   int *result_prio) {
  return cache_get_mime_type_for_data(data, len, result_prio, NULL, 0);
}


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

x86 assembly (clang, -O2):
<_xdg_mime_cache_get_mime_type_for_data>:
xor    %ecx,%ecx
xor    %r8d,%r8d
jmp    1030 <cache_get_mime_type_for_data@plt>

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

LLVM IR (-O2):
define i8* @_xdg_mime_cache_get_mime_type_for_data(i8* %0, i64 %1, i32* %2) {
%4 = tail call i8* @cache_get_mime_type_for_data(i8* %0, i64 %1, i32* %2, i32* null, i32 0)
ret i8* %4
}
int strcmp(const char *s1, const char *s2) {
__ESBMC_HIDE:;
  int retval;
  if (s1 != 0 && s1 == s2)
    return 0;
  return retval;
}


x86 assembly (clang, -O0):
<strcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1131 <strcmp+0x31>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    1131 <strcmp+0x31>
movl   $0x0,-0x4(%rbp)
jmp    1137 <strcmp+0x37>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @strcmp(i8* readnone %0, i8* readnone %1) {
ret i32 0
}
/* Type definitions */
struct terminal_t {
  int dummy;
};
struct parm_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ move_cursor(struct terminal_t *, int /*<<< orphan*/, int);
int sum(struct parm_t *);
void curs_back(struct terminal_t *term, struct parm_t *parm) {
  int num = sum(parm);
  if (num <= 0)
    num = 1;
  move_cursor(term, 0, -num);
}


x86 assembly (clang, -O0):
<curs_back>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <sum@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jg     114d <curs_back+0x2d>
movl   $0x1,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
xor    %edx,%edx
sub    -0x14(%rbp),%edx
xor    %esi,%esi
call   1040 <move_cursor@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<curs_back>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <sum@plt>
test   %eax,%eax
mov    $0x1,%edx
cmovg  %eax,%edx
neg    %edx
mov    %rbx,%rdi
xor    %esi,%esi
pop    %rbx
jmp    1040 <move_cursor@plt>

LLVM IR (-O0):
%struct.terminal_t = type { i32 }
%struct.parm_t = type { i32 }
define void @curs_back(%struct.terminal_t* %0, %struct.parm_t* %1) {
%3 = alloca %struct.terminal_t*
%4 = alloca %struct.parm_t*
%5 = alloca i32
store %struct.terminal_t* %0, %struct.terminal_t** %3
store %struct.parm_t* %1, %struct.parm_t** %4
%6 = load %struct.parm_t*, %struct.parm_t** %4
%7 = call i32 @sum(%struct.parm_t* %6)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = icmp sle i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 1, i32* %5
br label %11
11: ; preds = %10, %2
%12 = load %struct.terminal_t*, %struct.terminal_t** %3
%13 = load i32, i32* %5
%14 = sub nsw i32 0, %13
%15 = call i32 @move_cursor(%struct.terminal_t* %12, i32 0, i32 %14)
ret void
}

LLVM IR (-O2):
%struct.terminal_t = type { i32 }
%struct.parm_t = type { i32 }
define void @curs_back(%struct.terminal_t* %0, %struct.parm_t* %1) {
%3 = tail call i32 @sum(%struct.parm_t* %1)
%4 = icmp sgt i32 %3, 1
%5 = select i1 %4, i32 %3, i32 1
%6 = sub nsw i32 0, %5
%7 = tail call i32 @move_cursor(%struct.terminal_t* %0, i32 0, i32 %6)
ret void
}
dchar(char *x, char *y) { return x - y; }


x86 assembly (clang, -O0):
<dchar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dchar>:
mov    %rdi,%rax
sub    %esi,%eax
ret

LLVM IR (-O0):
define i32 @dchar(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 = ptrtoint i8* %5 to i64
%8 = ptrtoint i8* %6 to i64
%9 = sub i64 %7, %8
%10 = trunc i64 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @dchar(i8* %0, i8* %1) {
%3 = ptrtoint i8* %0 to i64
%4 = ptrtoint i8* %1 to i64
%5 = sub i64 %3, %4
%6 = trunc i64 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ lookNarray(char *, unsigned int);
void lookcomplex8array(void *x, int n) {
  lookNarray((char *)x, (unsigned int)(n * 8));
}


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

x86 assembly (clang, -O2):
<lookcomplex8array>:
shl    $0x3,%esi
jmp    1030 <lookNarray@plt>

LLVM IR (-O0):
define void @lookcomplex8array(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = mul nsw i32 %6, 8
%8 = call i32 @lookNarray(i8* %5, i32 %7)
ret void
}

LLVM IR (-O2):
define void @lookcomplex8array(i8* %0, i32 %1) {
%3 = shl nsw i32 %1, 3
%4 = tail call i32 @lookNarray(i8* %0, i32 %3)
ret void
}
/* Variables and functions */
int foo3c();
int foo2c(void) { return foo3c(); }


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

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

LLVM IR (-O0):
define i32 @foo2c() {
%1 = call i32 (...) @foo3c()
ret i32 %1
}

LLVM IR (-O2):
define i32 @foo2c() {
%1 = tail call i32 (...) @foo3c()
ret i32 %1
}
void foo_2_2_1_1_1_2_2_1_2() {}


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

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

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

LLVM IR (-O2):
define void @foo_2_2_1_1_1_2_2_1_2() {
ret void
}
/* Variables and functions */
scalar_t__ strncasecmp(char *, char *, int);
void strncasecmp_constant0() {
  if (strncasecmp("abc", "Abc", 3) != 0)
    (void)*(char *)0;
}


x86 assembly (clang, -O0):
<strncasecmp_constant0>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee2(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncasecmp@plt>
cmp    $0x0,%rax
je     1136 <strncasecmp_constant0+0x26>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"abc\00"
@.str.1 = [4 x i8] c"Abc\00"
define void @strncasecmp_constant0() {
%1 = call i64 @strncasecmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%2 = icmp ne i64 %1, 0
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):
define void @strncasecmp_constant0() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void help() {
  printf("Program to convert ASCII file into lower format\n"
         "\t-h|--help for help\n"
         "\t-v|--version for version information\n");
}


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

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

LLVM IR (-O0):
@.str = [107 x i8] c"Program to convert ASCII file into lower format\0A\09-h|--help for help\0A\09-v|--version for version information\0A\00"
define void @help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([107 x i8], [107 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [106 x i8] c"Program to convert ASCII file into lower format\0A\09-h|--help for help\0A\09-v|--version for version information\00"
define void @help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([106 x i8], [106 x i8]* @str, i64 0, i64 0))
ret void
}
int test_imm_68int32_reg(int val) { return ((val) & (0x68 << 0)) ? -20 : -40; }


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

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

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

LLVM IR (-O2):
define i32 @test_imm_68int32_reg(i32 %0) {
%2 = and i32 %0, 104
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct pollfd {
  scalar_t__ revents;
  scalar_t__ events;
};

/* Variables and functions */
void clear_events(struct pollfd *pfd) {
  pfd->events = 0;
  pfd->revents = 0;
}


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

x86 assembly (clang, -O2):
<clear_events>:
xorps  %xmm0,%xmm0
movups %xmm0,(%rdi)
ret

LLVM IR (-O0):
%struct.pollfd = type { i64, i64 }
define void @clear_events(%struct.pollfd* %0) {
%2 = alloca %struct.pollfd*
store %struct.pollfd* %0, %struct.pollfd** %2
%3 = load %struct.pollfd*, %struct.pollfd** %2
%4 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %3, i32 0, i32 1
store i64 0, i64* %4
%5 = load %struct.pollfd*, %struct.pollfd** %2
%6 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %5, i32 0, i32 0
store i64 0, i64* %6
ret void
}

LLVM IR (-O2):
%struct.pollfd = type { i64, i64 }
define void @clear_events(%struct.pollfd* nocapture writeonly %0) {
%2 = bitcast %struct.pollfd* %0 to i8*
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
void show(double a) { printf("%lf\n", a); }


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

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

LLVM IR (-O0):
@.str = [5 x i8] c"%lf\0A\00"
define void @show(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %3)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lf\0A\00"
define void @show(double %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %0)
ret void
}
/* Variables and functions */
int fatorial(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("%d\n", fatorial(0));
  printf("%d\n", fatorial(1));
  printf("%d\n", fatorial(5));
  printf("%d\n", fatorial(-5));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1040 <fatorial@plt>
mov    %eax,%esi
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <fatorial@plt>
mov    %eax,%esi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    $0x5,%edi
call   1040 <fatorial@plt>
mov    %eax,%esi
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
mov    $0xfffffffb,%edi
call   1040 <fatorial@plt>
mov    %eax,%esi
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1040 <fatorial@plt>
lea    0xed1(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <fatorial@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x5,%edi
call   1040 <fatorial@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0xfffffffb,%edi
call   1040 <fatorial@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @fatorial(i32 0)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @fatorial(i32 1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @fatorial(i32 5)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 @fatorial(i32 -5)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}
char *(strchr)(char const *s, int c) {
  unsigned char const *_s = (unsigned char const *)s;
  while (*_s && *_s != c)
    ++_s;
  if (*_s)
    return (char *)_s;
  else
    return (char *)0;
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movzbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x21(%rbp)
je     1138 <strchr+0x38>
mov    -0x20(%rbp),%rax
movzbl (%rax),%eax
cmp    -0x14(%rbp),%eax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1148 <strchr+0x48>
jmp    1159 <strchr+0x59>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1113 <strchr+0x13>
mov    -0x20(%rbp),%rax
cmpb   $0x0,(%rax)
je     1173 <strchr+0x73>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    117b <strchr+0x7b>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
mov    %rdi,%rax
add    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %ecx,%ecx
je     1120 <strchr+0x20>
cmp    %esi,%ecx
jne    1110 <strchr+0x10>
xor    %edx,%edx
test   %cl,%cl
cmove  %rdx,%rax
ret

LLVM IR (-O0):
define i8* @strchr(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
%7 = load i8*, i8** %4
store i8* %7, i8** %6
br label %8
8: ; preds = %21, %2
%9 = load i8*, i8** %6
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %19
13: ; preds = %8
%14 = load i8*, i8** %6
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = load i32, i32* %5
%18 = icmp ne i32 %16, %17
br label %19
19: ; preds = %13, %8
%20 = phi i1 [ false, %8 ], [ %18, %13 ]
br i1 %20, label %21, label %24
21: ; preds = %19
%22 = load i8*, i8** %6
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %6
br label %8
24: ; preds = %19
%25 = load i8*, i8** %6
%26 = load i8, i8* %25
%27 = icmp ne i8 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = load i8*, i8** %6
store i8* %29, i8** %3
br label %31
30: ; preds = %24
store i8* null, i8** %3
br label %31
31: ; preds = %30, %28
%32 = load i8*, i8** %3
ret i8* %32
}

LLVM IR (-O2):
define i8* @strchr(i8* %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %10, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = zext i8 %5 to i32
%8 = icmp eq i32 %7, %1
%9 = or i1 %6, %8
%10 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %9, label %11, label %3
11: ; preds = %3
%12 = select i1 %6, i8* null, i8* %4
ret i8* %12
}
void NoDebugMixedCaseFunc(void) {}


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

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

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

LLVM IR (-O2):
define void @NoDebugMixedCaseFunc() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
int /*<<< orphan*/ syscall(int, int, uintptr_t, int /*<<< orphan*/);
void printstr(const char *s) { syscall(64, 1, (uintptr_t)s, strlen(s)); }


x86 assembly (clang, -O0):
<printstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x10(%rbp),%rdx
mov    %eax,%ecx
mov    $0x40,%edi
mov    $0x1,%esi
call   1040 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printstr>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    $0x40,%edi
mov    $0x1,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
pop    %rbx
jmp    1040 <syscall@plt>

LLVM IR (-O0):
define void @printstr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i64
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = call i32 @syscall(i32 64, i32 1, i64 %4, i32 %6)
ret void
}

LLVM IR (-O2):
define void @printstr(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @syscall(i32 64, i32 1, i64 %2, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ error_log_init(int /*<<< orphan*/ *);
void error_log_pre_init(void) { error_log_init(NULL); }


x86 assembly (clang, -O0):
<error_log_pre_init>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
call   1030 <error_log_init@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<error_log_pre_init>:
xor    %edi,%edi
jmp    1030 <error_log_init@plt>

LLVM IR (-O0):
define void @error_log_pre_init() {
%1 = call i32 @error_log_init(i32* null)
ret void
}

LLVM IR (-O2):
define void @error_log_pre_init() {
%1 = tail call i32 @error_log_init(i32* null)
ret void
}
int myfunsum(int a, int b) { return a + b; }


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

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

LLVM IR (-O0):
define i32 @myfunsum(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 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @myfunsum(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ BUG();
void outw(unsigned short x, unsigned long port) { BUG(); }


x86 assembly (clang, -O0):
<outw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <BUG@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @outw(i16 zeroext %0, i64 %1) {
%3 = alloca i16
%4 = alloca i64
store i16 %0, i16* %3
store i64 %1, i64* %4
%5 = call i32 (...) @BUG()
ret void
}

LLVM IR (-O2):
define void @outw(i16 zeroext %0, i64 %1) {
%3 = tail call i32 (...) @BUG()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ curson();
int /*<<< orphan*/ pushNumber(int /*<<< orphan*/);
void basCursOn() { pushNumber(curson()); }


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

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

LLVM IR (-O0):
define void @basCursOn() {
%1 = call i32 (...) @curson()
%2 = call i32 @pushNumber(i32 %1)
ret void
}

LLVM IR (-O2):
define void @basCursOn() {
%1 = tail call i32 (...) @curson()
%2 = tail call i32 @pushNumber(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assertTrue(char *, int);
void test_primitive_arith() {
  int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
  int *pstart = &a[0];
  int *pend = &a[5];
  int start = (int)pstart;
  int end = (int)pend;
  int count = (end - start) / sizeof(int);
  assertTrue("count == 5", count == 5);
  ;
}


x86 assembly (clang, -O0):
<test_primitive_arith>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x30(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x30(%rbp),%rax
add    $0x14,%rax
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rax
mov    %eax,-0x44(%rbp)
mov    -0x40(%rbp),%rax
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
sub    -0x44(%rbp),%eax
cltq
shr    $0x2,%rax
mov    %eax,-0x4c(%rbp)
cmpl   $0x5,-0x4c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xea7(%rip),%rdi
call   1030 <assertTrue@plt>
add    $0x50,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.test_primitive_arith.a = [10 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9]
@.str = [11 x i8] c"count == 5\00"
define void @test_primitive_arith() {
%1 = alloca [10 x i32]
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast [10 x i32]* %1 to i8*
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
store i32* %8, i32** %2
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
store i32* %9, i32** %3
%10 = load i32*, i32** %2
%11 = ptrtoint i32* %10 to i32
store i32 %11, i32* %4
%12 = load i32*, i32** %3
%13 = ptrtoint i32* %12 to i32
store i32 %13, i32* %5
%14 = load i32, i32* %5
%15 = load i32, i32* %4
%16 = sub nsw i32 %14, %15
%17 = sext i32 %16 to i64
%18 = udiv i64 %17, 4
%19 = trunc i64 %18 to i32
store i32 %19, i32* %6
%20 = load i32, i32* %6
%21 = icmp eq i32 %20, 5
%22 = zext i1 %21 to i32
%23 = call i32 @assertTrue(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %22)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"count == 5\00"
define void @test_primitive_arith() {
%1 = tail call i32 @assertTrue(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
int main() {
  static int x;
  char a[++x];
  a[sizeof a - 1] = 0;
  int N;
  return a[0];
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2f0f(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2f06(%rip)
mov    %eax,%ecx
mov    %rsp,%rax
mov    %rax,-0x10(%rbp)
mov    %rcx,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rax
sub    %rdx,%rax
mov    %rax,%rsp
mov    %rcx,-0x18(%rbp)
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
movsbl (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f1a(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2f11(%rip)
mov    %rsp,%rcx
lea    0xf(%rax),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rcx,%rsi
sub    %rdx,%rsi
mov    %rsi,%rsp
neg    %rdx
movb   $0x0,-0x1(%rax,%rsi,1)
movsbl (%rcx,%rdx,1),%eax
mov    %rbp,%rsp
pop    %rbp
ret

LLVM IR (-O0):
@main.x = internal global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i32
store i32 0, i32* %1
%5 = load i32, i32* @main.x
%6 = add nsw i32 %5, 1
store i32 %6, i32* @main.x
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %2
%9 = alloca i8, i64 %7
store i64 %7, i64* %3
%10 = sub i64 %7, 1
%11 = getelementptr inbounds i8, i8* %9, i64 %10
store i8 0, i8* %11
%12 = getelementptr inbounds i8, i8* %9, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
store i32 %14, i32* %1
%15 = load i8*, i8** %2
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
@main.x = internal unnamed_addr global i32 0
define i32 @main() {
%1 = load i32, i32* @main.x
%2 = add nsw i32 %1, 1
store i32 %2, i32* @main.x
%3 = zext i32 %2 to i64
%4 = alloca i8, i64 %3
%5 = add nsw i64 %3, -1
%6 = getelementptr inbounds i8, i8* %4, i64 %5
store i8 0, i8* %6
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
ret i32 %8
}
void to_binary(unsigned long long int value, char bin_output[], short *index) {
  if (*index < 0) {
    return;
  }
  unsigned long long int div = value / 2;
  unsigned long long int mod = value % 2;
  bin_output[(*index)--] = mod + '0';
  to_binary(div, bin_output, index);
}


x86 assembly (clang, -O0):
<to_binary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movswl (%rax),%eax
cmp    $0x0,%eax
jge    1139 <to_binary+0x29>
jmp    1188 <to_binary+0x78>
mov    -0x8(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
and    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x30,%rax
mov    %al,%dl
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rsi
mov    (%rsi),%cx
mov    %cx,%di
add    $0xffff,%di
mov    %di,(%rsi)
movswq %cx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <to_binary@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_binary>:
movzwl (%rdx),%r8d
test   %r8w,%r8w
js     1137 <to_binary+0x37>
mov    %rdi,%rcx
nopl   (%rax)
shr    %rcx
and    $0x1,%dil
or     $0x30,%dil
lea    -0x1(%r8),%eax
mov    %ax,(%rdx)
movzwl %r8w,%eax
mov    %dil,(%rsi,%rax,1)
movzwl (%rdx),%r8d
mov    %rcx,%rdi
test   %r8w,%r8w
jns    1110 <to_binary+0x10>
ret

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

LLVM IR (-O2):
define void @to_binary(i64 %0, i8* nocapture writeonly %1, i16* nocapture %2) {
%4 = load i16, i16* %2
%5 = icmp slt i16 %4, 0
br i1 %5, label %18, label %6
6: ; preds = %3, %6
%7 = phi i16 [ %16, %6 ], [ %4, %3 ]
%8 = phi i64 [ %9, %6 ], [ %0, %3 ]
%9 = lshr i64 %8, 1
%10 = trunc i64 %8 to i8
%11 = and i8 %10, 1
%12 = or i8 %11, 48
%13 = add nsw i16 %7, -1
store i16 %13, i16* %2
%14 = zext i16 %7 to i64
%15 = getelementptr inbounds i8, i8* %1, i64 %14
store i8 %12, i8* %15
%16 = load i16, i16* %2
%17 = icmp slt i16 %16, 0
br i1 %17, label %18, label %6
18: ; preds = %6, %3
ret void
}
void inclass_element2TAB() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/, char const *,
                            int /*<<< orphan*/);
void masm_log_ap(const char *fmt, va_list ap) { vfprintf(stderr, fmt, ap); }


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

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

LLVM IR (-O0):
@stderr = global i32 0
define void @masm_log_ap(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i32 @vfprintf(i32 %5, i8* %6, i32 %7)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
define void @masm_log_ap(i8* %0, i32 %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @vfprintf(i32 %3, i8* %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ F_GETFL;
int /*<<< orphan*/ F_SETFL;
int O_NONBLOCK;
int /*<<< orphan*/ assert(int);
int fcntl(int, int /*<<< orphan*/, int);
void set_nonblock(int socket) {
  int flags;
  flags = fcntl(socket, F_GETFL, 0);
  assert(flags != -1);
  fcntl(socket, F_SETFL, flags | O_NONBLOCK);
}


x86 assembly (clang, -O0):
<set_nonblock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e9b(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x4(%rbp),%edi
mov    0x2e7c(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%edx
mov    0x2e80(%rip),%rax
or     (%rax),%edx
call   1030 <fcntl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_nonblock>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    0x2ea4(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
mov    %eax,%ebp
xor    %edi,%edi
cmp    $0xffffffff,%eax
setne  %dil
call   1040 <assert@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%esi
mov    0x2e93(%rip),%rax
or     (%rax),%ebp
mov    %ebx,%edi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fcntl@plt>

LLVM IR (-O0):
@F_GETFL = global i32 0
@F_SETFL = global i32 0
@O_NONBLOCK = global i32 0
define void @set_nonblock(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @F_GETFL
%6 = call i32 @fcntl(i32 %4, i32 %5, i32 0)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, -1
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i32, i32* %2
%12 = load i32, i32* @F_SETFL
%13 = load i32, i32* %3
%14 = load i32, i32* @O_NONBLOCK
%15 = or i32 %13, %14
%16 = call i32 @fcntl(i32 %11, i32 %12, i32 %15)
ret void
}

LLVM IR (-O2):
@F_GETFL = global i32 0
@F_SETFL = global i32 0
@O_NONBLOCK = global i32 0
define void @set_nonblock(i32 %0) {
%2 = load i32, i32* @F_GETFL
%3 = tail call i32 @fcntl(i32 %0, i32 %2, i32 0)
%4 = icmp ne i32 %3, -1
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = load i32, i32* @F_SETFL
%8 = load i32, i32* @O_NONBLOCK
%9 = or i32 %8, %3
%10 = tail call i32 @fcntl(i32 %0, i32 %7, i32 %9)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ draw_rect(int, int, int, int, char);
int /*<<< orphan*/ get_screen_size_(int *, int *);
int /*<<< orphan*/ show_screen();
void draw_border() {
  int left = 0;
  int right = 0;
  int top = 0;
  int bottom = 3;
  int width;
  int height;
  get_screen_size_(&(width), &(height));
  draw_rect(left, top, width - right - 1, height - bottom - 1, '&');
  show_screen();
}


x86 assembly (clang, -O0):
<draw_border>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x3,-0x10(%rbp)
lea    -0x14(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <get_screen_size_@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    -0x8(%rbp),%edx
sub    $0x1,%edx
mov    -0x18(%rbp),%ecx
sub    -0x10(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x26,%r8d
call   1050 <draw_rect@plt>
mov    $0x0,%al
call   1040 <show_screen@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_border>:
push   %rax
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <get_screen_size_@plt>
mov    0x4(%rsp),%edx
add    $0xffffffff,%edx
mov    (%rsp),%ecx
add    $0xfffffffc,%ecx
xor    %edi,%edi
xor    %esi,%esi
mov    $0x26,%r8d
call   1050 <draw_rect@plt>
xor    %eax,%eax
call   1040 <show_screen@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @draw_border() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 3, i32* %4
%7 = call i32 @get_screen_size_(i32* %5, i32* %6)
%8 = load i32, i32* %1
%9 = load i32, i32* %3
%10 = load i32, i32* %5
%11 = load i32, i32* %2
%12 = sub nsw i32 %10, %11
%13 = sub nsw i32 %12, 1
%14 = load i32, i32* %6
%15 = load i32, i32* %4
%16 = sub nsw i32 %14, %15
%17 = sub nsw i32 %16, 1
%18 = call i32 @draw_rect(i32 %8, i32 %9, i32 %13, i32 %17, i8 signext 38)
%19 = call i32 (...) @show_screen()
ret void
}

LLVM IR (-O2):
define void @draw_border() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @get_screen_size_(i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = add nsw i32 %6, -1
%8 = load i32, i32* %2
%9 = add nsw i32 %8, -4
%10 = call i32 @draw_rect(i32 0, i32 0, i32 %7, i32 %9, i8 signext 38)
%11 = call i32 (...) @show_screen()
ret void
}
int test_imm_21int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x21 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_21int64_midword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
sar    $0x10,%rdx
and    $0x21,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_21int64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 16
%6 = and i64 %5, 33
%7 = icmp ne i64 %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_21int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 2162688
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int var_ele(long n, int A[n][n], long i, long j) { return A[i][j]; }


x86 assembly (clang, -O0):
<var_ele>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rax
imul   -0x18(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<var_ele>:
imul   %rdx,%rdi
lea    (%rsi,%rdi,4),%rax
mov    (%rax,%rcx,4),%eax
ret

LLVM IR (-O0):
define i32 @var_ele(i64 %0, i32* %1, i64 %2, i64 %3) {
%5 = alloca i64
%6 = alloca i32*
%7 = alloca i64
%8 = alloca i64
store i64 %0, i64* %5
store i32* %1, i32** %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%9 = load i64, i64* %5
%10 = load i64, i64* %5
%11 = load i32*, i32** %6
%12 = load i64, i64* %7
%13 = mul nsw i64 %12, %10
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i64, i64* %8
%16 = getelementptr inbounds i32, i32* %14, i64 %15
%17 = load i32, i32* %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @var_ele(i64 %0, i32* nocapture %1, i64 %2, i64 %3) {
%5 = mul nsw i64 %2, %0
%6 = getelementptr inbounds i32, i32* %1, i64 %5
%7 = getelementptr inbounds i32, i32* %6, i64 %3
%8 = load i32, i32* %7
ret i32 %8
}
/* Variables and functions */
int factorial(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int n, fact;
  printf("Kindly enter any number\n");
  scanf("%d", &n);
  fact = factorial(n);
  printf("The factorial of the number is %d\n", fact);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1030 <factorial@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xede(%rip),%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
call   1040 <factorial@plt>
lea    0xe95(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Kindly enter any number\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [35 x i8] c"The factorial of the number is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = call i32 @factorial(i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [35 x i8] c"The factorial of the number is %d\0A\00"
@str = [24 x i8] c"Kindly enter any number\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @factorial(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}
void cprop_test7(int *data) {
  int j;
  if (data[0]) {
    j = 5;
    data[1] = 10;
  } else {
    data[2] = 15;
    j = 5;
  }
  data[3] = j + 21;
}


x86 assembly (clang, -O0):
<cprop_test7>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
je     112c <cprop_test7+0x2c>
movl   $0x5,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movl   $0xa,0x4(%rax)
jmp    113e <cprop_test7+0x3e>
mov    -0x8(%rbp),%rax
movl   $0xf,0x8(%rax)
movl   $0x5,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
add    $0x15,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cprop_test7>:
xor    %eax,%eax
cmpl   $0x0,(%rdi)
sete   %al
lea    (%rax,%rax,4),%ecx
add    $0xa,%ecx
mov    %ecx,0x4(%rdi,%rax,4)
movl   $0x1a,0xc(%rdi)
ret

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

LLVM IR (-O2):
define void @cprop_test7(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i64 2, i64 1
%5 = select i1 %3, i32 15, i32 10
%6 = getelementptr inbounds i32, i32* %0, i64 %4
store i32 %5, i32* %6
%7 = getelementptr inbounds i32, i32* %0, i64 3
store i32 26, i32* %7
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sched_yield();
void thrd_yield() { sched_yield(); }


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

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

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

LLVM IR (-O2):
define void @thrd_yield() {
%1 = tail call i32 (...) @sched_yield()
ret void
}