xunge/DecIR huggingface dataset:
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char **);
void using_library_function() {
  char str[100];
  int number;
  printf("Enter a number: ");
  scanf("%s", &str);
  number = atoi(str);
  printf("Number: %d\n", number);
}


x86 assembly (clang, -O0):
<using_library_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xebd(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x70(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%esi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<using_library_function>:
push   %rbx
sub    $0x70,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1050 <atoi@plt>
lea    0xeb0(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [12 x i8] c"Number: %d\0A\00"
define void @using_library_function() {
%1 = alloca [100 x i8]
%2 = alloca i32
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = bitcast [100 x i8]* %1 to i8**
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %4)
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%7 = call i32 @atoi(i8* %6)
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %8)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [12 x i8] c"Number: %d\0A\00"
define void @using_library_function() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = bitcast [100 x i8]* %1 to i8**
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %4)
%6 = call i32 @atoi(i8* %2)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ puts(char *);
int unlink(char *);
int main() {
  if (unlink("wambooli") == -1) {
    puts("I just can't kill that file");
    exit(1);
  }
  puts("File killed");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <unlink@plt>
cmp    $0xffffffff,%eax
jne    116a <main+0x3a>
lea    0xeae(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
lea    0xeb4(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <unlink@plt>
cmp    $0xffffffff,%eax
je     1152 <main+0x22>
lea    0xedc(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xeb0(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"wambooli\00"
@.str.1 = [28 x i8] c"I just can't kill that file\00"
@.str.2 = [12 x i8] c"File killed\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @unlink(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = call i32 @puts(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @exit(i32 1)
unreachable
7: ; preds = %0
%8 = call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"wambooli\00"
@.str.1 = [28 x i8] c"I just can't kill that file\00"
@.str.2 = [12 x i8] c"File killed\00"
define i32 @main() {
%1 = tail call i32 @unlink(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @exit(i32 1)
unreachable
6: ; preds = %0
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ error(int);
void check_empty(char *lptr) {
  while (*lptr <= ' ' && *lptr != '\0')
    lptr++;
  if (*lptr != '\0')
    error(38);
}


x86 assembly (clang, -O0):
<check_empty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x9(%rbp)
jg     1141 <check_empty+0x31>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1151 <check_empty+0x41>
jmp    1162 <check_empty+0x52>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <check_empty+0xc>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     117c <check_empty+0x6c>
mov    $0x26,%edi
call   1030 <error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_empty>:
movzbl (%rdi),%eax
cmp    $0x20,%al
jg     111f <check_empty+0xf>
add    $0x1,%rdi
test   %al,%al
jne    1110 <check_empty>
test   %al,%al
je     112d <check_empty+0x1d>
mov    $0x26,%edi
jmp    1030 <error@plt>
ret

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

LLVM IR (-O2):
define void @check_empty(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %8, %2 ]
%4 = load i8, i8* %3
%5 = icmp sgt i8 %4, 32
%6 = icmp eq i8 %4, 0
%7 = or i1 %5, %6
%8 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %7, label %9, label %2
9: ; preds = %2
br i1 %6, label %12, label %10
10: ; preds = %9
%11 = tail call i32 @error(i32 38)
br label %12
12: ; preds = %10, %9
ret void
}
void ff_hevc_put_hevc_qpel_h16_10_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_qpel_h16_10_sse4() {
ret void
}
int main(void) {
  int counter;
  for (counter = 0; counter < 5; counter++) {
    int a;
    a++;
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1133 <main+0x33>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1112 <main+0x12>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%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
br label %4
4: ; preds = %10, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 5
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
store i32 %9, i32* %3
br label %10
10: ; preds = %7
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
store i32 %12, i32* %2
br label %4
13: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int fcntl_lock(int, int, long long, long long, int);
int vfswrap_lock(char *fsp, int fd, int op, long long offset, long long count,
                 int type) {
  return fcntl_lock(fd, op, offset, count, type);
}


x86 assembly (clang, -O0):
<vfswrap_lock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
call   1030 <fcntl_lock@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vfswrap_lock>:
mov    %esi,%edi
mov    %edx,%esi
mov    %rcx,%rdx
mov    %r8,%rcx
mov    %r9d,%r8d
jmp    1030 <fcntl_lock@plt>

LLVM IR (-O0):
define i32 @vfswrap_lock(i8* %0, i32 %1, i32 %2, i64 %3, i64 %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i64
%11 = alloca i64
%12 = alloca i32
store i8* %0, i8** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i64 %3, i64* %10
store i64 %4, i64* %11
store i32 %5, i32* %12
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = load i64, i64* %10
%16 = load i64, i64* %11
%17 = load i32, i32* %12
%18 = call i32 @fcntl_lock(i32 %13, i32 %14, i64 %15, i64 %16, i32 %17)
ret i32 %18
}

LLVM IR (-O2):
define i32 @vfswrap_lock(i8* nocapture readnone %0, i32 %1, i32 %2, i64 %3, i64 %4, i32 %5) {
%7 = tail call i32 @fcntl_lock(i32 %1, i32 %2, i64 %3, i64 %4, i32 %5)
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ copro_opc5ls_read(int /*<<< orphan*/);
uint32_t dbg_read(uint32_t addr) { return copro_opc5ls_read(addr); }


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

x86 assembly (clang, -O2):
<dbg_read>:
jmp    1030 <copro_opc5ls_read@plt>

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

LLVM IR (-O2):
define i32 @dbg_read(i32 %0) {
%2 = tail call i32 @copro_opc5ls_read(i32 %0)
ret i32 %2
}
int g_DUMMY_menu_create_menubar(int win_id) {
  win_id = win_id;
  return -1;
}


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

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

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

LLVM IR (-O2):
define i32 @g_DUMMY_menu_create_menubar(i32 %0) {
ret i32 -1
}
__attribute__((always_)) void pci_swiotlb_init(void) {}


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

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

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

LLVM IR (-O2):
define void @pci_swiotlb_init() {
ret void
}
int do_449() { return 449; }


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

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

LLVM IR (-O0):
define i32 @do_449() {
ret i32 449
}

LLVM IR (-O2):
define i32 @do_449() {
ret i32 449
}
int fail_destructor(void *ptr) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @fail_destructor(i8* nocapture readnone %0) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ cpc_key_press(int);
int /*<<< orphan*/ cpc_key_unpress(int);
void Joy_Cursor_Right(int value) {
  if (value) {
    cpc_key_press(0x01);
  } else {
    cpc_key_unpress(0x01);
  };
}


x86 assembly (clang, -O0):
<Joy_Cursor_Right>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1144 <Joy_Cursor_Right+0x24>
mov    $0x1,%edi
call   1030 <cpc_key_press@plt>
jmp    114e <Joy_Cursor_Right+0x2e>
mov    $0x1,%edi
call   1040 <cpc_key_unpress@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Joy_Cursor_Right>:
test   %edi,%edi
je     112e <Joy_Cursor_Right+0xe>
mov    $0x1,%edi
jmp    1030 <cpc_key_press@plt>
mov    $0x1,%edi
jmp    1040 <cpc_key_unpress@plt>

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

LLVM IR (-O2):
define void @Joy_Cursor_Right(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @cpc_key_press(i32 1)
br label %7
5: ; preds = %1
%6 = tail call i32 @cpc_key_unpress(i32 1)
br label %7
7: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ WF_EintHandler();
void _WFInterrupt() {
  *(volatile unsigned *)(0xBF800000 + (0x10044 + ((0) << 4))) = (1 << 4);
  *(volatile unsigned *)(0xBF800000 + (0x100c4 + ((0) << 4))) = (1 << 4);
  WF_EintHandler();
}


x86 assembly (clang, -O0):
<_WFInterrupt>:
push   %rbp
mov    %rsp,%rbp
mov    $0xbf810044,%eax
movl   $0x10,(%rax)
mov    $0xbf8100c4,%eax
movl   $0x10,(%rax)
mov    $0x0,%al
call   1030 <WF_EintHandler@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<_WFInterrupt>:
mov    $0xbf810044,%eax
movl   $0x10,(%rax)
movl   $0x10,0x80(%rax)
xor    %eax,%eax
jmp    1030 <WF_EintHandler@plt>

LLVM IR (-O0):
define void @_WFInterrupt() {
store volatile i32 16, i32* inttoptr (i64 3212902468 to i32*)
store volatile i32 16, i32* inttoptr (i64 3212902596 to i32*)
%1 = call i32 (...) @WF_EintHandler()
ret void
}

LLVM IR (-O2):
define void @_WFInterrupt() {
store volatile i32 16, i32* inttoptr (i64 3212902468 to i32*)
store volatile i32 16, i32* inttoptr (i64 3212902596 to i32*)
%1 = tail call i32 (...) @WF_EintHandler()
ret void
}
/* Variables and functions */
int POLLHUP;
int POLLIN;
int POLLOUT;
int poll_to_link(int events) {
  int r = 0;
  if (events & POLLIN)
    r |= 1;
  if (events & POLLHUP)
    r |= 1;
  if (events & POLLOUT)
    r |= 2;
  return r;
}


x86 assembly (clang, -O0):
<poll_to_link>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ec0(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     112c <poll_to_link+0x2c>
mov    -0x8(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2eaa(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     114a <poll_to_link+0x4a>
mov    -0x8(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ea4(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1168 <poll_to_link+0x68>
mov    -0x8(%rbp),%eax
or     $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<poll_to_link>:
mov    0x2ed1(%rip),%rax
mov    0x2ed2(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
xor    %edx,%edx
test   %edi,%ecx
setne  %dl
mov    0x2ed8(%rip),%rcx
lea    0x2(%rdx),%eax
test   %edi,(%rcx)
cmove  %edx,%eax
ret

LLVM IR (-O0):
@POLLIN = global i32 0
@POLLHUP = global i32 0
@POLLOUT = global i32 0
define i32 @poll_to_link(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* @POLLIN
%6 = and i32 %4, %5
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i32, i32* %3
%10 = or i32 %9, 1
store i32 %10, i32* %3
br label %11
11: ; preds = %8, %1
%12 = load i32, i32* %2
%13 = load i32, i32* @POLLHUP
%14 = and i32 %12, %13
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = load i32, i32* %3
%18 = or i32 %17, 1
store i32 %18, i32* %3
br label %19
19: ; preds = %16, %11
%20 = load i32, i32* %2
%21 = load i32, i32* @POLLOUT
%22 = and i32 %20, %21
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %19
%25 = load i32, i32* %3
%26 = or i32 %25, 2
store i32 %26, i32* %3
br label %27
27: ; preds = %24, %19
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@POLLIN = global i32 0
@POLLHUP = global i32 0
@POLLOUT = global i32 0
define i32 @poll_to_link(i32 %0) {
%2 = load i32, i32* @POLLIN
%3 = and i32 %2, %0
%4 = icmp ne i32 %3, 0
%5 = load i32, i32* @POLLHUP
%6 = and i32 %5, %0
%7 = icmp ne i32 %6, 0
%8 = select i1 %7, i1 true, i1 %4
%9 = zext i1 %8 to i32
%10 = load i32, i32* @POLLOUT
%11 = and i32 %10, %0
%12 = icmp eq i32 %11, 0
%13 = or i32 %9, 2
%14 = select i1 %12, i32 %9, i32 %13
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ TwoFunc();
int main() {
  TwoFunc();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <TwoFunc@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @TwoFunc()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @TwoFunc()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ cgbr(char *, int);
void cgbrtrue(int n) { cgbr("jz", n); }


x86 assembly (clang, -O0):
<cgbrtrue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <cgbr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgbrtrue>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <cgbr@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"jz\00"
define void @cgbrtrue(i32 %0) {
%2 = tail call i32 @cgbr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fn2(int *);
void fn3(void) {
  int c[1];
  fn2(c);
}


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

x86 assembly (clang, -O2):
<fn3>:
push   %rax
lea    0x4(%rsp),%rdi
call   1030 <fn2@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @fn3() {
%1 = alloca [1 x i32]
%2 = getelementptr inbounds [1 x i32], [1 x i32]* %1, i64 0, i64 0
%3 = call i32 @fn2(i32* %2)
ret void
}

LLVM IR (-O2):
define void @fn3() {
%1 = alloca [1 x i32]
%2 = bitcast [1 x i32]* %1 to i8*
%3 = getelementptr inbounds [1 x i32], [1 x i32]* %1, i64 0, i64 0
%4 = call i32 @fn2(i32* %3)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ SIG_BLOCK;
int /*<<< orphan*/ sigaddset(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
scalar_t__ sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *,
                       int /*<<< orphan*/ *);
int signalblock(int signum) {
  sigset_t newmask;
  sigemptyset(&newmask);
  sigaddset(&newmask, signum);
  if (sigprocmask(SIG_BLOCK, &newmask, NULL) < 0)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<signalblock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
lea    -0xc(%rbp),%rdi
call   1040 <sigemptyset@plt>
mov    -0x8(%rbp),%esi
lea    -0xc(%rbp),%rdi
call   1050 <sigaddset@plt>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
lea    -0xc(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigprocmask@plt>
cmp    $0x0,%rax
jge    117c <signalblock+0x4c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1183 <signalblock+0x53>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signalblock>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0x4(%rsp),%r14
mov    %r14,%rdi
call   1040 <sigemptyset@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1050 <sigaddset@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
mov    %r14,%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
sar    $0x3f,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@SIG_BLOCK = global i32 0
define i32 @signalblock(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = call i32 @sigemptyset(i32* %4)
%6 = load i32, i32* %3
%7 = call i32 @sigaddset(i32* %4, i32 %6)
%8 = load i32, i32* @SIG_BLOCK
%9 = call i64 @sigprocmask(i32 %8, i32* %4, i32* null)
%10 = icmp slt i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 -1, i32* %2
br label %13
12: ; preds = %1
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@SIG_BLOCK = global i32 0
define i32 @signalblock(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @sigemptyset(i32* %2)
%5 = call i32 @sigaddset(i32* %2, i32 %0)
%6 = load i32, i32* @SIG_BLOCK
%7 = call i64 @sigprocmask(i32 %6, i32* %2, i32* null)
%8 = ashr i64 %7, 63
%9 = trunc i64 %8 to i32
ret i32 %9
}
/* Variables and functions */
scalar_t__ malloc(scalar_t__);
char *strcpy(char *, char *);
scalar_t__ strlen(char *);
char *mystrdup(char *s) {
  char *temp;
  temp = (char *)malloc(strlen(s) + 1);
  return (temp == NULL ? NULL : strcpy(temp, s));
}


x86 assembly (clang, -O0):
<mystrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116b <mystrdup+0x3b>
xor    %eax,%eax
mov    %rax,-0x18(%rbp)
jmp    117c <mystrdup+0x4c>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mystrdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
test   %rax,%rax
je     115a <mystrdup+0x2a>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
jmp    115c <mystrdup+0x2c>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @mystrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i64 @malloc(i64 %6)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %12
11: ; preds = %1
br label %16
12: ; preds = %1
%13 = load i8*, i8** %3
%14 = load i8*, i8** %2
%15 = call i8* @strcpy(i8* %13, i8* %14)
br label %16
16: ; preds = %12, %11
%17 = phi i8* [ null, %11 ], [ %15, %12 ]
ret i8* %17
}

LLVM IR (-O2):
define i8* @mystrdup(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i64 @malloc(i64 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = inttoptr i64 %4 to i8*
%8 = tail call i8* @strcpy(i8* %7, i8* dereferenceable(1) %0)
br label %9
9: ; preds = %1, %6
%10 = phi i8* [ %7, %6 ], [ null, %1 ]
ret i8* %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void funHello() { printf("hello world"); }


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

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

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

LLVM IR (-O2):
@.str = [12 x i8] c"hello world\00"
define void @funHello() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ isspace(char);
char *skip_whitespace(char *str) {
  while (isspace(*str))
    ++str;
  return str;
}


x86 assembly (clang, -O0):
<skip_whitespace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     1143 <skip_whitespace+0x33>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <skip_whitespace+0xc>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_whitespace>:
push   %rbx
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rbx
nopl   0x0(%rax,%rax,1)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <isspace@plt>
test   %rax,%rax
jne    1120 <skip_whitespace+0x10>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @skip_whitespace(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %7, %2 ]
%4 = load i8, i8* %3
%5 = tail call i64 @isspace(i8 signext %4)
%6 = icmp eq i64 %5, 0
%7 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %6, label %8, label %2
8: ; preds = %2
ret i8* %3
}
/* Type definitions */
typedef int wctrans_t;

/* Variables and functions */
int /*<<< orphan*/ strcmp(char const *, char *);
wctrans_t wctrans(const char *class) {
  if (!strcmp(class, "toupper"))
    return 1;
  if (!strcmp(class, "tolower"))
    return 2;
  return 0;
}


x86 assembly (clang, -O0):
<wctrans>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1141 <wctrans+0x31>
movl   $0x1,-0x4(%rbp)
jmp    116d <wctrans+0x5d>
mov    -0x10(%rbp),%rdi
lea    0xebc(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1166 <wctrans+0x56>
movl   $0x2,-0x4(%rbp)
jmp    116d <wctrans+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wctrans>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1140 <wctrans+0x30>
lea    0xedd(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
add    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"toupper\00"
@.str.1 = [8 x i8] c"tolower\00"
define i32 @wctrans(i8* nocapture %0) {
%2 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, i32 2, i32 0
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ puts(int /*<<< orphan*/);
int /*<<< orphan*/ test3();
int main() {
  puts(test3());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <test3@plt>
mov    %eax,%edi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <test3@plt>
mov    %eax,%edi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test3()
%3 = call i32 @puts(i32 %2)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test3()
%2 = tail call i32 @puts(i32 %1)
ret i32 0
}
void cam_crate_clear(const int c) {}


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

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

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

LLVM IR (-O2):
define void @cam_crate_clear(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int ic, i, n = 7;
  ic = 0;
#pragma omp parallel for shared(ic, n) private(i)
  for (i = 0; i < n; i++) {
#pragma omp atomic
    ic += 1;
  }
  printf("Counter = %d\n", ic);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1157 <main+0x47>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1134 <main+0x24>
mov    -0x8(%rbp),%esi
lea    0xe9f(%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
mov    $0x7,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"Counter = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, int);
scalar_t__ smalloc(int);
char *string_ndup(const char *str, int length) {
  char *tmp;
  tmp = (char *)smalloc(length + 1);
  memcpy(tmp, str, length);
  tmp[length] = '\0';
  return tmp;
}


x86 assembly (clang, -O0):
<string_ndup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1040 <smalloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_ndup>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%r15d
mov    %rdi,%r14
lea    0x1(%r15),%edi
call   1040 <smalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1030 <memcpy@plt>
movslq %r15d,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @string_ndup(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = add nsw i32 %6, 1
%8 = call i64 @smalloc(i32 %7)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = load i8*, i8** %3
%12 = load i32, i32* %4
%13 = call i32 @memcpy(i8* %10, i8* %11, i32 %12)
%14 = load i8*, i8** %5
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
store i8 0, i8* %17
%18 = load i8*, i8** %5
ret i8* %18
}

LLVM IR (-O2):
define i8* @string_ndup(i8* %0, i32 %1) {
%3 = add nsw i32 %1, 1
%4 = tail call i64 @smalloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @memcpy(i8* %5, i8* %0, i32 %1)
%7 = sext i32 %1 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
store i8 0, i8* %8
ret i8* %5
}
/* Type definitions */
typedef scalar_t__ time_t;

/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ insert(char *);
char *rnd_string();
int /*<<< orphan*/ srand(unsigned int);
int /*<<< orphan*/ time(scalar_t__ *);
void test_2(void) {
  time_t t;
  time(&t);
  srand((unsigned int)t);
  int i;
  for (i = 0; i < 10000; i++) {
    char *s = rnd_string();
    insert(s);
    free(s);
  }
}


x86 assembly (clang, -O0):
<test_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x8(%rbp),%rdi
call   1050 <time@plt>
mov    -0x8(%rbp),%rax
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x2710,-0xc(%rbp)
jge    11ab <test_2+0x5b>
mov    $0x0,%al
call   1070 <rnd_string@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <insert@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1173 <test_2+0x23>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_2>:
push   %rbp
push   %rbx
push   %rax
mov    %rsp,%rdi
call   1050 <time@plt>
mov    (%rsp),%edi
call   1040 <srand@plt>
mov    $0x2710,%ebp
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <rnd_string@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <insert@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0xffffffff,%ebp
jne    1170 <test_2+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @test_2() {
%1 = alloca i64
%2 = alloca i32
%3 = alloca i8*
%4 = call i32 @time(i64* %1)
%5 = load i64, i64* %1
%6 = trunc i64 %5 to i32
%7 = call i32 @srand(i32 %6)
store i32 0, i32* %2
br label %8
8: ; preds = %17, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 10000
br i1 %10, label %11, label %20
11: ; preds = %8
%12 = call i8* (...) @rnd_string()
store i8* %12, i8** %3
%13 = load i8*, i8** %3
%14 = call i32 @insert(i8* %13)
%15 = load i8*, i8** %3
%16 = call i32 @free(i8* %15)
br label %17
17: ; preds = %11
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %8
20: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @test_2() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i32 @time(i64* %1)
%4 = load i64, i64* %1
%5 = trunc i64 %4 to i32
%6 = call i32 @srand(i32 %5)
br label %7
7: ; preds = %0, %7
%8 = phi i32 [ 0, %0 ], [ %12, %7 ]
%9 = call i8* (...) @rnd_string()
%10 = call i32 @insert(i8* %9)
%11 = call i32 @free(i8* %9)
%12 = add nuw nsw i32 %8, 1
%13 = icmp eq i32 %12, 10000
br i1 %13, label %14, label %7
14: ; preds = %7
ret void
}
void fsl_udc_clk_resume(void) {}


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

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

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

LLVM IR (-O2):
define void @fsl_udc_clk_resume() {
ret void
}
char abs_fun_char(char a) {
  char mask = a >> 7;
  return (a + mask) ^ mask;
}


x86 assembly (clang, -O0):
<abs_fun_char>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
sar    $0x7,%eax
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
movsbl -0x2(%rbp),%ecx
add    %ecx,%eax
movsbl -0x2(%rbp),%ecx
xor    %ecx,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<abs_fun_char>:
mov    %edi,%ecx
sar    $0x7,%cl
lea    (%rdi,%rcx,1),%eax
xor    %cl,%al
ret

LLVM IR (-O0):
define signext i8 @abs_fun_char(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = ashr i32 %5, 7
%7 = trunc i32 %6 to i8
store i8 %7, i8* %3
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = load i8, i8* %3
%11 = sext i8 %10 to i32
%12 = add nsw i32 %9, %11
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = xor i32 %12, %14
%16 = trunc i32 %15 to i8
ret i8 %16
}

LLVM IR (-O2):
define signext i8 @abs_fun_char(i8 signext %0) {
%2 = tail call i8 @llvm.abs.i8(i8 %0, i1 false)
ret i8 %2
}
int arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) { return 0; }


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

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

LLVM IR (-O0):
%struct.mm_struct = type opaque
define i32 @arch_dup_mmap(%struct.mm_struct* %0, %struct.mm_struct* %1) {
%3 = alloca %struct.mm_struct*
%4 = alloca %struct.mm_struct*
store %struct.mm_struct* %0, %struct.mm_struct** %3
store %struct.mm_struct* %1, %struct.mm_struct** %4
ret i32 0
}

LLVM IR (-O2):
%struct.mm_struct = type opaque
define i32 @arch_dup_mmap(%struct.mm_struct* nocapture readnone %0, %struct.mm_struct* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
void *kmalloc(unsigned int);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, unsigned int);
void *kzalloc(unsigned size) {
  void *p = kmalloc(size);
  if (p)
    memset(p, 0, size);
  return p;
}


x86 assembly (clang, -O0):
<kzalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <kmalloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1150 <kzalloc+0x30>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kzalloc>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
call   1040 <kmalloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     113e <kzalloc+0x1e>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @kzalloc(i32 %0) {
%2 = tail call i8* @kmalloc(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @memset(i8* %2, i32 0, i32 %0)
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Variables and functions */
int evaluate(char, int, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("suma:%d\n", evaluate('+', 3, 7));
  printf("resta:%d\n", evaluate('-', 7, 3));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2b,%edi
mov    $0x3,%esi
mov    $0x7,%edx
call   1040 <evaluate@plt>
mov    %eax,%esi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    $0x2d,%edi
mov    $0x7,%esi
mov    $0x3,%edx
call   1040 <evaluate@plt>
mov    %eax,%esi
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2b,%edi
mov    $0x3,%esi
mov    $0x7,%edx
call   1040 <evaluate@plt>
lea    0xec4(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x2d,%edi
mov    $0x7,%esi
mov    $0x3,%edx
call   1040 <evaluate@plt>
lea    0xeab(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"suma:%d\0A\00"
@.str.1 = [10 x i8] c"resta:%d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @evaluate(i8 signext 43, i32 3, i32 7)
%3 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = call i32 @evaluate(i8 signext 45, i32 7, i32 3)
%5 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"suma:%d\0A\00"
@.str.1 = [10 x i8] c"resta:%d\0A\00"
define i32 @main() {
%1 = tail call i32 @evaluate(i8 signext 43, i32 3, i32 7)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @evaluate(i8 signext 45, i32 7, i32 3)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret i32 0
}
void foo(void) {}


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

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

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

LLVM IR (-O2):
define void @foo() {
ret void
}
int i2(int *base) { return base[-00400000]; }


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

x86 assembly (clang, -O2):
<i2>:
mov    -0x80000(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @i2(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 -131072
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @i2(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 -131072
%3 = load i32, i32* %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ stop_workers();
void exit_cleanup(void) {
  stop_workers();
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<exit_cleanup>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <stop_workers@plt>
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<exit_cleanup>:
push   %rax
xor    %eax,%eax
call   1040 <stop_workers@plt>
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
define void @exit_cleanup() {
%1 = call i32 (...) @stop_workers()
%2 = load i32, i32* @EXIT_FAILURE
%3 = call i32 @exit(i32 %2)
unreachable
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define void @exit_cleanup() {
%1 = tail call i32 (...) @stop_workers()
%2 = load i32, i32* @EXIT_FAILURE
%3 = tail call i32 @exit(i32 %2)
unreachable
}
void abort(void) { _Exit(0xff); }


x86 assembly (clang, -O0):
<abort>:
push   %rbp
mov    %rsp,%rbp
mov    $0xff,%edi
call   1030 <_Exit@plt>

x86 assembly (clang, -O2):
<abort>:
push   %rax
mov    $0xff,%edi
call   1030 <_Exit@plt>

LLVM IR (-O0):
define void @abort() {
unreachable
}

LLVM IR (-O2):
define void @abort() {
tail call void @_Exit(i32 255)
unreachable
}
indreg0regx1_set(r0, r1, x0, x1, p0, p1) float r0, r1;
float *p0, *p1;
{ (*p0) = (p1[x1]); }


x86 assembly (clang, -O0):
<indreg0regx1_set>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm1,-0x30(%rbp)
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
cvtsd2ss %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm0
movss  %xmm1,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<indreg0regx1_set>:
movslq %esi,%rax
movss  (%rcx,%rax,4),%xmm0
movss  %xmm0,(%rdx)
ret

LLVM IR (-O0):
define i32 @indreg0regx1_set(double %0, double %1, i32 %2, i32 %3, float* %4, float* %5) {
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca i32
%12 = alloca float*
%13 = alloca float*
%14 = fptrunc double %0 to float
%15 = fptrunc double %1 to float
store float %14, float* %8
store float %15, float* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store float* %4, float** %12
store float* %5, float** %13
%16 = load float*, float** %13
%17 = load i32, i32* %11
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds float, float* %16, i64 %18
%20 = load float, float* %19
%21 = load float*, float** %12
store float %20, float* %21
%22 = load i32, i32* %7
ret i32 %22
}

LLVM IR (-O2):
define i32 @indreg0regx1_set(double %0, double %1, i32 %2, i32 %3, float* nocapture writeonly %4, float* nocapture %5) {
%7 = sext i32 %3 to i64
%8 = getelementptr inbounds float, float* %5, i64 %7
%9 = load float, float* %8
store float %9, float* %4
ret i32 undef
}
/* Type definitions */
struct timespec {
  int dummy;
};
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int sched_rr_get_interval(int /*<<< orphan*/, struct timespec *);
int main(void) {
  struct timespec ts;
  pid_t pid = 0;
  return sched_rr_get_interval(pid, &ts);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %rsp,%rsi
xor    %edi,%edi
call   1030 <sched_rr_get_interval@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.timespec
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%4 = load i32, i32* %3
%5 = call i32 @sched_rr_get_interval(i32 %4, %struct.timespec* %2)
ret i32 %5
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
define i32 @main() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = call i32 @sched_rr_get_interval(i32 0, %struct.timespec* %1)
ret i32 %3
}