xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ qtMain(int, char **, char const *);
__attribute__((visibility("default"))) int CSharp_qtMain(int jarg1, void *jarg2,
                                                         char *jarg3) {
  int jresult;
  int arg1;
  char **arg2 = (char **)0;
  char *arg3 = (char *)0;
  int result;
  arg1 = (int)jarg1;
  arg2 = (char **)jarg2;
  arg3 = (char *)jarg3;
  result = (int)qtMain(arg1, arg2, (char const *)arg3);
  jresult = result;
  return jresult;
}


x86 assembly (clang, -O0):
<CSharp_qtMain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1030 <qtMain@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CSharp_qtMain>:
jmp    1030 <qtMain@plt>

LLVM IR (-O0):
define i32 @CSharp_qtMain(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8**
%10 = alloca i8*
%11 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
store i8** null, i8*** %9
store i8* null, i8** %10
%12 = load i32, i32* %4
store i32 %12, i32* %8
%13 = load i8*, i8** %5
%14 = bitcast i8* %13 to i8**
store i8** %14, i8*** %9
%15 = load i8*, i8** %6
store i8* %15, i8** %10
%16 = load i32, i32* %8
%17 = load i8**, i8*** %9
%18 = load i8*, i8** %10
%19 = call i64 @qtMain(i32 %16, i8** %17, i8* %18)
%20 = trunc i64 %19 to i32
store i32 %20, i32* %11
%21 = load i32, i32* %11
store i32 %21, i32* %7
%22 = load i32, i32* %7
ret i32 %22
}

