xunge/DecIR huggingface dataset:
/* Variables and functions */
int read_mosaic_xgrid_size(char const *);
int read_mosaic_xgrid_size_(const char *xgrid_file) {
  return read_mosaic_xgrid_size(xgrid_file);
}


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

x86 assembly (clang, -O2):
<read_mosaic_xgrid_size_>:
jmp    1030 <read_mosaic_xgrid_size@plt>

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

LLVM IR (-O2):
define i32 @read_mosaic_xgrid_size_(i8* %0) {
%2 = tail call i32 @read_mosaic_xgrid_size(i8* %0)
ret i32 %2
}
/* Variables and functions */
int fork();
int vfork() { return fork(); }


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

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

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

LLVM IR (-O2):
define i32 @vfork() {
%1 = tail call i32 (...) @fork()
ret i32 %1
}
unsigned int determinerNbTourFocusEnnemi(const unsigned int niveauIA) {
  static const unsigned int baseNbTourFocus[3] = {10, 25, 50};
  return baseNbTourFocus[niveauIA];
}


x86 assembly (clang, -O0):
<determinerNbTourFocusEnnemi>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
lea    0xeed(%rip),%rax
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<determinerNbTourFocusEnnemi>:
mov    %edi,%eax
lea    0xef7(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
@determinerNbTourFocusEnnemi.baseNbTourFocus = internal constant [3 x i32] [i32 10, i32 25, i32 50]
define i32 @determinerNbTourFocusEnnemi(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds [3 x i32], [3 x i32]* @determinerNbTourFocusEnnemi.baseNbTourFocus, i64 0, i64 %4
%6 = load i32, i32* %5
ret i32 %6
}

LLVM IR (-O2):
@determinerNbTourFocusEnnemi.baseNbTourFocus = internal unnamed_addr constant [3 x i32] [i32 10, i32 25, i32 50]
define i32 @determinerNbTourFocusEnnemi(i32 %0) {
%2 = zext i32 %0 to i64
%3 = getelementptr inbounds [3 x i32], [3 x i32]* @determinerNbTourFocusEnnemi.baseNbTourFocus, i64 0, i64 %2
%4 = load i32, i32* %3
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char const *, char *);
int readKV(int /*<<< orphan*/ *, char const *, char *);
int config_readKV(const char *configfile, const char *key, char *value) {
  FILE *file = fopen(configfile, "r");
  if (file == NULL) {
    return -1;
  }
  return readKV(file, key, value);
}


x86 assembly (clang, -O0):
<config_readKV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec1(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    115f <config_readKV+0x3f>
movl   $0xffffffff,-0x4(%rbp)
jmp    1173 <config_readKV+0x53>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <readKV@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_readKV>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
lea    0xecf(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     1150 <config_readKV+0x30>
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <readKV@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32 @config_readKV(i8* nocapture %0, i8* %1, i8* %2) {
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @readKV(i32* %4, i8* %1, i8* %2)
br label %8
8: ; preds = %3, %6
%9 = phi i32 [ %7, %6 ], [ -1, %3 ]
ret i32 %9
}
/* Type definitions */
struct Cyc_List_List {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ Cyc_List_length(struct Cyc_List_List *);
int Cyc_Toc_should_insert_xeffect(struct Cyc_List_List *in,
                                  struct Cyc_List_List *out) {
  return in != 0 && ({ Cyc_List_length(in); }) > 1;
}


x86 assembly (clang, -O0):
<Cyc_Toc_should_insert_xeffect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x15(%rbp)
je     1146 <Cyc_Toc_should_insert_xeffect+0x36>
mov    -0x8(%rbp),%rdi
call   1030 <Cyc_List_length@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
setg   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cyc_Toc_should_insert_xeffect>:
test   %rdi,%rdi
je     112a <Cyc_Toc_should_insert_xeffect+0x1a>
push   %rax
call   1030 <Cyc_List_length@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x2,%ecx
setge  %al
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.Cyc_List_List = type { i32 }
define i32 @Cyc_Toc_should_insert_xeffect(%struct.Cyc_List_List* %0, %struct.Cyc_List_List* %1) {
%3 = alloca %struct.Cyc_List_List*
%4 = alloca %struct.Cyc_List_List*
%5 = alloca i32
store %struct.Cyc_List_List* %0, %struct.Cyc_List_List** %3
store %struct.Cyc_List_List* %1, %struct.Cyc_List_List** %4
%6 = load %struct.Cyc_List_List*, %struct.Cyc_List_List** %3
%7 = icmp ne %struct.Cyc_List_List* %6, null
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load %struct.Cyc_List_List*, %struct.Cyc_List_List** %3
%10 = call i32 @Cyc_List_length(%struct.Cyc_List_List* %9)
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = icmp sgt i32 %11, 1
br label %13
13: ; preds = %8, %2
%14 = phi i1 [ false, %2 ], [ %12, %8 ]
%15 = zext i1 %14 to i32
ret i32 %15
}

LLVM IR (-O2):
%struct.Cyc_List_List = type { i32 }
define i32 @Cyc_Toc_should_insert_xeffect(%struct.Cyc_List_List* %0, %struct.Cyc_List_List* nocapture readnone %1) {
%3 = icmp eq %struct.Cyc_List_List* %0, null
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = tail call i32 @Cyc_List_length(%struct.Cyc_List_List* %0)
%6 = icmp sgt i32 %5, 1
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %2
%9 = phi i32 [ 0, %2 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_bytes_to_usec_round_up() {
  printf("NOT IMPLEMENTED:"
         "pa_bytes_to_usec_round_up"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [43 x i8] c"NOT IMPLEMENTED:pa_bytes_to_usec_round_up\0A\00"
define i32 @pa_bytes_to_usec_round_up() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [42 x i8] c"NOT IMPLEMENTED:pa_bytes_to_usec_round_up\00"
define i32 @pa_bytes_to_usec_round_up() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ test_init(int, char **);
int /*<<< orphan*/ test_msg(char *, char *, int);
int main(int argc, char **argv) {
  test_init(argc, argv);
  test_msg("SKIP: %s:%d: "
           "Inotify not supported."
           "\n",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/KKoukiou/criu-remote/refs/heads/master/"
           "test/zdtm/static/inotify_system_nodel.c",
           388);
  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    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <test_init@plt>
lea    0xeb7(%rip),%rdi
lea    0xed5(%rip),%rsi
mov    $0x184,%edx
call   1040 <test_msg@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1030 <test_init@plt>
lea    0xed3(%rip),%rdi
lea    0xef1(%rip),%rsi
mov    $0x184,%edx
call   1040 <test_msg@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"SKIP: %s:%d: Inotify not supported.\0A\00"
@.str.1 = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/KKoukiou/criu-remote/refs/heads/master/test/zdtm/static/inotify_system_nodel.c\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @test_init(i32 %6, i8** %7)
%9 = call i32 @test_msg(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str.1, i64 0, i64 0), i32 388)
ret i32 0
}

LLVM IR (-O2):
@.str = [37 x i8] c"SKIP: %s:%d: Inotify not supported.\0A\00"
@.str.1 = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/KKoukiou/criu-remote/refs/heads/master/test/zdtm/static/inotify_system_nodel.c\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @test_init(i32 %0, i8** %1)
%4 = tail call i32 @test_msg(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str.1, i64 0, i64 0), i32 388)
ret i32 0
}
void debug_same_page(struct http_sig *sig1, struct http_sig *sig2) {}


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

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

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

LLVM IR (-O2):
%struct.http_sig = type opaque
define void @debug_same_page(%struct.http_sig* nocapture %0, %struct.http_sig* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __fpurge(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
int num_reader() {
  int number;
  printf("Choose one: ");
  __fpurge(stdin);
  scanf("%d", &number);
  return number;
}


x86 assembly (clang, -O0):
<num_reader>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
call   1030 <__fpurge@plt>
lea    0xeb4(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<num_reader>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
call   1030 <__fpurge@plt>
lea    0xebb(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Choose one: \00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%d\00"
define i32 @num_reader() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdin
%4 = call i32 @__fpurge(i32 %3)
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
ret i32 %6
}

LLVM IR (-O2):
@.str = [13 x i8] c"Choose one: \00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%d\00"
define i32 @num_reader() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stdin
%5 = tail call i32 @__fpurge(i32 %4)
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
ret i32 %7
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
void USBHostRequestINClear(uint32_t ui32Base, uint32_t ui32Endpoint) {
  uint32_t ui32Register;
  ;

  ;
  if (ui32Endpoint == 0x00000000) {
    ui32Register = 0x00000102;
  } else {
    ui32Register = 0x00000116 + (ui32Endpoint - 0x10);
  }
  (*((volatile uint8_t *)(ui32Base + ui32Register))) &= ~0x00000020;
}


x86 assembly (clang, -O0):
<USBHostRequestINClear>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1120 <USBHostRequestINClear+0x20>
movl   $0x102,-0xc(%rbp)
jmp    112e <USBHostRequestINClear+0x2e>
mov    -0x8(%rbp),%eax
sub    $0x10,%eax
add    $0x116,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    -0xc(%rbp),%eax
cltq
mov    (%rax),%ecx
and    $0xffffffdf,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBHostRequestINClear>:
lea    0x106(%rsi),%eax
test   %esi,%esi
mov    $0x102,%ecx
cmovne %eax,%ecx
movslq %ecx,%rax
movslq %edi,%rcx
andl   $0xffffffdf,(%rax,%rcx,1)
ret

LLVM IR (-O0):
define void @USBHostRequestINClear(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* %4
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 258, i32* %5
br label %13
9: ; preds = %2
%10 = load i32, i32* %4
%11 = sub nsw i32 %10, 16
%12 = add nsw i32 278, %11
store i32 %12, i32* %5
br label %13
13: ; preds = %9, %8
%14 = load i32, i32* %3
%15 = load i32, i32* %5
%16 = add nsw i32 %14, %15
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to i32*
%19 = load volatile i32, i32* %18
%20 = and i32 %19, -33
store volatile i32 %20, i32* %18
ret void
}

LLVM IR (-O2):
define void @USBHostRequestINClear(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = add nsw i32 %1, 262
%5 = select i1 %3, i32 258, i32 %4
%6 = add nsw i32 %5, %0
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = load volatile i32, i32* %8
%10 = and i32 %9, -33
store volatile i32 %10, i32* %8
ret void
}
int f(float a) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @f(float %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
void test_sleep() { sleep(1); }


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

x86 assembly (clang, -O2):
<test_sleep>:
mov    $0x1,%edi
jmp    1030 <sleep@plt>

LLVM IR (-O0):
define void @test_sleep() {
%1 = call i32 @sleep(i32 1)
ret void
}

LLVM IR (-O2):
define void @test_sleep() {
%1 = tail call i32 @sleep(i32 1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ pthread_sigmask(int, int /*<<< orphan*/ const *,
                           int /*<<< orphan*/ *);
void xmask(int how, const sigset_t *set, sigset_t *oset) {
  if (pthread_sigmask(how, set, oset) != 0)
    abort();
}


x86 assembly (clang, -O0):
<xmask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <pthread_sigmask@plt>
cmp    $0x0,%rax
je     1154 <xmask+0x34>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmask>:
push   %rax
call   1040 <pthread_sigmask@plt>
test   %rax,%rax
jne    112d <xmask+0xd>
pop    %rax
ret
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define void @xmask(i32 %0, i32* %1, i32* %2) {
%4 = tail call i64 @pthread_sigmask(i32 %0, i32* %1, i32* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %3
ret void
}
/* Variables and functions */
scalar_t__ malloc_via_ptr(int);
void malloc_ptr_leak_bad() { int *p = (int *)malloc_via_ptr(sizeof(int)); }


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

x86 assembly (clang, -O2):
<malloc_ptr_leak_bad>:
mov    $0x4,%edi
jmp    1030 <malloc_via_ptr@plt>

LLVM IR (-O0):
define void @malloc_ptr_leak_bad() {
%1 = alloca i32*
%2 = call i64 @malloc_via_ptr(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32* %3, i32** %1
ret void
}

LLVM IR (-O2):
define void @malloc_ptr_leak_bad() {
%1 = tail call i64 @malloc_via_ptr(i32 4)
ret void
}
void VR_Shutdown(void) { xlogf("%s()\n", __func__); }


x86 assembly (clang, -O0):
<VR_Shutdown>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee4(%rip),%rsi
mov    $0x0,%al
call   1030 <xlogf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<VR_Shutdown>:
lea    0xee9(%rip),%rdi
lea    0xee8(%rip),%rsi
xor    %eax,%eax
jmp    1030 <xlogf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%s()\0A\00"
@__func__.VR_Shutdown = [12 x i8] c"VR_Shutdown\00"
define void @VR_Shutdown() {
%1 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.VR_Shutdown, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s()\0A\00"
@__func__.VR_Shutdown = [12 x i8] c"VR_Shutdown\00"
define void @VR_Shutdown() {
%1 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.VR_Shutdown, i64 0, i64 0))
ret void
}
int is_prime(int a) {
  int divisor;
  for (divisor = 2; divisor <= a - 1; divisor++) {
    if (a % divisor == 0)
      return 0;
  }
  if (divisor == a)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<is_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     114e <is_prime+0x4e>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    113b <is_prime+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    116d <is_prime+0x6d>
jmp    1140 <is_prime+0x40>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <is_prime+0xe>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1166 <is_prime+0x66>
movl   $0x1,-0x4(%rbp)
jmp    116d <is_prime+0x6d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_prime>:
mov    $0x2,%ecx
cmp    $0x3,%edi
jl     1122 <is_prime+0x22>
mov    $0x2,%ecx
nop
mov    %edi,%eax
cltd
idiv   %ecx
test   %edx,%edx
je     112a <is_prime+0x2a>
add    $0x1,%ecx
cmp    %ecx,%edi
jne    1110 <is_prime+0x10>
mov    %edi,%ecx
xor    %eax,%eax
cmp    %edi,%ecx
sete   %al
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @is_prime(i32 %0) {
%2 = icmp sgt i32 %0, 2
br i1 %2, label %3, label %10
3: ; preds = %1, %7
%4 = phi i32 [ %8, %7 ], [ 2, %1 ]
%5 = srem i32 %0, %4
%6 = icmp eq i32 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %3
%8 = add nuw nsw i32 %4, 1
%9 = icmp eq i32 %8, %0
br i1 %9, label %10, label %3
10: ; preds = %7, %1
%11 = phi i32 [ 2, %1 ], [ %0, %7 ]
%12 = icmp eq i32 %11, %0
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %3, %10
%15 = phi i32 [ %13, %10 ], [ 0, %3 ]
ret i32 %15
}
/* Variables and functions */
scalar_t__ bson_find_field(char *, char *, int);
int bson_find_field_as_bool(char *buffer, char *field, unsigned char *data) {
  char *tmp = (char *)bson_find_field(buffer, field, 0x08);
  if (tmp) {
    *data = tmp[0];
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<bson_find_field_as_bool>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x8,%edx
call   1030 <bson_find_field@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     115d <bson_find_field_as_bool+0x4d>
mov    -0x28(%rbp),%rax
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1164 <bson_find_field_as_bool+0x54>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bson_find_field_as_bool>:
push   %rbx
mov    %rdx,%rbx
mov    $0x8,%edx
call   1030 <bson_find_field@plt>
test   %rax,%rax
je     112e <bson_find_field_as_bool+0x1e>
mov    (%rax),%al
mov    %al,(%rbx)
mov    $0x1,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @bson_find_field_as_bool(i8* %0, i8* %1, i8* nocapture writeonly %2) {
%4 = tail call i64 @bson_find_field(i8* %0, i8* %1, i32 8)
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = inttoptr i64 %4 to i8*
%8 = load i8, i8* %7
store i8 %8, i8* %2
br label %9
9: ; preds = %3, %6
%10 = phi i32 [ 1, %6 ], [ 0, %3 ]
ret i32 %10
}
/* Variables and functions */
int reverse(int);
bool isPalindrome(int x) {
  if (x == 0) {
    return true;
  }
  if (x < 0) {
    return false;
  }
  return x == reverse(x);
}


x86 assembly (clang, -O0):
<isPalindrome>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1131 <isPalindrome+0x21>
movl   $0x1,-0x4(%rbp)
jmp    1167 <isPalindrome+0x57>
cmpl   $0x0,-0x8(%rbp)
jge    1147 <isPalindrome+0x37>
movl   $0x0,-0x4(%rbp)
jmp    1167 <isPalindrome+0x57>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <reverse@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPalindrome>:
test   %edi,%edi
je     1129 <isPalindrome+0x19>
js     112f <isPalindrome+0x1f>
push   %rbx
mov    %edi,%ebx
call   1030 <reverse@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ebx,%ecx
sete   %al
pop    %rbx
ret
mov    $0x1,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @isPalindrome(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = icmp slt i32 %0, 0
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = tail call i32 @reverse(i32 %0)
%7 = icmp eq i32 %6, %0
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %3, %1, %5
%10 = phi i32 [ %8, %5 ], [ 1, %1 ], [ 0, %3 ]
ret i32 %10
}
/* Type definitions */
struct input_event {
  int value;
};

/* Variables and functions */
int /*<<< orphan*/ move_back();
int /*<<< orphan*/ move_forward();
int /*<<< orphan*/ stop();
void handle_input_event(struct input_event event) {
  if (event.value == 458833) {
    move_forward();
  } else if (event.value == 458834) {
    move_back();
  } else {
    stop();
  }
}


x86 assembly (clang, -O0):
<handle_input_event>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x70051,-0x8(%rbp)
jne    1154 <handle_input_event+0x24>
mov    $0x0,%al
call   1050 <move_forward@plt>
jmp    1179 <handle_input_event+0x49>
cmpl   $0x70052,-0x8(%rbp)
jne    116d <handle_input_event+0x3d>
mov    $0x0,%al
call   1040 <move_back@plt>
jmp    1174 <handle_input_event+0x44>
mov    $0x0,%al
call   1030 <stop@plt>
jmp    1179 <handle_input_event+0x49>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_input_event>:
xor    %eax,%eax
cmp    $0x70052,%edi
je     1147 <handle_input_event+0x17>
cmp    $0x70051,%edi
jne    114c <handle_input_event+0x1c>
jmp    1050 <move_forward@plt>
jmp    1040 <move_back@plt>
jmp    1030 <stop@plt>

LLVM IR (-O0):
%struct.input_event = type { i32 }
define void @handle_input_event(i32 %0) {
%2 = alloca %struct.input_event
%3 = getelementptr inbounds %struct.input_event, %struct.input_event* %2, i32 0, i32 0
store i32 %0, i32* %3
%4 = getelementptr inbounds %struct.input_event, %struct.input_event* %2, i32 0, i32 0
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 458833
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 (...) @move_forward()
br label %18
9: ; preds = %1
%10 = getelementptr inbounds %struct.input_event, %struct.input_event* %2, i32 0, i32 0
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 458834
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 (...) @move_back()
br label %17
15: ; preds = %9
%16 = call i32 (...) @stop()
br label %17
17: ; preds = %15, %13
br label %18
18: ; preds = %17, %7
ret void
}

LLVM IR (-O2):
define void @handle_input_event(i32 %0) {
switch i32 %0, label %6 [
i32 458833, label %2
i32 458834, label %4
]
2: ; preds = %1
%3 = tail call i32 (...) @move_forward()
br label %8
4: ; preds = %1
%5 = tail call i32 (...) @move_back()
br label %8
6: ; preds = %1
%7 = tail call i32 (...) @stop()
br label %8
8: ; preds = %4, %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  (void)fprintf(stderr, "Usage: otpauth -u user -p password -s socket\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [46 x i8] c"Usage: otpauth -u user -p password -s socket\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [46 x i8] c"Usage: otpauth -u user -p password -s socket\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
#pragma omp parallel
  { printf("Hello from a random thread!\n"); }
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [28 x i8] c"Hello from a random thread!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void SSIAdvModeSet(uint32_t ui32Base, uint32_t ui32Mode) {
  ;

  ;
  (*((volatile uint32_t *)(ui32Base + 0x00000004))) =
      (((*((volatile uint32_t *)(ui32Base + 0x00000004))) &
        ~(0x00000100 | 0x000000C0)) |
       ui32Mode);
}


x86 assembly (clang, -O0):
<SSIAdvModeSet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x4,%eax
cltq
mov    (%rax),%ecx
and    $0xfffffe3f,%ecx
or     -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x4,%eax
cltq
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SSIAdvModeSet>:
movslq %edi,%rax
mov    $0xfffffe3f,%ecx
and    0x4(%rax),%ecx
or     %esi,%ecx
mov    %ecx,0x4(%rax)
ret

LLVM IR (-O0):
define void @SSIAdvModeSet(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 = add nsw i32 %5, 4
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = load volatile i32, i32* %8
%10 = and i32 %9, -449
%11 = load i32, i32* %4
%12 = or i32 %10, %11
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 4
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i32*
store volatile i32 %12, i32* %16
ret void
}

LLVM IR (-O2):
define void @SSIAdvModeSet(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 4
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
%6 = load volatile i32, i32* %5
%7 = and i32 %6, -449
%8 = or i32 %7, %1
store volatile i32 %8, i32* %5
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fgetc(int /*<<< orphan*/ *);
int fileRead32(FILE *fp) {
  unsigned int r = 0;
  r |= fgetc(fp);
  r |= fgetc(fp) << 8;
  r |= fgetc(fp) << 16;
  r |= fgetc(fp) << 24;
  return r;
}


x86 assembly (clang, -O0):
<fileRead32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
shl    $0x8,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
shl    $0x10,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
shl    $0x18,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fileRead32>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
call   1030 <fgetc@plt>
mov    %eax,%r14d
mov    %r15,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebp
shl    $0x8,%ebp
or     %r14d,%ebp
mov    %r15,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebx
shl    $0x10,%ebx
mov    %r15,%rdi
call   1030 <fgetc@plt>
shl    $0x18,%eax
or     %ebx,%eax
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @fileRead32(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
%4 = load i32*, i32** %2
%5 = call i32 @fgetc(i32* %4)
%6 = load i32, i32* %3
%7 = or i32 %6, %5
store i32 %7, i32* %3
%8 = load i32*, i32** %2
%9 = call i32 @fgetc(i32* %8)
%10 = shl i32 %9, 8
%11 = load i32, i32* %3
%12 = or i32 %11, %10
store i32 %12, i32* %3
%13 = load i32*, i32** %2
%14 = call i32 @fgetc(i32* %13)
%15 = shl i32 %14, 16
%16 = load i32, i32* %3
%17 = or i32 %16, %15
store i32 %17, i32* %3
%18 = load i32*, i32** %2
%19 = call i32 @fgetc(i32* %18)
%20 = shl i32 %19, 24
%21 = load i32, i32* %3
%22 = or i32 %21, %20
store i32 %22, i32* %3
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
define i32 @fileRead32(i32* nocapture %0) {
%2 = tail call i32 @fgetc(i32* %0)
%3 = tail call i32 @fgetc(i32* %0)
%4 = shl i32 %3, 8
%5 = or i32 %4, %2
%6 = tail call i32 @fgetc(i32* %0)
%7 = shl i32 %6, 16
%8 = or i32 %5, %7
%9 = tail call i32 @fgetc(i32* %0)
%10 = shl i32 %9, 24
%11 = or i32 %8, %10
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ TimingDelay(int);
void WaitAMillisecond() { TimingDelay(160000); }


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

x86 assembly (clang, -O2):
<WaitAMillisecond>:
mov    $0x27100,%edi
jmp    1030 <TimingDelay@plt>

LLVM IR (-O0):
define void @WaitAMillisecond() {
%1 = call i32 @TimingDelay(i32 160000)
ret void
}

LLVM IR (-O2):
define void @WaitAMillisecond() {
%1 = tail call i32 @TimingDelay(i32 160000)
ret void
}
void incr() {
  static int count = 0;
  count++;
}


x86 assembly (clang, -O0):
<incr>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f1a(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2f11(%rip)
pop    %rbp
ret

x86 assembly (clang, -O2):
<incr>:
addl   $0x1,0x2f1d(%rip)
ret

LLVM IR (-O0):
@incr.count = internal global i32 0
define void @incr() {
%1 = load i32, i32* @incr.count
%2 = add nsw i32 %1, 1
store i32 %2, i32* @incr.count
ret void
}

LLVM IR (-O2):
@incr.count = internal unnamed_addr global i32 0
define void @incr() {
%1 = load i32, i32* @incr.count
%2 = add nsw i32 %1, 1
store i32 %2, i32* @incr.count
ret void
}
void sd_raw_send_byte(unsigned char b) {
  (*(volatile unsigned long *)(0xE0020000 + 0x08)) = b;
  while (!((*(volatile unsigned long *)(0xE0020000 + 0x04)) & 0x80))
    ;
}


x86 assembly (clang, -O0):
<sd_raw_send_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
mov    %eax,%ecx
mov    $0xe0020008,%eax
mov    %rcx,(%rax)
mov    $0xe0020004,%eax
mov    (%rax),%rax
and    $0x80,%rax
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    113c <sd_raw_send_byte+0x3c>
jmp    1141 <sd_raw_send_byte+0x41>
jmp    1118 <sd_raw_send_byte+0x18>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sd_raw_send_byte>:
mov    $0xe0020004,%eax
mov    %edi,%ecx
mov    %rcx,0x4(%rax)
nopl   0x0(%rax,%rax,1)
testq  $0x80,(%rax)
je     1110 <sd_raw_send_byte+0x10>
ret

LLVM IR (-O0):
define void @sd_raw_send_byte(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i64
store volatile i64 %4, i64* inttoptr (i64 3758227464 to i64*)
br label %5
5: ; preds = %10, %1
%6 = load volatile i64, i64* inttoptr (i64 3758227460 to i64*)
%7 = and i64 %6, 128
%8 = icmp ne i64 %7, 0
%9 = xor i1 %8, true
br i1 %9, label %10, label %11
10: ; preds = %5
br label %5
11: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @sd_raw_send_byte(i8 zeroext %0) {
%2 = zext i8 %0 to i64
store volatile i64 %2, i64* inttoptr (i64 3758227464 to i64*)
br label %3
3: ; preds = %3, %1
%4 = load volatile i64, i64* inttoptr (i64 3758227460 to i64*)
%5 = and i64 %4, 128
%6 = icmp eq i64 %5, 0
br i1 %6, label %3, label %7
7: ; preds = %3
ret void
}
/* Variables and functions */
double average(int, double, double, double, ...);
int /*<<< orphan*/ printf(char *, double);
int main(void) {
  printf("%f\n", average(3, 12.2, 22.3, 4.5));
  printf("%f\n", average(5, 3.3, 2.2, 1.1, 5.5, 3.3));
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3,%edi
movsd  0xee4(%rip),%xmm0
movsd  0xee4(%rip),%xmm1
movsd  0xee4(%rip),%xmm2
mov    $0x3,%al
call   1040 <average@plt>
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
mov    $0x5,%edi
movsd  0xe94(%rip),%xmm4
movsd  0xe94(%rip),%xmm1
movsd  0xe94(%rip),%xmm2
movsd  0xe94(%rip),%xmm3
movaps %xmm4,%xmm0
mov    $0x5,%al
call   1040 <average@plt>
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
movsd  0xed7(%rip),%xmm0
movsd  0xed7(%rip),%xmm1
movsd  0xed7(%rip),%xmm2
mov    $0x3,%edi
mov    $0x3,%al
call   1040 <average@plt>
lea    0xeec(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xebc(%rip),%xmm1
movsd  0xebc(%rip),%xmm2
movsd  0xebc(%rip),%xmm3
movsd  0xebc(%rip),%xmm0
mov    $0x5,%edi
movaps %xmm0,%xmm4
mov    $0x5,%al
call   1040 <average@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call double (i32, double, double, double, ...) @average(i32 3, double 1.220000e+01, double 2.230000e+01, double 4.500000e+00)
%3 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %2)
%4 = call double (i32, double, double, double, ...) @average(i32 5, double 3.300000e+00, double 2.200000e+00, double 1.100000e+00, double 5.500000e+00, double 3.300000e+00)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = tail call double (i32, double, double, double, ...) @average(i32 3, double 1.220000e+01, double 2.230000e+01, double 4.500000e+00)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %1)
%3 = tail call double (i32, double, double, double, ...) @average(i32 5, double 3.300000e+00, double 2.200000e+00, double 1.100000e+00, double 5.500000e+00, double 3.300000e+00)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %3)
ret i32 0
}
int return_zero(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @return_zero() {
ret i32 0
}
int enable_rtc_interrupts(void) { return (-1); }


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

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

LLVM IR (-O0):
define i32 @enable_rtc_interrupts() {
ret i32 -1
}

LLVM IR (-O2):
define i32 @enable_rtc_interrupts() {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ assert(unsigned short *);
unsigned int logic_decimal_shift_right(unsigned short to_shift, size_t shift_by,
                                       unsigned short *p_result) {
  assert(p_result);
  unsigned int err_code = 0;
  if (!p_result) {
    err_code = 2;
    goto end;
  }
  *p_result = (to_shift >> shift_by);
end:
  return err_code;
}


x86 assembly (clang, -O0):
<logic_decimal_shift_right>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <assert@plt>
movl   $0x0,-0x1c(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    114e <logic_decimal_shift_right+0x3e>
movl   $0x2,-0x1c(%rbp)
jmp    1162 <logic_decimal_shift_right+0x52>
movzwl -0x2(%rbp),%eax
mov    -0x10(%rbp),%rcx
sar    %cl,%eax
mov    %ax,%cx
mov    -0x18(%rbp),%rax
mov    %cx,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logic_decimal_shift_right>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %edi,%ebp
mov    %rdx,%rdi
call   1030 <assert@plt>
test   %rbx,%rbx
je     1138 <logic_decimal_shift_right+0x28>
movzwl %bp,%eax
mov    %r14d,%ecx
shr    %cl,%eax
mov    %ax,(%rbx)
xor    %eax,%eax
jmp    113d <logic_decimal_shift_right+0x2d>
mov    $0x2,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @logic_decimal_shift_right(i16 zeroext %0, i64 %1, i16* %2) {
%4 = alloca i16
%5 = alloca i64
%6 = alloca i16*
%7 = alloca i32
store i16 %0, i16* %4
store i64 %1, i64* %5
store i16* %2, i16** %6
%8 = load i16*, i16** %6
%9 = call i32 @assert(i16* %8)
store i32 0, i32* %7
%10 = load i16*, i16** %6
%11 = icmp ne i16* %10, null
br i1 %11, label %13, label %12
12: ; preds = %3
store i32 2, i32* %7
br label %21
13: ; preds = %3
%14 = load i16, i16* %4
%15 = zext i16 %14 to i32
%16 = load i64, i64* %5
%17 = trunc i64 %16 to i32
%18 = ashr i32 %15, %17
%19 = trunc i32 %18 to i16
%20 = load i16*, i16** %6
store i16 %19, i16* %20
br label %21
21: ; preds = %13, %12
%22 = load i32, i32* %7
ret i32 %22
}

LLVM IR (-O2):
define i32 @logic_decimal_shift_right(i16 zeroext %0, i64 %1, i16* %2) {
%4 = tail call i32 @assert(i16* %2)
%5 = icmp eq i16* %2, null
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = zext i16 %0 to i32
%8 = trunc i64 %1 to i32
%9 = lshr i32 %7, %8
%10 = trunc i32 %9 to i16
store i16 %10, i16* %2
br label %11
11: ; preds = %3, %6
%12 = phi i32 [ 0, %6 ], [ 2, %3 ]
ret i32 %12
}
int fun198() { return 198; }


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

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

LLVM IR (-O0):
define i32 @fun198() {
ret i32 198
}

LLVM IR (-O2):
define i32 @fun198() {
ret i32 198
}
int _dtable_register(int d) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @_dtable_register(i32 %0) {
ret i32 0
}
setbinary(argc, argv) char *argv[];
{ setmode("octet"); }


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

x86 assembly (clang, -O2):
<setbinary>:
lea    0xee9(%rip),%rdi
xor    %eax,%eax
jmp    1030 <setmode@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"octet\00"
define i32 @setbinary(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @setmode to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
@.str = [6 x i8] c"octet\00"
define i32 @setbinary(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @setmode to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
void bad1(int M, int N, int step, int matrix[M][step]) { matrix[0][N] = 0; }


x86 assembly (clang, -O0):
<bad1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
imul   $0x0,%rcx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x8(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bad1>:
movslq %esi,%rax
movl   $0x0,(%rcx,%rax,4)
ret

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

LLVM IR (-O2):
define void @bad1(i32 %0, i32 %1, i32 %2, i32* nocapture writeonly %3) {
%5 = sext i32 %1 to i64
%6 = getelementptr inbounds i32, i32* %3, i64 %5
store i32 0, i32* %6
ret void
}
long int Inttoint(long int i) { return i; }


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

x86 assembly (clang, -O2):
<Inttoint>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @Inttoint(i64 returned %0) {
ret i64 %0
}
char *strerror(int errorno) { return "Unspecified error"; }


x86 assembly (clang, -O0):
<strerror>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
lea    0xef2(%rip),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [18 x i8] c"Unspecified error\00"
define i8* @strerror(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [18 x i8] c"Unspecified error\00"
define i8* @strerror(i32 %0) {
ret i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0)
}