xunge/DecIR huggingface dataset:
/* Variables and functions */
#define SIGCHLD 128
int /*<<< orphan*/ WNOHANG;
int /*<<< orphan*/ waitpid(int, int *, int /*<<< orphan*/);
void traitement_signal(int sig) {
  int status;
  switch (sig) {
  case SIGCHLD:
    while (waitpid(-1, &status, WNOHANG) > 0)
      ;
  }
}


x86 assembly (clang, -O0):
<traitement_signal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x80,%eax
jne    115d <traitement_signal+0x4d>
jmp    112e <traitement_signal+0x1e>
jmp    1133 <traitement_signal+0x23>
mov    0x2eae(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
lea    -0x8(%rbp),%rsi
call   1030 <waitpid@plt>
cmp    $0x0,%eax
jle    1158 <traitement_signal+0x48>
jmp    1133 <traitement_signal+0x23>
jmp    115d <traitement_signal+0x4d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<traitement_signal>:
push   %r14
push   %rbx
push   %rax
cmp    $0x80,%edi
jne    1144 <traitement_signal+0x34>
mov    0x2ec5(%rip),%r14
lea    0x4(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    (%r14),%edx
mov    $0xffffffff,%edi
mov    %rbx,%rsi
call   1030 <waitpid@plt>
test   %eax,%eax
jg     1130 <traitement_signal+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@WNOHANG = global i32 0
define void @traitement_signal(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
switch i32 %4, label %12 [
i32 128, label %5
]
5: ; preds = %1
br label %6
6: ; preds = %10, %5
%7 = load i32, i32* @WNOHANG
%8 = call i32 @waitpid(i32 -1, i32* %3, i32 %7)
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %6
br label %6
11: ; preds = %6
br label %12
12: ; preds = %11, %1
ret void
}

LLVM IR (-O2):
@WNOHANG = global i32 0
define void @traitement_signal(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = icmp eq i32 %0, 128
br i1 %4, label %5, label %9
5: ; preds = %1, %5
%6 = load i32, i32* @WNOHANG
%7 = call i32 @waitpid(i32 -1, i32* %2, i32 %6)
%8 = icmp sgt i32 %7, 0
br i1 %8, label %5, label %9
9: ; preds = %5, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ db(int);
void lfence() {
  db(0x0F);
  db(0xAE);
  db(0xE8);
}


x86 assembly (clang, -O0):
<lfence>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf,%edi
call   1030 <db@plt>
mov    $0xae,%edi
call   1030 <db@plt>
mov    $0xe8,%edi
call   1030 <db@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<lfence>:
push   %rax
mov    $0xf,%edi
call   1030 <db@plt>
mov    $0xae,%edi
call   1030 <db@plt>
mov    $0xe8,%edi
pop    %rax
jmp    1030 <db@plt>

LLVM IR (-O0):
define void @lfence() {
%1 = call i32 @db(i32 15)
%2 = call i32 @db(i32 174)
%3 = call i32 @db(i32 232)
ret void
}

LLVM IR (-O2):
define void @lfence() {
%1 = tail call i32 @db(i32 15)
%2 = tail call i32 @db(i32 174)
%3 = tail call i32 @db(i32 232)
ret void
}
int sl31(unsigned int a) { return (a << 31) != 0; }


x86 assembly (clang, -O0):
<sl31>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1f,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @sl31(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 31
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @sl31(i32 %0) {
%2 = and i32 %0, 1
ret i32 %2
}
unsigned long UARTRxErrorGet(unsigned long ulBase) {
  ;
  return ((*((volatile unsigned long *)(ulBase + 0x00000004))) & 0x0000000F);
}


x86 assembly (clang, -O0):
<UARTRxErrorGet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%rax
and    $0xf,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTRxErrorGet>:
mov    0x4(%rdi),%rax
and    $0xf,%eax
ret

LLVM IR (-O0):
define i64 @UARTRxErrorGet(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add i64 %3, 4
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
%7 = and i64 %6, 15
ret i64 %7
}

LLVM IR (-O2):
define i64 @UARTRxErrorGet(i64 %0) {
%2 = add i64 %0, 4
%3 = inttoptr i64 %2 to i64*
%4 = load volatile i64, i64* %3
%5 = and i64 %4, 15
ret i64 %5
}
/* Variables and functions */
const char *default_scheme(void) { return ("VTOC8"); }


x86 assembly (clang, -O0):
<default_scheme>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<default_scheme>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"VTOC8\00"
define i8* @default_scheme() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [6 x i8] c"VTOC8\00"
define i8* @default_scheme() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
int bio_add_page(struct bio *x, struct page *y, unsigned int z,
                 unsigned int w) {
  int a;
  return a;
}


x86 assembly (clang, -O0):
<bio_add_page>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.bio = type opaque
%struct.page = type opaque
define i32 @bio_add_page(%struct.bio* %0, %struct.page* %1, i32 %2, i32 %3) {
%5 = alloca %struct.bio*
%6 = alloca %struct.page*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store %struct.bio* %0, %struct.bio** %5
store %struct.page* %1, %struct.page** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %9
ret i32 %10
}

LLVM IR (-O2):
%struct.bio = type opaque
%struct.page = type opaque
define i32 @bio_add_page(%struct.bio* nocapture readnone %0, %struct.page* nocapture readnone %1, i32 %2, i32 %3) {
ret i32 undef
}
/* Variables and functions */
int auditwarnlog(char **);
int audit_warn_nostart(void) {
  char *args[2];
  args[0] = "nostart";
  args[1] = NULL;
  return (auditwarnlog(args));
}


x86 assembly (clang, -O0):
<audit_warn_nostart>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rax
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <auditwarnlog@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<audit_warn_nostart>:
sub    $0x18,%rsp
lea    0xee5(%rip),%rax
mov    %rax,(%rsp)
movq   $0x0,0x8(%rsp)
mov    %rsp,%rdi
call   1030 <auditwarnlog@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"nostart\00"
define i32 @audit_warn_nostart() {
%1 = alloca [2 x i8*]
%2 = getelementptr inbounds [2 x i8*], [2 x i8*]* %1, i64 0, i64 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = getelementptr inbounds [2 x i8*], [2 x i8*]* %1, i64 0, i64 1
store i8* null, i8** %3
%4 = getelementptr inbounds [2 x i8*], [2 x i8*]* %1, i64 0, i64 0
%5 = call i32 @auditwarnlog(i8** %4)
ret i32 %5
}

LLVM IR (-O2):
@.str = [8 x i8] c"nostart\00"
define i32 @audit_warn_nostart() {
%1 = alloca [2 x i8*]
%2 = bitcast [2 x i8*]* %1 to i8*
%3 = getelementptr inbounds [2 x i8*], [2 x i8*]* %1, i64 0, i64 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = getelementptr inbounds [2 x i8*], [2 x i8*]* %1, i64 0, i64 1
store i8* null, i8** %4
%5 = call i32 @auditwarnlog(i8** %3)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ oom();
char *strdup(char const *);
char *strdup_err(const char *x) {
  char *p = strdup(x);
  if (p == NULL)
    oom();
  return p;
}


x86 assembly (clang, -O0):
<strdup_err>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114b <strdup_err+0x2b>
mov    $0x0,%al
call   1030 <oom@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup_err>:
push   %rbx
call   1040 <strdup@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1135 <strdup_err+0x15>
xor    %eax,%eax
call   1030 <oom@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define noalias i8* @strdup_err(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @oom()
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Variables and functions */
int sscanf(char const *, char *, unsigned int *);
unsigned str_to_uint(const char *str) {
  unsigned n;
  if (!str || sscanf(str, "%u", &n) != 1)
    return 0;
  return n;
}


x86 assembly (clang, -O0):
<str_to_uint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1144 <str_to_uint+0x34>
mov    -0x10(%rbp),%rdi
lea    0xece(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <sscanf@plt>
cmp    $0x1,%eax
je     1150 <str_to_uint+0x40>
movl   $0x0,-0x4(%rbp)
jmp    1156 <str_to_uint+0x46>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_to_uint>:
test   %rdi,%rdi
je     1139 <str_to_uint+0x29>
push   %rax
lea    0xee3(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1030 <sscanf@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
jne    1134 <str_to_uint+0x24>
mov    0x4(%rsp),%eax
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%u\00"
define i32 @str_to_uint(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = icmp eq i8* %0, null
br i1 %4, label %10, label %5
5: ; preds = %1
%6 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = icmp eq i32 %6, 1
%8 = load i32, i32* %2
%9 = select i1 %7, i32 %8, i32 0
br label %10
10: ; preds = %5, %1
%11 = phi i32 [ 0, %1 ], [ %9, %5 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ ssd1306_write_command(int);
void ssd1306_display_invert_enable(void) { ssd1306_write_command(0xA7); }


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

x86 assembly (clang, -O2):
<ssd1306_display_invert_enable>:
mov    $0xa7,%edi
jmp    1030 <ssd1306_write_command@plt>

LLVM IR (-O0):
define void @ssd1306_display_invert_enable() {
%1 = call i32 @ssd1306_write_command(i32 167)
ret void
}

LLVM IR (-O2):
define void @ssd1306_display_invert_enable() {
%1 = tail call i32 @ssd1306_write_command(i32 167)
ret void
}
void fd238(int n) {
a : {
  typedef int(*b)[n];
P01A:
  goto P01A;
  {
    typedef int(*c)[n];
  P012A:
    goto P012A;
    0;
  }
P01B:
  goto P01B;
  {
    typedef int(*d)[n];
  P013A:
    goto P013A;
    0;
  }
P01C:
  goto P01C;
  ;
  typedef int(*e)[n];
P014A:
  goto P014A;
  0;
};
P0B:
  goto P0B;
  {
    typedef int(*f)[n];
  P02A:
    goto P02A;
    {
      typedef int(*g)[n];
    P024A:
      goto P024A;
      0;
    };
  P02B:
    goto P02B;
    {
      typedef int(*h)[n];
    P025A:
      goto P025A;
      0;
    };
  P02C:
    goto P02C;
    ;
    typedef int(*i)[n];
  P026A:
    goto P026A;
    0;
  };
p0C:
  goto p0C;
  goto a;
P0C:
  goto P0C;
  ;
  typedef int(*j)[n];
P03A:
  goto P03A;
  0;
P03B:
  goto P03B;
}


x86 assembly (clang, -O0):
<fd238>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
jmp    1107 <fd238+0x7>

x86 assembly (clang, -O2):
<fd238>:
jmp    1100 <fd238>

LLVM IR (-O0):
define void @fd238(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %1
%4 = load i32, i32* %2
%5 = zext i32 %4 to i64
br label %6
6: ; preds = %6, %3
br label %6
7: ; No predecessors!
%8 = load i32, i32* %2
%9 = zext i32 %8 to i64
br label %10
10: ; preds = %10, %7
br label %10
11: ; preds = %11
br label %11
12: ; No predecessors!
%13 = load i32, i32* %2
%14 = zext i32 %13 to i64
br label %15
15: ; preds = %15, %12
br label %15
16: ; preds = %16
br label %16
17: ; No predecessors!
%18 = load i32, i32* %2
%19 = zext i32 %18 to i64
br label %20
20: ; preds = %20, %17
br label %20
21: ; preds = %21
br label %21
22: ; No predecessors!
%23 = load i32, i32* %2
%24 = zext i32 %23 to i64
br label %25
25: ; preds = %25, %22
br label %25
26: ; No predecessors!
%27 = load i32, i32* %2
%28 = zext i32 %27 to i64
br label %29
29: ; preds = %29, %26
br label %29
30: ; preds = %30
br label %30
31: ; No predecessors!
%32 = load i32, i32* %2
%33 = zext i32 %32 to i64
br label %34
34: ; preds = %34, %31
br label %34
35: ; preds = %35
br label %35
36: ; No predecessors!
%37 = load i32, i32* %2
%38 = zext i32 %37 to i64
br label %39
39: ; preds = %39, %36
br label %39
40: ; preds = %40
br label %40
41: ; preds = %41
br label %41
42: ; No predecessors!
%43 = load i32, i32* %2
%44 = zext i32 %43 to i64
br label %45
45: ; preds = %45, %42
br label %45
46: ; preds = %46
br label %46
}

LLVM IR (-O2):
define void @fd238(i32 %0) {
br label %2
2: ; preds = %2, %1
br label %2
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int /*<<< orphan*/ write(int, char const *, int /*<<< orphan*/);
ssize_t network_write_data_len(int fd, const char *data, off_t len) {
  return write(fd, data, len);
}


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

x86 assembly (clang, -O2):
<network_write_data_len>:
jmp    1030 <write@plt>

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

LLVM IR (-O2):
define i32 @network_write_data_len(i32 %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int filepath_exists(int /*<<< orphan*/);
int /*<<< orphan*/ get_preferences_fullpath();
int preferences_file_exists() {
  return filepath_exists(get_preferences_fullpath());
}


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

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

LLVM IR (-O0):
define i32 @preferences_file_exists() {
%1 = call i32 (...) @get_preferences_fullpath()
%2 = call i32 @filepath_exists(i32 %1)
ret i32 %2
}

LLVM IR (-O2):
define i32 @preferences_file_exists() {
%1 = tail call i32 (...) @get_preferences_fullpath()
%2 = tail call i32 @filepath_exists(i32 %1)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ testSort(int);
int main(int argc, char **argv) {
  testSort(16);
  testSort(1 << 10);
  testSort(1 << 20);
  testSort(128 * 1 << 20);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x10,%edi
call   1030 <testSort@plt>
mov    $0x400,%edi
call   1030 <testSort@plt>
mov    $0x100000,%edi
call   1030 <testSort@plt>
mov    $0x8000000,%edi
call   1030 <testSort@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @testSort(i32 16)
%7 = call i32 @testSort(i32 1024)
%8 = call i32 @testSort(i32 1048576)
%9 = call i32 @testSort(i32 134217728)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @testSort(i32 16)
%4 = tail call i32 @testSort(i32 1024)
%5 = tail call i32 @testSort(i32 1048576)
%6 = tail call i32 @testSort(i32 134217728)
ret i32 0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  uint32_t u = 101010;
  uint32_t result = u;
  printf("result=%ld\n", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x18a92,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xeca(%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    $0x18a92,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"result=%ld\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 101010)
ret i32 0
}
int add1(int a) { return a + 1; }


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

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

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

LLVM IR (-O2):
define i32 @add1(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
/* Type definitions */
typedef union fc_sockaddr {
  int dummy;
} fc_sockaddr;
struct genlist {
  int dummy;
};
struct fc_sockaddr_list {
  int dummy;
};

/* Variables and functions */
int genlist_remove_all(struct genlist *, union fc_sockaddr const *);
int fc_sockaddr_list_remove_all(struct fc_sockaddr_list *tthis,
                                const union fc_sockaddr *pfoo) {
  return genlist_remove_all((struct genlist *)tthis, pfoo);
}


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

x86 assembly (clang, -O2):
<fc_sockaddr_list_remove_all>:
jmp    1030 <genlist_remove_all@plt>

LLVM IR (-O0):
%struct.fc_sockaddr_list = type { i32 }
%union.fc_sockaddr = type { i32 }
%struct.genlist = type { i32 }
define i32 @fc_sockaddr_list_remove_all(%struct.fc_sockaddr_list* %0, %union.fc_sockaddr* %1) {
%3 = alloca %struct.fc_sockaddr_list*
%4 = alloca %union.fc_sockaddr*
store %struct.fc_sockaddr_list* %0, %struct.fc_sockaddr_list** %3
store %union.fc_sockaddr* %1, %union.fc_sockaddr** %4
%5 = load %struct.fc_sockaddr_list*, %struct.fc_sockaddr_list** %3
%6 = bitcast %struct.fc_sockaddr_list* %5 to %struct.genlist*
%7 = load %union.fc_sockaddr*, %union.fc_sockaddr** %4
%8 = call i32 @genlist_remove_all(%struct.genlist* %6, %union.fc_sockaddr* %7)
ret i32 %8
}

LLVM IR (-O2):
%struct.fc_sockaddr_list = type { i32 }
%union.fc_sockaddr = type { i32 }
%struct.genlist = type { i32 }
define i32 @fc_sockaddr_list_remove_all(%struct.fc_sockaddr_list* %0, %union.fc_sockaddr* %1) {
%3 = bitcast %struct.fc_sockaddr_list* %0 to %struct.genlist*
%4 = tail call i32 @genlist_remove_all(%struct.genlist* %3, %union.fc_sockaddr* %1)
ret i32 %4
}
int t(int a, int b, int c) {
  int *p;
  if (a)
    p = &a;
  else
    p = &c;
  return *p;
}


x86 assembly (clang, -O0):
<t>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1124 <t+0x24>
lea    -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112c <t+0x2c>
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<t>:
mov    %edx,%eax
test   %edi,%edi
cmovne %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @t(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i32 %2, i32 %0
ret i32 %5
}
/* Type definitions */
struct tokeniser {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ error(struct tokeniser *, char *, int /*<<< orphan*/,
                         int /*<<< orphan*/, char *);
void error2(struct tokeniser *t, char *s) {
  error(t, "unexpected end of text after ", 0, 0, s);
}


x86 assembly (clang, -O0):
<error2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%r8
lea    0xed1(%rip),%rsi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1030 <error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error2>:
mov    %rsi,%r8
lea    0xee6(%rip),%rsi
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <error@plt>

LLVM IR (-O0):
%struct.tokeniser = type { i32 }
@.str = [30 x i8] c"unexpected end of text after \00"
define void @error2(%struct.tokeniser* %0, i8* %1) {
%3 = alloca %struct.tokeniser*
%4 = alloca i8*
store %struct.tokeniser* %0, %struct.tokeniser** %3
store i8* %1, i8** %4
%5 = load %struct.tokeniser*, %struct.tokeniser** %3
%6 = load i8*, i8** %4
%7 = call i32 @error(%struct.tokeniser* %5, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 0, i32 0, i8* %6)
ret void
}

LLVM IR (-O2):
%struct.tokeniser = type { i32 }
@.str = [30 x i8] c"unexpected end of text after \00"
define void @error2(%struct.tokeniser* %0, i8* %1) {
%3 = tail call i32 @error(%struct.tokeniser* %0, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 0, i32 0, i8* %1)
ret void
}
void ASN1_STRING_new(void) {}


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

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

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

LLVM IR (-O2):
define void @ASN1_STRING_new() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ error(char *);
void errorLongExpr(void) { error("Expression too long\n"); }


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

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

LLVM IR (-O0):
@.str = [21 x i8] c"Expression too long\0A\00"
define void @errorLongExpr() {
%1 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"Expression too long\0A\00"
define void @errorLongExpr() {
%1 = tail call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}
void *clrmem1(void *s) { return __builtin_memset(s, 0, 42); }


x86 assembly (clang, -O0):
<clrmem1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    %rdi,-0x10(%rbp)
xor    %esi,%esi
mov    $0x2a,%edx
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clrmem1>:
mov    %rdi,%rax
xorps  %xmm0,%xmm0
movups %xmm0,0x1a(%rdi)
movups %xmm0,0x10(%rdi)
movups %xmm0,(%rdi)
ret

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

LLVM IR (-O2):
define i8* @clrmem1(i8* returned writeonly %0) {
tail call void @llvm.memset.p0i8.i64(i8* align 1 dereferenceable(42) %0, i8 0, i64 42, i1 false)
ret i8* %0
}
/* Type definitions */
struct flashrom_flashctx {
  int dummy;
};

/* Variables and functions */
int spi_write_cmd(struct flashrom_flashctx *, int, int, unsigned int,
                  int /*<<< orphan*/ *, int /*<<< orphan*/, int);
int spi_block_erase_50(struct flashrom_flashctx *flash, unsigned int addr,
                       unsigned int blocklen) {
  return spi_write_cmd(flash, 0x50, false, addr, NULL, 0, 1 * 1000);
}


x86 assembly (clang, -O0):
<spi_block_erase_50>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
mov    $0x50,%esi
xor    %r9d,%r9d
xor    %eax,%eax
mov    %eax,%r8d
mov    %r9d,%edx
movl   $0x3e8,(%rsp)
call   1030 <spi_write_cmd@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spi_block_erase_50>:
push   %rax
mov    %esi,%ecx
movl   $0x3e8,(%rsp)
mov    $0x50,%esi
xor    %edx,%edx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <spi_write_cmd@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.flashrom_flashctx = type { i32 }
define i32 @spi_block_erase_50(%struct.flashrom_flashctx* %0, i32 %1, i32 %2) {
%4 = alloca %struct.flashrom_flashctx*
%5 = alloca i32
%6 = alloca i32
store %struct.flashrom_flashctx* %0, %struct.flashrom_flashctx** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load %struct.flashrom_flashctx*, %struct.flashrom_flashctx** %4
%8 = load i32, i32* %5
%9 = call i32 @spi_write_cmd(%struct.flashrom_flashctx* %7, i32 80, i32 0, i32 %8, i32* null, i32 0, i32 1000)
ret i32 %9
}

LLVM IR (-O2):
%struct.flashrom_flashctx = type { i32 }
define i32 @spi_block_erase_50(%struct.flashrom_flashctx* %0, i32 %1, i32 %2) {
%4 = tail call i32 @spi_write_cmd(%struct.flashrom_flashctx* %0, i32 80, i32 0, i32 %1, i32* null, i32 0, i32 1000)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char const *);
void puke(const char *message) {
  perror(message);
  exit(1);
}


x86 assembly (clang, -O0):
<puke>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<puke>:
push   %rax
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @puke(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @puke(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
char *emalloc(scalar_t__);
char *getenv(char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *replace_tilde(char *fname) {
  char *retval;
  char *homedir = getenv("HOME");
  retval = emalloc(strlen(homedir) + strlen(fname));
  strcpy(retval, homedir);
  strcat(retval, ++fname);
  return retval;
}


x86 assembly (clang, -O0):
<replace_tilde>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe9d(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x20(%rbp),%rdi
add    %rax,%rdi
call   1060 <emalloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0x1,%rsi
mov    %rsi,-0x8(%rbp)
call   1070 <strcat@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<replace_tilde>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
lea    0xea1(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1050 <strlen@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1050 <strlen@plt>
add    %rax,%rbx
mov    %rbx,%rdi
call   1060 <emalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
add    $0x1,%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <strcat@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"HOME\00"
define i8* @replace_tilde(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %4
%6 = load i8*, i8** %4
%7 = call i64 @strlen(i8* %6)
%8 = load i8*, i8** %2
%9 = call i64 @strlen(i8* %8)
%10 = add nsw i64 %7, %9
%11 = call i8* @emalloc(i64 %10)
store i8* %11, i8** %3
%12 = load i8*, i8** %3
%13 = load i8*, i8** %4
%14 = call i32 @strcpy(i8* %12, i8* %13)
%15 = load i8*, i8** %3
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %2
%18 = call i32 @strcat(i8* %15, i8* %17)
%19 = load i8*, i8** %3
ret i8* %19
}

LLVM IR (-O2):
@.str = [5 x i8] c"HOME\00"
define i8* @replace_tilde(i8* %0) {
%2 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%5 = add nsw i64 %4, %3
%6 = tail call i8* @emalloc(i64 %5)
%7 = tail call i32 @strcpy(i8* %6, i8* %2)
%8 = getelementptr inbounds i8, i8* %0, i64 1
%9 = tail call i32 @strcat(i8* %6, i8* %8)
ret i8* %6
}
/* Variables and functions */
int strlen(char *);
char tolower(char);
char *lower(char *s) {
  int i;
  for (i = 0; i < strlen(s); ++i)
    s[i] = tolower(s[i]);
  return s;
}


x86 assembly (clang, -O0):
<lower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jge    117b <lower+0x5b>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <tolower@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <lower+0x13>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lower>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
test   %eax,%eax
jle    1161 <lower+0x41>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl (%r14,%rbx,1),%edi
call   1040 <tolower@plt>
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1140 <lower+0x20>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @lower(i8* returned %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %13
4: ; preds = %1, %4
%5 = phi i64 [ %9, %4 ], [ 0, %1 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = tail call signext i8 @tolower(i8 signext %7)
store i8 %8, i8* %6
%9 = add nuw nsw i64 %5, 1
%10 = tail call i32 @strlen(i8* %0)
%11 = sext i32 %10 to i64
%12 = icmp slt i64 %9, %11
br i1 %12, label %4, label %13
13: ; preds = %4, %1
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ f3();
int /*<<< orphan*/ f4();
int /*<<< orphan*/ pf1();
int /*<<< orphan*/ pf2();
int /*<<< orphan*/ pf3();
int /*<<< orphan*/ pf4();
int main(void) {
  f3();
  f4();
  pf1();
  pf2();
  pf3();
  pf4();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <f3@plt>
mov    $0x0,%al
call   1080 <f4@plt>
mov    $0x0,%al
call   1030 <pf1@plt>
mov    $0x0,%al
call   1070 <pf2@plt>
mov    $0x0,%al
call   1040 <pf3@plt>
mov    $0x0,%al
call   1060 <pf4@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <f3@plt>
xor    %eax,%eax
call   1080 <f4@plt>
xor    %eax,%eax
call   1030 <pf1@plt>
xor    %eax,%eax
call   1070 <pf2@plt>
xor    %eax,%eax
call   1040 <pf3@plt>
xor    %eax,%eax
call   1060 <pf4@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @f3()
%3 = call i32 (...) @f4()
%4 = call i32 (...) @pf1()
%5 = call i32 (...) @pf2()
%6 = call i32 (...) @pf3()
%7 = call i32 (...) @pf4()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @f3()
%2 = tail call i32 (...) @f4()
%3 = tail call i32 (...) @pf1()
%4 = tail call i32 (...) @pf2()
%5 = tail call i32 (...) @pf3()
%6 = tail call i32 (...) @pf4()
ret i32 0
}
void print_mem(char *mem, int len) {}


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

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

LLVM IR (-O0):
define void @print_mem(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @print_mem(i8* nocapture %0, i32 %1) {
ret void
}
int test_imm_17uint8_mem(unsigned char *val) {
  return ((*val) & (0x17 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_17uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 23
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ enter_critical(int);
int /*<<< orphan*/ exit_critical(int);
void increase(int thread, int iterations, volatile int *data) {
  for (int i = 0; i < iterations; i++) {
    int a;
    enter_critical(thread);
    a = *data;
    a++;
    *data = a;
    exit_critical(thread);
  }
}


x86 assembly (clang, -O0):
<increase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    117e <increase+0x5e>
mov    -0x4(%rbp),%edi
call   1030 <enter_critical@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%edi
call   1040 <exit_critical@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <increase+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<increase>:
push   %rbp
push   %r14
push   %rbx
test   %esi,%esi
jle    1147 <increase+0x27>
mov    %rdx,%r14
mov    %esi,%ebp
mov    %edi,%ebx
nop
mov    %ebx,%edi
call   1030 <enter_critical@plt>
addl   $0x1,(%r14)
mov    %ebx,%edi
call   1040 <exit_critical@plt>
add    $0xffffffff,%ebp
jne    1130 <increase+0x10>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @increase(i32 %0, i32 %1, i32* %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %6, label %5
5: ; preds = %6, %3
ret void
6: ; preds = %3, %6
%7 = phi i32 [ %12, %6 ], [ 0, %3 ]
%8 = tail call i32 @enter_critical(i32 %0)
%9 = load volatile i32, i32* %2
%10 = add nsw i32 %9, 1
store volatile i32 %10, i32* %2
%11 = tail call i32 @exit_critical(i32 %0)
%12 = add nuw nsw i32 %7, 1
%13 = icmp eq i32 %12, %1
br i1 %13, label %5, label %6
}
void XtOwnSelection() {}


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

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

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

LLVM IR (-O2):
define void @XtOwnSelection() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
double squareRoot(double);
int main(void) {
  printf("squareRoot (2.0) = %f\n", squareRoot(2.0));
  printf("squareRoot (144.0) = %f\n", squareRoot(144.0));
  printf("squareRoot (17.5) = %f\n", squareRoot(17.5));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed9(%rip),%xmm0
call   1040 <squareRoot@plt>
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
movsd  0xeb8(%rip),%xmm0
call   1040 <squareRoot@plt>
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
movsd  0xe97(%rip),%xmm0
call   1040 <squareRoot@plt>
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movsd  0xed7(%rip),%xmm0
call   1040 <squareRoot@plt>
lea    0xee3(%rip),%rdi
call   1030 <printf@plt>
movsd  0xec6(%rip),%xmm0
call   1040 <squareRoot@plt>
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
movsd  0xeb5(%rip),%xmm0
call   1040 <squareRoot@plt>
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"squareRoot (2.0) = %f\0A\00"
@.str.1 = [25 x i8] c"squareRoot (144.0) = %f\0A\00"
@.str.2 = [24 x i8] c"squareRoot (17.5) = %f\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call double @squareRoot(double 2.000000e+00)
%3 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), double %2)
%4 = call double @squareRoot(double 1.440000e+02)
%5 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), double %4)
%6 = call double @squareRoot(double 1.750000e+01)
%7 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), double %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"squareRoot (2.0) = %f\0A\00"
@.str.1 = [25 x i8] c"squareRoot (144.0) = %f\0A\00"
@.str.2 = [24 x i8] c"squareRoot (17.5) = %f\0A\00"
define i32 @main() {
%1 = tail call double @squareRoot(double 2.000000e+00)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), double %1)
%3 = tail call double @squareRoot(double 1.440000e+02)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), double %3)
%5 = tail call double @squareRoot(double 1.750000e+01)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), double %5)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *_ssl_fopen(int, int);
FILE *ssl_client_fopen(int sd) {
  while (0) {
  };
  return _ssl_fopen(sd, 1);
}


x86 assembly (clang, -O0):
<ssl_client_fopen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
test   $0x1,%al
jne    112a <ssl_client_fopen+0x1a>
jmp    112f <ssl_client_fopen+0x1f>
jmp    111b <ssl_client_fopen+0xb>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <_ssl_fopen@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssl_client_fopen>:
mov    $0x1,%esi
jmp    1030 <_ssl_fopen@plt>

LLVM IR (-O0):
define i32* @ssl_client_fopen(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %4, %1
br i1 false, label %4, label %5
4: ; preds = %3
br label %3
5: ; preds = %3
%6 = load i32, i32* %2
%7 = call i32* @_ssl_fopen(i32 %6, i32 1)
ret i32* %7
}

LLVM IR (-O2):
define i32* @ssl_client_fopen(i32 %0) {
%2 = tail call i32* @_ssl_fopen(i32 %0, i32 1)
ret i32* %2
}
int test_imm_BEuint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0xBE << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_BEuint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 16
%6 = and i64 %5, 190
%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_BEuint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 12451840
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void do_body(void) {}


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

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

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

LLVM IR (-O2):
define void @do_body() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ score();
void normend(void) {
  score();
  exit(1);
}


x86 assembly (clang, -O0):
<normend>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <score@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<normend>:
push   %rax
xor    %eax,%eax
call   1030 <score@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @normend() {
%1 = call i32 (...) @score()
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @normend() {
%1 = tail call i32 (...) @score()
%2 = tail call i32 @exit(i32 1)
unreachable
}
long mod(long x, long y) {
  if (x < 0) {
    x += y * ((-x / y) + 1);
  }
  return x % y;
}


x86 assembly (clang, -O0):
<mod>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    1142 <mod+0x42>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
sub    -0x8(%rbp),%rax
cqto
idivq  -0x10(%rbp)
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
add    $0x1,%rcx
imul   %rcx,%rax
add    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cqto
idivq  -0x10(%rbp)
mov    %rdx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mod>:
test   %rdi,%rdi
jns    1130 <mod+0x30>
mov    %rdi,%rax
or     %rsi,%rax
shr    $0x20,%rax
je     111b <mod+0x1b>
mov    %rdi,%rax
cqto
idiv   %rsi
jmp    1121 <mod+0x21>
mov    %edi,%eax
xor    %edx,%edx
div    %esi
mov    $0x1,%ecx
sub    %rax,%rcx
imul   %rsi,%rcx
add    %rcx,%rdi
mov    %rdi,%rax
or     %rsi,%rax
shr    $0x20,%rax
je     1148 <mod+0x48>
mov    %rdi,%rax
cqto
idiv   %rsi
mov    %rdx,%rax
ret
mov    %edi,%eax
xor    %edx,%edx
div    %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i64 @mod(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %2
%8 = load i64, i64* %4
%9 = load i64, i64* %3
%10 = sub nsw i64 0, %9
%11 = load i64, i64* %4
%12 = sdiv i64 %10, %11
%13 = add nsw i64 %12, 1
%14 = mul nsw i64 %8, %13
%15 = load i64, i64* %3
%16 = add nsw i64 %15, %14
store i64 %16, i64* %3
br label %17
17: ; preds = %7, %2
%18 = load i64, i64* %3
%19 = load i64, i64* %4
%20 = srem i64 %18, %19
ret i64 %20
}

LLVM IR (-O2):
define i64 @mod(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, 0
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = sdiv i64 %0, %1
%6 = sub i64 1, %5
%7 = mul nsw i64 %6, %1
%8 = add nsw i64 %7, %0
br label %9
9: ; preds = %4, %2
%10 = phi i64 [ %8, %4 ], [ %0, %2 ]
%11 = srem i64 %10, %1
ret i64 %11
}