LLVM IR (-O2):
define i32 @CSharp_qtMain(i32 %0, i8* %1, i8* %2) {
%4 = bitcast i8* %1 to i8**
%5 = tail call i64 @qtMain(i32 %0, i8** %4, i8* %2)
%6 = trunc i64 %5 to i32
ret i32 %6
}
int initNotify(const char *appName) {
  appName = appName;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @initNotify(i8* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
int S_ISDIR(int /*<<< orphan*/);
scalar_t__ stat(char const *, struct stat *);
int is_directory(const char *path) {
  struct stat info;
  if (stat(path, &info) != 0)
    return 0;
  return S_ISDIR(info.st_mode);
}


x86 assembly (clang, -O0):
<is_directory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0x0,%rax
je     114f <is_directory+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    115a <is_directory+0x3a>
mov    -0x18(%rbp),%edi
call   1030 <S_ISDIR@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_directory>:
push   %rax
mov    %rsp,%rsi
call   1040 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1135 <is_directory+0x15>
pop    %rcx
ret
mov    (%rsp),%edi
call   1030 <S_ISDIR@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @is_directory(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = call i32 @S_ISDIR(i32 %8)
br label %10
10: ; preds = %1, %6
%11 = phi i32 [ %9, %6 ], [ 0, %1 ]
ret i32 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
char *csv_get_field_string(char *, int);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ sscanf(char const *, char *, int /*<<< orphan*/ *);
char *strdup(char const *);
int32_t csv_get_field_int32(const char *line, int num) {
  int32_t result;
  char *tmp_str = strdup(line);
  const char *field = csv_get_field_string(tmp_str, num);
  sscanf(field, "%d", &result);
  free(tmp_str);
  return result;
}


x86 assembly (clang, -O0):
<csv_get_field_int32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <strdup@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <csv_get_field_string@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe89(%rip),%rsi
lea    -0x10(%rbp),%rdx
call   1040 <sscanf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csv_get_field_int32>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
call   1060 <strdup@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %ebp,%esi
call   1050 <csv_get_field_string@plt>
lea    0xea2(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rax,%rdi
call   1040 <sscanf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x4(%rsp),%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @csv_get_field_int32(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%8 = load i8*, i8** %3
%9 = call i8* @strdup(i8* %8)
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = load i32, i32* %4
%12 = call i8* @csv_get_field_string(i8* %10, i32 %11)
store i8* %12, i8** %7
%13 = load i8*, i8** %7
%14 = call i32 @sscanf(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%15 = load i8*, i8** %6
%16 = call i32 @free(i8* %15)
%17 = load i32, i32* %5
ret i32 %17
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @csv_get_field_int32(i8* nocapture %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i8* @strdup(i8* %0)
%6 = tail call i8* @csv_get_field_string(i8* %5, i32 %1)
%7 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = call i32 @free(i8* %5)
%9 = load i32, i32* %3
ret i32 %9
}
int mini(int a, int b) { return (a < b) ? a : b; }


x86 assembly (clang, -O0):
<mini>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1121 <mini+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <mini+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @mini(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
void bitmap_toggle_bit(unsigned long *bitmap, unsigned int bit) {
  bitmap[((bit) / (sizeof(long) * 8))] ^=
      (0x1ul << ((bit) % (sizeof(long) * 8)));
}


x86 assembly (clang, -O0):
<bitmap_toggle_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
and    $0x3f,%rcx
mov    $0x1,%edx
shl    %cl,%rdx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shr    $0x6,%rcx
xor    (%rax,%rcx,8),%rdx
mov    %rdx,(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitmap_toggle_bit>:
mov    %esi,%ecx
mov    %esi,%eax
shr    $0x3,%eax
mov    $0x1,%edx
shl    %cl,%rdx
and    $0xfffffff8,%eax
xor    %rdx,(%rdi,%rax,1)
ret

LLVM IR (-O0):
define void @bitmap_toggle_bit(i64* %0, i32 %1) {
%3 = alloca i64*
%4 = alloca i32
store i64* %0, i64** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = zext i32 %5 to i64
%7 = urem i64 %6, 64
%8 = shl i64 1, %7
%9 = load i64*, i64** %3
%10 = load i32, i32* %4
%11 = zext i32 %10 to i64
%12 = udiv i64 %11, 64
%13 = getelementptr inbounds i64, i64* %9, i64 %12
%14 = load i64, i64* %13
%15 = xor i64 %14, %8
store i64 %15, i64* %13
ret void
}

LLVM IR (-O2):
define void @bitmap_toggle_bit(i64* nocapture %0, i32 %1) {
%3 = zext i32 %1 to i64
%4 = and i64 %3, 63
%5 = shl nuw i64 1, %4
%6 = lshr i64 %3, 6
%7 = getelementptr inbounds i64, i64* %0, i64 %6
%8 = load i64, i64* %7
%9 = xor i64 %8, %5
store i64 %9, i64* %7
ret void
}
OP(ed, c9) { illegal_2(); }


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

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @illegal_2()
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ compareOvf(int, int);
int /*<<< orphan*/ divideNeg(int, int);
int /*<<< orphan*/ divideOvf(int, int);
int /*<<< orphan*/ subtractOvf(int, int);
int main() {
  int b21 = 1 << 21;
  compareOvf(b21, b21);
  divideOvf(b21 + 1, b21 + 2);
  divideNeg(b21 + 1, b21 + 2);
  subtractOvf(b21 + 1, b21 + 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x200000,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <compareOvf@plt>
mov    -0x8(%rbp),%edi
add    $0x1,%edi
mov    -0x8(%rbp),%esi
add    $0x2,%esi
call   1040 <divideOvf@plt>
mov    -0x8(%rbp),%edi
add    $0x1,%edi
mov    -0x8(%rbp),%esi
add    $0x2,%esi
call   1060 <divideNeg@plt>
mov    -0x8(%rbp),%edi
add    $0x1,%edi
mov    -0x8(%rbp),%esi
add    $0x2,%esi
call   1050 <subtractOvf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x200000,%edi
mov    $0x200000,%esi
call   1030 <compareOvf@plt>
mov    $0x200001,%edi
mov    $0x200002,%esi
call   1040 <divideOvf@plt>
mov    $0x200001,%edi
mov    $0x200002,%esi
call   1060 <divideNeg@plt>
mov    $0x200001,%edi
mov    $0x200002,%esi
call   1050 <subtractOvf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 2097152, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @compareOvf(i32 %3, i32 %4)
%6 = load i32, i32* %2
%7 = add nsw i32 %6, 1
%8 = load i32, i32* %2
%9 = add nsw i32 %8, 2
%10 = call i32 @divideOvf(i32 %7, i32 %9)
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 2
%15 = call i32 @divideNeg(i32 %12, i32 %14)
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 2
%20 = call i32 @subtractOvf(i32 %17, i32 %19)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @compareOvf(i32 2097152, i32 2097152)
%2 = tail call i32 @divideOvf(i32 2097153, i32 2097154)
%3 = tail call i32 @divideNeg(i32 2097153, i32 2097154)
%4 = tail call i32 @subtractOvf(i32 2097153, i32 2097154)
ret i32 0
}
char const *pubnub_uname(void) {
  return "OpenSSL"
         "%2F"
         "3.1.0";
}


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"OpenSSL%2F3.1.0\00"
define i8* @pubnub_uname() {
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [16 x i8] c"OpenSSL%2F3.1.0\00"
define i8* @pubnub_uname() {
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ pios_uart_puts(char const *);
void printString(const char *a) { pios_uart_puts(a); }


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

x86 assembly (clang, -O2):
<printString>:
jmp    1030 <pios_uart_puts@plt>

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

LLVM IR (-O2):
define void @printString(i8* %0) {
%2 = tail call i32 @pios_uart_puts(i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char const *);
void serialsave(const char *snfilename, unsigned char *serialnumber) {
  FILE *fsn;
  printf("save to %s\n", snfilename);
  fsn = fopen(snfilename, "wb+");
  fwrite(serialnumber, sizeof(unsigned char), 64, fsn);
  fclose(fsn);
}


x86 assembly (clang, -O0):
<serialsave>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xea1(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x40,%edx
call   1060 <fwrite@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serialsave>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xeaf(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
lea    0xeac(%rip),%rsi
mov    %rbx,%rdi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x40,%edx
mov    %rax,%rcx
call   1060 <fwrite@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"save to %s\0A\00"
@.str.1 = [4 x i8] c"wb+\00"
define void @serialsave(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i8*, i8** %3
%9 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32* %9, i32** %5
%10 = load i8*, i8** %4
%11 = load i32*, i32** %5
%12 = call i32 @fwrite(i8* %10, i32 1, i32 64, i32* %11)
%13 = load i32*, i32** %5
%14 = call i32 @fclose(i32* %13)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"save to %s\0A\00"
@.str.1 = [4 x i8] c"wb+\00"
define void @serialsave(i8* %0, i8* nocapture %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @fwrite(i8* %1, i32 1, i32 64, i32* %4)
%6 = tail call i32 @fclose(i32* %4)
ret void
}
/* Variables and functions */
int create_server(char const *, int const, int, int const);
int create_server_udp(const char *port, const int family, const int flags) {
  return create_server(port, family, 0x02, flags);
}


x86 assembly (clang, -O0):
<create_server_udp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%ecx
mov    $0x2,%edx
call   1030 <create_server@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_server_udp>:
mov    %edx,%ecx
mov    $0x2,%edx
jmp    1030 <create_server@plt>

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

LLVM IR (-O2):
define i32 @create_server_udp(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @create_server(i8* %0, i32 %1, i32 2, i32 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Welcom to C!\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"Welcom to C!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [13 x i8] c"Welcom to C!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int strcmp(char const *, char const *);
int compare_ext(const void *a, const void *b) {
  const char **exta = (const char **)a;
  const char **extb = (const char **)b;
  return strcmp(*exta, *extb);
}


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

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

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

LLVM IR (-O2):
define i32 @compare_ext(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = bitcast i8* %1 to i8**
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %5, i8* dereferenceable(1) %6)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ disable_servo(int);
int /*<<< orphan*/ enable_servo(int);
int /*<<< orphan*/ set_servo_position(int, int);
void closeGate(int servo) {
  enable_servo(servo);
  if (servo == 2) {
    set_servo_position(servo, 300);
  } else if (servo == 0) {
    set_servo_position(servo, 1250);
  }
  disable_servo(servo);
}


x86 assembly (clang, -O0):
<closeGate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <enable_servo@plt>
cmpl   $0x2,-0x4(%rbp)
jne    115f <closeGate+0x2f>
mov    -0x4(%rbp),%edi
mov    $0x12c,%esi
call   1050 <set_servo_position@plt>
jmp    117b <closeGate+0x4b>
cmpl   $0x0,-0x4(%rbp)
jne    1176 <closeGate+0x46>
mov    -0x4(%rbp),%edi
mov    $0x4e2,%esi
call   1050 <set_servo_position@plt>
jmp    117b <closeGate+0x4b>
mov    -0x4(%rbp),%edi
call   1040 <disable_servo@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<closeGate>:
push   %rbx
mov    %edi,%ebx
call   1030 <enable_servo@plt>
test   %ebx,%ebx
je     114d <closeGate+0x1d>
cmp    $0x2,%ebx
jne    1159 <closeGate+0x29>
mov    $0x2,%edi
mov    $0x12c,%esi
jmp    1154 <closeGate+0x24>
xor    %edi,%edi
mov    $0x4e2,%esi
call   1050 <set_servo_position@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <disable_servo@plt>

LLVM IR (-O0):
define void @closeGate(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @enable_servo(i32 %3)
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 2
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* %2
%9 = call i32 @set_servo_position(i32 %8, i32 300)
br label %17
10: ; preds = %1
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i32, i32* %2
%15 = call i32 @set_servo_position(i32 %14, i32 1250)
br label %16
16: ; preds = %13, %10
br label %17
17: ; preds = %16, %7
%18 = load i32, i32* %2
%19 = call i32 @disable_servo(i32 %18)
ret void
}

LLVM IR (-O2):
define void @closeGate(i32 %0) {
%2 = tail call i32 @enable_servo(i32 %0)
switch i32 %0, label %7 [
i32 2, label %3
i32 0, label %5
]
3: ; preds = %1
%4 = tail call i32 @set_servo_position(i32 2, i32 300)
br label %7
5: ; preds = %1
%6 = tail call i32 @set_servo_position(i32 0, i32 1250)
br label %7
7: ; preds = %1, %5, %3
%8 = tail call i32 @disable_servo(i32 %0)
ret void
}
void view_loadValuesFromFile(void) {}


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

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

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

LLVM IR (-O2):
define void @view_loadValuesFromFile() {
ret void
}
char __attribute__((regparm(1)))
tolowercase_transform(unsigned int c, void *data) {
  if (c >= 'A' && c <= 'Z')
    return c - 'A' + 'a';
  else
    return c;
}


x86 assembly (clang, -O0):
<tolowercase_transform>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x41,-0x8(%rbp)
jb     1130 <tolowercase_transform+0x30>
cmpl   $0x5a,-0x8(%rbp)
ja     1130 <tolowercase_transform+0x30>
mov    -0x8(%rbp),%eax
sub    $0x41,%eax
add    $0x61,%eax
mov    %al,-0x1(%rbp)
jmp    1136 <tolowercase_transform+0x36>
mov    -0x8(%rbp),%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tolowercase_transform>:
lea    -0x41(%rdi),%eax
lea    0x20(%rdi),%ecx
cmp    $0x1a,%eax
movzbl %cl,%eax
cmovae %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @tolowercase_transform(i32 %0, i8* %1) {
%3 = alloca i8
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = load i32, i32* %4
%7 = icmp uge i32 %6, 65
br i1 %7, label %8, label %16
8: ; preds = %2
%9 = load i32, i32* %4
%10 = icmp ule i32 %9, 90
br i1 %10, label %11, label %16
11: ; preds = %8
%12 = load i32, i32* %4
%13 = sub i32 %12, 65
%14 = add i32 %13, 97
%15 = trunc i32 %14 to i8
store i8 %15, i8* %3
br label %19
16: ; preds = %8, %2
%17 = load i32, i32* %4
%18 = trunc i32 %17 to i8
store i8 %18, i8* %3
br label %19
19: ; preds = %16, %11
%20 = load i8, i8* %3
ret i8 %20
}

LLVM IR (-O2):
define signext i8 @tolowercase_transform(i32 %0, i8* nocapture readnone %1) {
%3 = add i32 %0, -65
%4 = icmp ult i32 %3, 26
%5 = add i32 %0, 32
%6 = select i1 %4, i32 %5, i32 %0
%7 = trunc i32 %6 to i8
ret i8 %7
}
/* Variables and functions */
int /*<<< orphan*/ libws_test_HEADLINE(char *);
int test_utf8_overlong();
int test_utf8_valid();
int TEST_ws_utf8_validate(int argc, char **argv) {
  int ret = 0;
  libws_test_HEADLINE("TEST_ws_utf8_validate");
  ret |= test_utf8_overlong();
  ret |= test_utf8_valid();
  return ret;
}


x86 assembly (clang, -O0):
<TEST_ws_utf8_validate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xeb3(%rip),%rdi
call   1040 <libws_test_HEADLINE@plt>
mov    $0x0,%al
call   1050 <test_utf8_overlong@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <test_utf8_valid@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TEST_ws_utf8_validate>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1040 <libws_test_HEADLINE@plt>
xor    %eax,%eax
call   1050 <test_utf8_overlong@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <test_utf8_valid@plt>
or     %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"TEST_ws_utf8_validate\00"
define i32 @TEST_ws_utf8_validate(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 0, i32* %5
%6 = call i32 @libws_test_HEADLINE(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @test_utf8_overlong()
%8 = load i32, i32* %5
%9 = or i32 %8, %7
store i32 %9, i32* %5
%10 = call i32 (...) @test_utf8_valid()
%11 = load i32, i32* %5
%12 = or i32 %11, %10
store i32 %12, i32* %5
%13 = load i32, i32* %5
ret i32 %13
}

LLVM IR (-O2):
@.str = [22 x i8] c"TEST_ws_utf8_validate\00"
define i32 @TEST_ws_utf8_validate(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @libws_test_HEADLINE(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (...) @test_utf8_overlong()
%5 = tail call i32 (...) @test_utf8_valid()
%6 = or i32 %5, %4
ret i32 %6
}
void ___pop_ref(void *arg) { (void)arg; }


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

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

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

LLVM IR (-O2):
define void @___pop_ref(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ delay(int);
int /*<<< orphan*/ mbus_remote_register_write(int, int, int);
void pmu_reset_solar_short() {
  mbus_remote_register_write(
      0x6, 0x0E, ((1 << 10) | (1 << 9) | (0 << 8) | (1 << 4) | (0)));
  delay(100);
  mbus_remote_register_write(
      0x6, 0x0E, ((1 << 10) | (1 << 9) | (0 << 8) | (1 << 4) | (0)));
  delay(100);
  mbus_remote_register_write(
      0x6, 0x0E, ((1 << 10) | (0 << 9) | (0 << 8) | (1 << 4) | (0)));
  delay(100);
}


x86 assembly (clang, -O0):
<pmu_reset_solar_short>:
push   %rbp
mov    %rsp,%rbp
mov    $0x6,%edi
mov    $0xe,%esi
mov    $0x610,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0xe,%esi
mov    $0x610,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0xe,%esi
mov    $0x410,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pmu_reset_solar_short>:
push   %rax
mov    $0x6,%edi
mov    $0xe,%esi
mov    $0x610,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0xe,%esi
mov    $0x610,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0xe,%esi
mov    $0x410,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
pop    %rax
jmp    1030 <delay@plt>

LLVM IR (-O0):
define void @pmu_reset_solar_short() {
%1 = call i32 @mbus_remote_register_write(i32 6, i32 14, i32 1552)
%2 = call i32 @delay(i32 100)
%3 = call i32 @mbus_remote_register_write(i32 6, i32 14, i32 1552)
%4 = call i32 @delay(i32 100)
%5 = call i32 @mbus_remote_register_write(i32 6, i32 14, i32 1040)
%6 = call i32 @delay(i32 100)
ret void
}

LLVM IR (-O2):
define void @pmu_reset_solar_short() {
%1 = tail call i32 @mbus_remote_register_write(i32 6, i32 14, i32 1552)
%2 = tail call i32 @delay(i32 100)
%3 = tail call i32 @mbus_remote_register_write(i32 6, i32 14, i32 1552)
%4 = tail call i32 @delay(i32 100)
%5 = tail call i32 @mbus_remote_register_write(i32 6, i32 14, i32 1040)
%6 = tail call i32 @delay(i32 100)
ret void
}
/* Variables and functions */
int printf(char *, ...);
int main(int argc, char *argv[]) {
  int ret;
  ret = printf("123");
  printf("ret"
         ":%d\n",
         (ret));
  ret = printf("猫");
  printf("ret"
         ":%d\n",
         (ret));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xede(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"123\00"
@.str.1 = [8 x i8] c"ret:%d\0A\00"
@.str.2 = [4 x i8] c"\E7\8C\AB\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 %7, i32* %6
%8 = load i32, i32* %6
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"123\00"
@.str.1 = [8 x i8] c"ret:%d\0A\00"
@.str.2 = [4 x i8] c"\E7\8C\AB\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int const uint32_t;

/* Variables and functions */
uint32_t readnu32(const uint8_t *p) {
  return (p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3]);
}


x86 assembly (clang, -O0):
<readnu32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
shl    $0x18,%eax
mov    -0x8(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
or     0xc(%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<readnu32>:
mov    (%rdi),%eax
mov    0x4(%rdi),%ecx
shl    $0x18,%eax
shl    $0x10,%ecx
or     %eax,%ecx
mov    0x8(%rdi),%eax
shl    $0x8,%eax
or     %ecx,%eax
or     0xc(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @readnu32(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = shl i32 %5, 24
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 1
%9 = load i32, i32* %8
%10 = shl i32 %9, 16
%11 = or i32 %6, %10
%12 = load i32*, i32** %2
%13 = getelementptr inbounds i32, i32* %12, i64 2
%14 = load i32, i32* %13
%15 = shl i32 %14, 8
%16 = or i32 %11, %15
%17 = load i32*, i32** %2
%18 = getelementptr inbounds i32, i32* %17, i64 3
%19 = load i32, i32* %18
%20 = or i32 %16, %19
ret i32 %20
}

LLVM IR (-O2):
define i32 @readnu32(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = shl i32 %2, 24
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = shl i32 %5, 16
%7 = or i32 %6, %3
%8 = getelementptr inbounds i32, i32* %0, i64 2
%9 = load i32, i32* %8
%10 = shl i32 %9, 8
%11 = or i32 %7, %10
%12 = getelementptr inbounds i32, i32* %0, i64 3
%13 = load i32, i32* %12
%14 = or i32 %11, %13
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ munmap(void *, int);
void shared_memory_unmap(int *fd, void **ptr, int size) {
  if (*fd < 0)
    return;
  munmap(*ptr, size);
  *ptr = 0;
  close(*fd);
  *fd = -1;
}


x86 assembly (clang, -O0):
<shared_memory_unmap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
jge    1145 <shared_memory_unmap+0x25>
jmp    1174 <shared_memory_unmap+0x54>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x14(%rbp),%esi
call   1040 <munmap@plt>
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <close@plt>
mov    -0x8(%rbp),%rax
movl   $0xffffffff,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shared_memory_unmap>:
push   %r14
push   %rbx
push   %rax
cmpl   $0x0,(%rdi)
js     114d <shared_memory_unmap+0x2d>
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rsi),%rdi
mov    %edx,%esi
call   1040 <munmap@plt>
movq   $0x0,(%r14)
mov    (%rbx),%edi
call   1030 <close@plt>
movl   $0xffffffff,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @shared_memory_unmap(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 i32, i32* %7
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %3
br label %21
11: ; preds = %3
%12 = load i8**, i8*** %5
%13 = load i8*, i8** %12
%14 = load i32, i32* %6
%15 = call i32 @munmap(i8* %13, i32 %14)
%16 = load i8**, i8*** %5
store i8* null, i8** %16
%17 = load i32*, i32** %4
%18 = load i32, i32* %17
%19 = call i32 @close(i32 %18)
%20 = load i32*, i32** %4
store i32 -1, i32* %20
br label %21
21: ; preds = %11, %10
ret void
}

LLVM IR (-O2):
define void @shared_memory_unmap(i32* nocapture %0, i8** nocapture %1, i32 %2) {
%4 = load i32, i32* %0
%5 = icmp slt i32 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = load i8*, i8** %1
%8 = tail call i32 @munmap(i8* %7, i32 %2)
store i8* null, i8** %1
%9 = load i32, i32* %0
%10 = tail call i32 @close(i32 %9)
store i32 -1, i32* %0
br label %11
11: ; preds = %3, %6
ret void
}
void fun() {
  char *buf = alloca(0x100);
  asm volatile("" ::"m"(buf));
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
lea    -0x110(%rbp),%rax
mov    %rax,-0x8(%rbp)
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
sub    $0x98,%rsp
lea    -0x70(%rsp),%rax
mov    %rax,-0x78(%rsp)
add    $0x98,%rsp
ret

LLVM IR (-O0):
define void @fun() {
%1 = alloca i8*
%2 = alloca i8, i64 256
store i8* %2, i8** %1
ret void
}

LLVM IR (-O2):
define void @fun() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
store i8* %4, i8** %1
ret void
}
void swap(int *p1, int *p2) {
  int tmp = *p1;
  *p1 = *p2;
  *p2 = tmp;
}


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

x86 assembly (clang, -O2):
<swap>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
mov    %ecx,(%rdi)
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
define void @swap(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
store i32 %7, i32* %5
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = load i32*, i32** %3
store i32 %9, i32* %10
%11 = load i32, i32* %5
%12 = load i32*, i32** %4
store i32 %11, i32* %12
ret void
}

LLVM IR (-O2):
define void @swap(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
store i32 %4, i32* %0
store i32 %3, i32* %1
ret void
}
/* Variables and functions */
double fabs(double);
double log(double);
double compute_delta(double q, double k, double mu, double a) {
  return fabs(log(q) - mu * log(k) - log(a));
}


x86 assembly (clang, -O0):
<compute_delta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <log@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <log@plt>
movsd  -0x38(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
subsd  %xmm1,%xmm0
movaps 0xe63(%rip),%xmm1
pand   %xmm1,%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_delta>:
sub    $0x28,%rsp
movsd  %xmm3,0x20(%rsp)
movsd  %xmm2,0x18(%rsp)
movsd  %xmm1,0x10(%rsp)
call   1030 <log@plt>
movaps %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <log@plt>
mulsd  0x18(%rsp),%xmm0
movapd (%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,(%rsp)
movsd  0x20(%rsp),%xmm0
call   1030 <log@plt>
movapd (%rsp),%xmm1
subsd  %xmm0,%xmm1
andpd  0xe96(%rip),%xmm1
movapd %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @compute_delta(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = load double, double* %5
%10 = call double @log(double %9)
%11 = load double, double* %7
%12 = load double, double* %6
%13 = call double @log(double %12)
%14 = fneg double %11
%15 = call double @llvm.fmuladd.f64(double %14, double %13, double %10)
%16 = load double, double* %8
%17 = call double @log(double %16)
%18 = fsub double %15, %17
%19 = call double @llvm.fabs.f64(double %18)
ret double %19
}

LLVM IR (-O2):
define double @compute_delta(double %0, double %1, double %2, double %3) {
%5 = tail call double @log(double %0)
%6 = tail call double @log(double %1)
%7 = fneg double %2
%8 = tail call double @llvm.fmuladd.f64(double %7, double %6, double %5)
%9 = tail call double @log(double %3)
%10 = fsub double %8, %9
%11 = tail call double @llvm.fabs.f64(double %10)
ret double %11
}
char key_2() { return (((*(volatile unsigned long *)0x7F008834) & (1 << 1))); }


x86 assembly (clang, -O0):
<key_2>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7f008834,%eax
mov    (%rax),%rax
and    $0x2,%rax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<key_2>:
mov    0x7f008834,%rax
7f
and    $0x2,%al
ret

LLVM IR (-O0):
define signext i8 @key_2() {
%1 = load volatile i64, i64* inttoptr (i64 2130741300 to i64*)
%2 = and i64 %1, 2
%3 = trunc i64 %2 to i8
ret i8 %3
}

LLVM IR (-O2):
define signext i8 @key_2() {
%1 = load volatile i64, i64* inttoptr (i64 2130741300 to i64*)
%2 = trunc i64 %1 to i8
%3 = and i8 %2, 2
ret i8 %3
}
/* Variables and functions */
scalar_t__ memcmp(char *, char *, int);
int string_eq(char *s, int s_n, char *t, int t_n) {
  return (s_n == t_n) && (memcmp(s, t, s_n) == 0);
}


x86 assembly (clang, -O0):
<string_eq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
cmp    -0x1c(%rbp),%ecx
mov    %al,-0x1d(%rbp)
jne    1151 <string_eq+0x41>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <memcmp@plt>
cmp    $0x0,%rax
sete   %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_eq>:
xor    %eax,%eax
cmp    %ecx,%esi
jne    1134 <string_eq+0x24>
push   %rax
mov    %esi,%r8d
mov    %rdx,%rsi
mov    %r8d,%edx
call   1030 <memcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define i32 @string_eq(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = icmp eq i32 %1, %3
br i1 %5, label %6, label %10
6: ; preds = %4
%7 = tail call i64 @memcmp(i8* %0, i8* %2, i32 %1)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %4
%11 = phi i32 [ 0, %4 ], [ %9, %6 ]
ret i32 %11
}
void suppress_uninitialized(void *a) {}


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

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

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

LLVM IR (-O2):
define void @suppress_uninitialized(i8* nocapture %0) {
ret void
}
/* Variables and functions */
bool no_permutate(void) { return false; }


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

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

LLVM IR (-O0):
define i32 @no_permutate() {
ret i32 0
}

LLVM IR (-O2):
define i32 @no_permutate() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ubitmap_get_octets_len(size_t);
void *ucalloc(int /*<<< orphan*/, int);
void *ubitmap_allocate(size_t len) {
  return ucalloc(ubitmap_get_octets_len(len), 1);
}


x86 assembly (clang, -O0):
<ubitmap_allocate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <ubitmap_get_octets_len@plt>
mov    %eax,%edi
mov    $0x1,%esi
call   1030 <ucalloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ubitmap_allocate>:
push   %rax
call   1040 <ubitmap_get_octets_len@plt>
mov    %eax,%edi
mov    $0x1,%esi
pop    %rax
jmp    1030 <ucalloc@plt>

LLVM IR (-O0):
define i8* @ubitmap_allocate(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @ubitmap_get_octets_len(i64 %3)
%5 = call i8* @ucalloc(i32 %4, i32 1)
ret i8* %5
}

LLVM IR (-O2):
define i8* @ubitmap_allocate(i64 %0) {
%2 = tail call i32 @ubitmap_get_octets_len(i64 %0)
%3 = tail call i8* @ucalloc(i32 %2, i32 1)
ret i8* %3
}
void rest_register_handlers(void) {}


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

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

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

LLVM IR (-O2):
define void @rest_register_handlers() {
ret void
}
/* Variables and functions */
int atoi(char *);
char *pipe2string(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int get_word_count(char *filename) {
  char sys_string[1024];
  char *results;
  sprintf(sys_string, "wc -l %s", filename);
  results = pipe2string(sys_string);
  return atoi(results);
}


x86 assembly (clang, -O0):
<get_word_count>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xeaf(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x410(%rbp),%rdi
call   1030 <pipe2string@plt>
mov    %rax,-0x418(%rbp)
mov    -0x418(%rbp),%rdi
call   1040 <atoi@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_word_count>:
push   %rbx
sub    $0x400,%rsp
mov    %rdi,%rdx
lea    0xebe(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <pipe2string@plt>
mov    %rax,%rdi
call   1040 <atoi@plt>
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"wc -l %s\00"
define i32 @get_word_count(i8* %0) {
%2 = alloca i8*
%3 = alloca [1024 x i8]
%4 = alloca i8*
store i8* %0, i8** %2
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = load i8*, i8** %2
%7 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%9 = call i8* @pipe2string(i8* %8)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = call i32 @atoi(i8* %10)
ret i32 %11
}

LLVM IR (-O2):
@.str = [9 x i8] c"wc -l %s\00"
define i32 @get_word_count(i8* %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = call i8* @pipe2string(i8* %3)
%6 = call i32 @atoi(i8* %5)
ret i32 %6
}