xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void ADCComparatorIntClear(uint32_t ui32Base, uint32_t ui32Status) {
  ASSERT((ui32Base == 0x40038000) || (ui32Base == 0x40039000));
  (*((volatile uint32_t *)(ui32Base + 0x00000034))) = ui32Status;
}


x86 assembly (clang, -O0):
<ADCComparatorIntClear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x40038000,-0x4(%rbp)
mov    %al,-0x9(%rbp)
je     113d <ADCComparatorIntClear+0x2d>
cmpl   $0x40039000,-0x4(%rbp)
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x34,%eax
cltq
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADCComparatorIntClear>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    %edi,%eax
and    $0xffffefff,%eax
xor    %edi,%edi
cmp    $0x40038000,%eax
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebp,%rax
mov    %ebx,0x34(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @ADCComparatorIntClear(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 = icmp eq i32 %5, 1073971200
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 1073975296
br label %10
10: ; preds = %7, %2
%11 = phi i1 [ true, %2 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
%13 = call i32 @ASSERT(i32 %12)
%14 = load i32, i32* %4
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 52
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to i32*
store volatile i32 %14, i32* %18
ret void
}

LLVM IR (-O2):
define void @ADCComparatorIntClear(i32 %0, i32 %1) {
%3 = and i32 %0, -4097
%4 = icmp eq i32 %3, 1073971200
%5 = zext i1 %4 to i32
%6 = tail call i32 @ASSERT(i32 %5)
%7 = add nsw i32 %0, 52
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
store volatile i32 %1, i32* %9
ret void
}
/* Variables and functions */
int getpid();
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("My pid is %d\n", getpid());
  while (1) {
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
jmp    1144 <main+0x24>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
jmp    1140 <main+0x20>

LLVM IR (-O0):
@.str = [14 x i8] c"My pid is %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @getpid()
%3 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %4
4: ; preds = %0, %4
br label %4
}

LLVM IR (-O2):
@.str = [14 x i8] c"My pid is %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getpid()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %1)
br label %3
3: ; preds = %0, %3
br label %3
}
int verify_benchmark() { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @verify_benchmark() {
ret i32 -1
}
/* Variables and functions */
int mammoth_leaf(int);
int mammoth_func(int arg) {
  int array[65536];
  array[arg] = mammoth_leaf(arg);
  return array[arg];
}


x86 assembly (clang, -O0):
<mammoth_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40010,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <mammoth_leaf@plt>
mov    %eax,%ecx
movslq -0x4(%rbp),%rax
mov    %ecx,-0x40010(%rbp,%rax,4)
movslq -0x4(%rbp),%rax
mov    -0x40010(%rbp,%rax,4),%eax
add    $0x40010,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mammoth_func>:
jmp    1030 <mammoth_leaf@plt>

LLVM IR (-O0):
define i32 @mammoth_func(i32 %0) {
%2 = alloca i32
%3 = alloca [65536 x i32]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @mammoth_leaf(i32 %4)
%6 = load i32, i32* %2
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [65536 x i32], [65536 x i32]* %3, i64 0, i64 %7
store i32 %5, i32* %8
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [65536 x i32], [65536 x i32]* %3, i64 0, i64 %10
%12 = load i32, i32* %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @mammoth_func(i32 %0) {
%2 = tail call i32 @mammoth_leaf(i32 %0)
ret i32 %2
}
void clear_guncharge() {
  char c;
  for (c = 0; c < 11; c++) {
    *((char *)0x4000 + 192 * 32 + 7 * 32 + 2 + c) = 2;
  }
}


x86 assembly (clang, -O0):
<clear_guncharge>:
push   %rbp
mov    %rsp,%rbp
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0xb,%eax
jge    1136 <clear_guncharge+0x36>
movsbl -0x1(%rbp),%eax
movslq %eax,%rcx
mov    $0x4000,%eax
movb   $0x2,0x18e2(%rax,%rcx,1)
02
mov    -0x1(%rbp),%al
add    $0x1,%al
mov    %al,-0x1(%rbp)
jmp    1108 <clear_guncharge+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_guncharge>:
movabs $0x202020202020202,%rax
02 02 02
mov    %rax,0x58e2
movl   $0x2020202,0x58e9
02 02 02 02
ret

LLVM IR (-O0):
define void @clear_guncharge() {
%1 = alloca i8
store i8 0, i8* %1
br label %2
2: ; preds = %11, %0
%3 = load i8, i8* %1
%4 = sext i8 %3 to i32
%5 = icmp slt i32 %4, 11
br i1 %5, label %6, label %14
6: ; preds = %2
%7 = load i8, i8* %1
%8 = sext i8 %7 to i32
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* getelementptr inbounds (i8, i8* inttoptr (i64 16384 to i8*), i64 6370), i64 %9
store i8 2, i8* %10
br label %11
11: ; preds = %6
%12 = load i8, i8* %1
%13 = add i8 %12, 1
store i8 %13, i8* %1
br label %2
14: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @clear_guncharge() {
ret void
}
int dbg_check_dir(struct ubifs_info *c, const struct inode *dir) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.ubifs_info = type opaque
%struct.inode = type opaque
define i32 @dbg_check_dir(%struct.ubifs_info* nocapture readnone %0, %struct.inode* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int fish(void) {
  printf("hello fish!\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [12 x i8] c"hello fish!\00"
define i32 @fish() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int rand();
int generate(int maxarg) {
  int p;
  p = (rand() % maxarg);
  return (p + 1);
}


x86 assembly (clang, -O0):
<generate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cltd
idivl  -0x4(%rbp)
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebx
lea    0x1(%rdx),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @generate(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 (...) @rand()
%5 = load i32, i32* %2
%6 = srem i32 %4, %5
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 1
ret i32 %8
}

LLVM IR (-O2):
define i32 @generate(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, %0
%4 = add nsw i32 %3, 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *popstr();
int /*<<< orphan*/ strlcpy(char *, char *, size_t);
int popstrbuf(char *buf, size_t len) {
  char *s = popstr();
  if (s) {
    strlcpy(buf, s, len);
    free(s);
  }
  return !!s;
}


x86 assembly (clang, -O0):
<popstrbuf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <popstr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1170 <popstrbuf+0x40>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1050 <strlcpy@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x18(%rbp)
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<popstrbuf>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %eax,%eax
call   1040 <popstr@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1160 <popstrbuf+0x30>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1050 <strlcpy@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
test   %rbx,%rbx
setne  %al
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @popstrbuf(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = call i8* (...) @popstr()
store i8* %6, i8** %5
%7 = load i8*, i8** %5
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %16
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = load i8*, i8** %5
%12 = load i64, i64* %4
%13 = call i32 @strlcpy(i8* %10, i8* %11, i64 %12)
%14 = load i8*, i8** %5
%15 = call i32 @free(i8* %14)
br label %16
16: ; preds = %9, %2
%17 = load i8*, i8** %5
%18 = icmp ne i8* %17, null
%19 = xor i1 %18, true
%20 = xor i1 %19, true
%21 = zext i1 %20 to i32
ret i32 %21
}

LLVM IR (-O2):
define i32 @popstrbuf(i8* %0, i64 %1) {
%3 = tail call i8* (...) @popstr()
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @strlcpy(i8* %0, i8* %3, i64 %1)
%7 = tail call i32 @free(i8* %3)
br label %8
8: ; preds = %5, %2
%9 = zext i1 %4 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ GL_VERSION;
int /*<<< orphan*/ InitWindow(int, char **);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ glClearColor(float, float, float, float);
char *glGetString(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void Initialize(int argc, char *argv[]) {
  InitWindow(argc, argv);
  fprintf(stdout, "INFO: OpenGL Version: %s\n", glGetString(GL_VERSION));
  glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
}


x86 assembly (clang, -O0):
<Initialize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <InitWindow@plt>
mov    0x2e76(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
call   1050 <glGetString@plt>
mov    -0x14(%rbp),%edi
mov    %rax,%rdx
lea    0xe7e(%rip),%rsi
call   1040 <fprintf@plt>
xorps  %xmm3,%xmm3
movaps %xmm3,%xmm0
movaps %xmm3,%xmm1
movaps %xmm3,%xmm2
call   1030 <glClearColor@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Initialize>:
push   %rbx
call   1060 <InitWindow@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%ebx
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
call   1050 <glGetString@plt>
lea    0xe9c(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1040 <fprintf@plt>
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
xorps  %xmm3,%xmm3
pop    %rbx
jmp    1030 <glClearColor@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [26 x i8] c"INFO: OpenGL Version: %s\0A\00"
@GL_VERSION = global i32 0
define void @Initialize(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = load i8**, i8*** %4
%7 = call i32 @InitWindow(i32 %5, i8** %6)
%8 = load i32, i32* @stdout
%9 = load i32, i32* @GL_VERSION
%10 = call i8* @glGetString(i32 %9)
%11 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = call i32 @glClearColor(float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [26 x i8] c"INFO: OpenGL Version: %s\0A\00"
@GL_VERSION = global i32 0
define void @Initialize(i32 %0, i8** %1) {
%3 = tail call i32 @InitWindow(i32 %0, i8** %1)
%4 = load i32, i32* @stdout
%5 = load i32, i32* @GL_VERSION
%6 = tail call i8* @glGetString(i32 %5)
%7 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = tail call i32 @glClearColor(float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char const *);
void die_errno(const char *message) {
  perror(message);
  exit(EXIT_FAILURE);
}


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

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

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

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define void @die_errno(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Type definitions */
struct sysrq_key_op {
  int dummy;
};

/* Variables and functions */
int EINVAL;
int register_sysrq_key(int key, const struct sysrq_key_op *op) {
  return -EINVAL;
}


x86 assembly (clang, -O0):
<register_sysrq_key>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    0x2ecc(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<register_sysrq_key>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
%struct.sysrq_key_op = type { i32 }
@EINVAL = global i32 0
define i32 @register_sysrq_key(i32 %0, %struct.sysrq_key_op* %1) {
%3 = alloca i32
%4 = alloca %struct.sysrq_key_op*
store i32 %0, i32* %3
store %struct.sysrq_key_op* %1, %struct.sysrq_key_op** %4
%5 = load i32, i32* @EINVAL
%6 = sub nsw i32 0, %5
ret i32 %6
}

LLVM IR (-O2):
%struct.sysrq_key_op = type { i32 }
@EINVAL = global i32 0
define i32 @register_sysrq_key(i32 %0, %struct.sysrq_key_op* nocapture readnone %1) {
%3 = load i32, i32* @EINVAL
%4 = sub nsw i32 0, %3
ret i32 %4
}
void RTLogCopyGroupsAndFlags(void) {}


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

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

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

LLVM IR (-O2):
define void @RTLogCopyGroupsAndFlags() {
ret void
}
int unix_fcntl_o_tty_init() { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @unix_fcntl_o_tty_init() {
ret i32 -1
}
int fun9(int x, int y) { return x + y; }


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

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

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

LLVM IR (-O2):
define i32 @fun9(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ check_p4_escr_addr();
int /*<<< orphan*/ do_events();
int main(void) {
  check_p4_escr_addr();
  do_events();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @check_p4_escr_addr()
%2 = tail call i32 (...) @do_events()
ret i32 0
}
void clear_bss(void) {
  extern int __bss_start, __bss_end;
  int *p = &__bss_start;
  for (; p < &__bss_end; p++)
    *p = 0;
}


x86 assembly (clang, -O0):
<clear_bss>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    0x2eca(%rip),%rax
cmp    %rax,-0x8(%rbp)
jae    113b <clear_bss+0x3b>
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <clear_bss+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_bss>:
push   %rax
mov    0x2ed0(%rip),%rdi
cmp    0x2ec1(%rip),%rdi
jae    114c <clear_bss+0x3c>
lea    0x4(%rdi),%rax
mov    0x2eb4(%rip),%rcx
cmp    %rax,%rcx
cmova  %rcx,%rax
mov    %rdi,%rcx
not    %rcx
lea    (%rcx,%rax,1),%rdx
add    $0x4,%rdx
and    $0xfffffffffffffffc,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
pop    %rax
ret

LLVM IR (-O0):
@__bss_start = external global i32
@__bss_end = external global i32
define void @clear_bss() {
%1 = alloca i32*
store i32* @__bss_start, i32** %1
br label %2
2: ; preds = %7, %0
%3 = load i32*, i32** %1
%4 = icmp ult i32* %3, @__bss_end
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = load i32*, i32** %1
store i32 0, i32* %6
br label %7
7: ; preds = %5
%8 = load i32*, i32** %1
%9 = getelementptr inbounds i32, i32* %8, i32 1
store i32* %9, i32** %1
br label %2
10: ; preds = %2
ret void
}

LLVM IR (-O2):
@__bss_start = external global i32
@__bss_end = external global i32
define void @clear_bss() {
br i1 icmp ult (i32* @__bss_start, i32* @__bss_end), label %1, label %5
1: ; preds = %0
%2 = call i64 @llvm.umax.i64(i64 ptrtoint (i32* @__bss_end to i64), i64 add (i64 ptrtoint (i32* @__bss_start to i64), i64 4))
%3 = add i64 %2, add (i64 xor (i64 ptrtoint (i32* @__bss_start to i64), i64 -1), i64 4)
%4 = and i64 %3, -4
br label %5
5: ; preds = %1, %0
ret void
}
int count_words(const char *buffer) {
  int word_count = 0;
  char *pos = (char *)buffer;
  while (*pos) {
    if (word_count == 0) {
      word_count = 1;
    }
    if (*pos == ' ') {
      word_count++;
    }
    pos++;
  }
  return word_count;
}


x86 assembly (clang, -O0):
<count_words>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     115f <count_words+0x5f>
cmpl   $0x0,-0xc(%rbp)
jne    1135 <count_words+0x35>
movl   $0x1,-0xc(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    114e <count_words+0x4e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1117 <count_words+0x17>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_words>:
mov    (%rdi),%cl
test   %cl,%cl
je     113c <count_words+0x3c>
add    $0x1,%rdi
xor    %eax,%eax
mov    $0x1,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
test   %eax,%eax
cmove  %edx,%eax
xor    %esi,%esi
cmp    $0x20,%cl
sete   %sil
add    %esi,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1120 <count_words+0x20>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @count_words(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %14, %4 ], [ %2, %1 ]
%6 = phi i8* [ %13, %4 ], [ %0, %1 ]
%7 = phi i32 [ %12, %4 ], [ 0, %1 ]
%8 = icmp eq i32 %7, 0
%9 = select i1 %8, i32 1, i32 %7
%10 = icmp eq i8 %5, 32
%11 = zext i1 %10 to i32
%12 = add nsw i32 %9, %11
%13 = getelementptr inbounds i8, i8* %6, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %4
16: ; preds = %4, %1
%17 = phi i32 [ 0, %1 ], [ %12, %4 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("MBEDTLS_BIGNUM_C and/or MBEDTLS_RSA_C and/or "
         "MBEDTLS_MD_C and/or "
         "MBEDTLS_SHA256_C and/or MBEDTLS_FS_IO not defined.\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 = [117 x i8] c"MBEDTLS_BIGNUM_C and/or MBEDTLS_RSA_C and/or MBEDTLS_MD_C and/or MBEDTLS_SHA256_C and/or MBEDTLS_FS_IO not defined.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([117 x i8], [117 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [116 x i8] c"MBEDTLS_BIGNUM_C and/or MBEDTLS_RSA_C and/or MBEDTLS_MD_C and/or MBEDTLS_SHA256_C and/or MBEDTLS_FS_IO not defined.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([116 x i8], [116 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct msghdr {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ sendmsg(int, struct msghdr const *, int);
__attribute__((weak)) ssize_t __real_sendmsg(int fd, const struct msghdr *msg,
                                             int flags) {
  return sendmsg(fd, msg, flags);
}


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

x86 assembly (clang, -O2):
<__real_sendmsg>:
jmp    1030 <sendmsg@plt>

LLVM IR (-O0):
%struct.msghdr = type { i32 }
define weak i32 @__real_sendmsg(i32 %0, %struct.msghdr* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.msghdr*
%6 = alloca i32
store i32 %0, i32* %4
store %struct.msghdr* %1, %struct.msghdr** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load %struct.msghdr*, %struct.msghdr** %5
%9 = load i32, i32* %6
%10 = call i32 @sendmsg(i32 %7, %struct.msghdr* %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
%struct.msghdr = type { i32 }
define weak i32 @__real_sendmsg(i32 %0, %struct.msghdr* %1, i32 %2) {
%4 = tail call i32 @sendmsg(i32 %0, %struct.msghdr* %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
char *longestCommonPrefix(char **, int);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char *strs[3] = {"aaa", "aaaa", "aaab"};
  printf("%s\n", longestCommonPrefix(strs, 3));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2cca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cc7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2cc4(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x3,%esi
call   1030 <longestCommonPrefix@plt>
mov    %rax,%rsi
lea    0xea2(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0x2ce5(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0x2cc9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x3,%esi
call   1030 <longestCommonPrefix@plt>
lea    0xebb(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"aaa\00"
@.str.1 = [5 x i8] c"aaaa\00"
@.str.2 = [5 x i8] c"aaab\00"
@__const.main.strs = [3 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0)]
@.str.3 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i8*]
store i32 0, i32* %1
%3 = bitcast [3 x i8*]* %2 to i8*
%4 = getelementptr inbounds [3 x i8*], [3 x i8*]* %2, i64 0, i64 0
%5 = call i8* @longestCommonPrefix(i8** %4, i32 3)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"aaa\00"
@.str.1 = [5 x i8] c"aaaa\00"
@.str.2 = [5 x i8] c"aaab\00"
@__const.main.strs = [3 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0)]
@.str.3 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [3 x i8*]
%2 = bitcast [3 x i8*]* %1 to i8*
%3 = getelementptr inbounds [3 x i8*], [3 x i8*]* %1, i64 0, i64 0
%4 = call i8* @longestCommonPrefix(i8** %3, i32 3)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void higolang() { printf("Call \"higolang\" function here!\n"); }


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

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

LLVM IR (-O0):
@.str = [32 x i8] c"Call \22higolang\22 function here!\0A\00"
define void @higolang() {
%1 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [31 x i8] c"Call \22higolang\22 function here!\00"
define void @higolang() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
ret void
}
void poller_call(void) {}


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

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

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

LLVM IR (-O2):
define void @poller_call() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ print_backtrace();
scalar_t__ write(int, char *, int);
void sig_abrt_handler(int signum __attribute__((unused))) {
  if (write(1, "SIGABRT received\n", 18) < 0) {
  }
  print_backtrace();
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<sig_abrt_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%edi
lea    0xeb9(%rip),%rsi
mov    $0x12,%edx
call   1040 <write@plt>
cmp    $0x0,%rax
jge    1160 <sig_abrt_handler+0x30>
jmp    1160 <sig_abrt_handler+0x30>
mov    $0x0,%al
call   1030 <print_backtrace@plt>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<sig_abrt_handler>:
push   %rax
lea    0xec8(%rip),%rsi
mov    $0x1,%edi
mov    $0x12,%edx
call   1040 <write@plt>
xor    %eax,%eax
call   1030 <print_backtrace@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"SIGABRT received\0A\00"
@EXIT_FAILURE = global i32 0
define void @sig_abrt_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i64 @write(i32 1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 18)
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
br label %6
6: ; preds = %5, %1
%7 = call i32 (...) @print_backtrace()
%8 = load i32, i32* @EXIT_FAILURE
%9 = call i32 @exit(i32 %8)
unreachable
}

LLVM IR (-O2):
@.str = [18 x i8] c"SIGABRT received\0A\00"
@EXIT_FAILURE = global i32 0
define void @sig_abrt_handler(i32 %0) {
%2 = tail call i64 @write(i32 1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 18)
%3 = tail call i32 (...) @print_backtrace()
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void bar() { printf("This should never ever run!!! WE smashed the stack!\n"); }


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

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

LLVM IR (-O0):
@.str = [53 x i8] c"This should never ever run!!! WE smashed the stack!\0A\00"
define void @bar() {
%1 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [52 x i8] c"This should never ever run!!! WE smashed the stack!\00"
define void @bar() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
ret void
}
int putchar(int c) {
  *(volatile char *)(0xC0200000 + 0) = c;
  return (unsigned char)c;
}


x86 assembly (clang, -O0):
<putchar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %al,%cl
mov    $0xc0200000,%eax
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<putchar>:
mov    $0xc0200000,%eax
mov    %dil,(%rax)
movzbl %dil,%eax
ret

LLVM IR (-O0):
define i32 @putchar(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = trunc i32 %3 to i8
store volatile i8 %4, i8* inttoptr (i64 3223322624 to i8*)
%5 = load i32, i32* %2
%6 = trunc i32 %5 to i8
%7 = zext i8 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @putchar(i32 %0) {
%2 = trunc i32 %0 to i8
store volatile i8 %2, i8* inttoptr (i64 3223322624 to i8*)
%3 = and i32 %0, 255
ret i32 %3
}
/* Variables and functions */
int setenv(char const *, char const *, int);
int /*<<< orphan*/ unsetenv(char const *);
int r_sys_setenv(const char *key, const char *value) {
  if (!key) {
    return 0;
  }
  if (!value) {
    unsetenv(key);
    return 0;
  }
  return setenv(key, value, 1);
}


x86 assembly (clang, -O0):
<r_sys_setenv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1147 <r_sys_setenv+0x27>
movl   $0x0,-0x4(%rbp)
jmp    117c <r_sys_setenv+0x5c>
cmpq   $0x0,-0x18(%rbp)
jne    1167 <r_sys_setenv+0x47>
mov    -0x10(%rbp),%rdi
call   1040 <unsetenv@plt>
movl   $0x0,-0x4(%rbp)
jmp    117c <r_sys_setenv+0x5c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x1,%edx
call   1030 <setenv@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<r_sys_setenv>:
test   %rdi,%rdi
je     113e <r_sys_setenv+0x1e>
test   %rsi,%rsi
je     1134 <r_sys_setenv+0x14>
mov    $0x1,%edx
jmp    1030 <setenv@plt>
push   %rax
call   1040 <unsetenv@plt>
add    $0x8,%rsp
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @r_sys_setenv(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = icmp eq i8* %1, null
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32 @unsetenv(i8* %0)
br label %10
8: ; preds = %4
%9 = tail call i32 @setenv(i8* %0, i8* %1, i32 1)
br label %10
10: ; preds = %2, %8, %6
%11 = phi i32 [ %9, %8 ], [ 0, %6 ], [ 0, %2 ]
ret i32 %11
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ err_sys(char *);
int read(int, void *, size_t);
ssize_t Read(int fd, void *buf, size_t count) {
  ssize_t n;
  if ((n = read(fd, buf, count)) == -1)
    err_sys("read error");
  return n;
}


x86 assembly (clang, -O0):
<Read>:
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 <read@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
jne    115b <Read+0x3b>
lea    0xeaa(%rip),%rdi
call   1030 <err_sys@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Read>:
push   %rbx
call   1040 <read@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    1139 <Read+0x19>
lea    0xecc(%rip),%rdi
call   1030 <err_sys@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [11 x i8] c"read error\00"
define i32 @Read(i32 %0, i8* nocapture %1, i64 %2) {
%4 = tail call i32 @read(i32 %0, i8* %1, i64 %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @err_sys(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret i32 %4
}
/* Type definitions */
struct sd {
  int dummy;
};

/* Variables and functions */
scalar_t__ w9968cf_write_sb(struct sd *, int);
int w9968cf_smbus_start(struct sd *sd) {
  int ret = 0;
  ret += w9968cf_write_sb(sd, 0x0011);
  ret += w9968cf_write_sb(sd, 0x0010);
  return ret;
}


x86 assembly (clang, -O0):
<w9968cf_smbus_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x11,%esi
call   1030 <w9968cf_write_sb@plt>
mov    %rax,%rcx
movslq -0xc(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x10,%esi
call   1030 <w9968cf_write_sb@plt>
mov    %rax,%rcx
movslq -0xc(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<w9968cf_smbus_start>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x11,%esi
call   1030 <w9968cf_write_sb@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    $0x10,%esi
call   1030 <w9968cf_write_sb@plt>
add    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.sd = type { i32 }
define i32 @w9968cf_smbus_start(%struct.sd* %0) {
%2 = alloca %struct.sd*
%3 = alloca i32
store %struct.sd* %0, %struct.sd** %2
store i32 0, i32* %3
%4 = load %struct.sd*, %struct.sd** %2
%5 = call i64 @w9968cf_write_sb(%struct.sd* %4, i32 17)
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = add nsw i64 %7, %5
%9 = trunc i64 %8 to i32
store i32 %9, i32* %3
%10 = load %struct.sd*, %struct.sd** %2
%11 = call i64 @w9968cf_write_sb(%struct.sd* %10, i32 16)
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = add nsw i64 %13, %11
%15 = trunc i64 %14 to i32
store i32 %15, i32* %3
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
%struct.sd = type { i32 }
define i32 @w9968cf_smbus_start(%struct.sd* %0) {
%2 = tail call i64 @w9968cf_write_sb(%struct.sd* %0, i32 17)
%3 = tail call i64 @w9968cf_write_sb(%struct.sd* %0, i32 16)
%4 = add i64 %3, %2
%5 = trunc i64 %4 to i32
ret i32 %5
}
/* Variables and functions */
int IndexOf_internal(char *, char *, char, char);
int IndexOf(char *input, char *target) {
  return IndexOf_internal(input, target, '\0', '\0');
}


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

x86 assembly (clang, -O2):
<IndexOf>:
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <IndexOf_internal@plt>

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

LLVM IR (-O2):
define i32 @IndexOf(i8* %0, i8* %1) {
%3 = tail call i32 @IndexOf_internal(i8* %0, i8* %1, i8 signext 0, i8 signext 0)
ret i32 %3
}
void pnx833x_gpio_clear_irq(unsigned int pin) {
  do {
    ((*((volatile unsigned long *)((0xa0000000ul + 0x17E00000ul) + 0xFFE8))) |=
     (1 << (pin)));
  } while (0);
  do {
    ((*((volatile unsigned long *)((0xa0000000ul + 0x17E00000ul) + 0xFFE8))) &=
     ~(1 << (pin)));
  } while (0);
}


x86 assembly (clang, -O0):
<pnx833x_gpio_clear_irq>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
cltq
mov    $0xb7e0ffe8,%ecx
mov    (%rcx),%rcx
or     %rax,%rcx
mov    $0xb7e0ffe8,%eax
mov    %rcx,(%rax)
jmp    112b <pnx833x_gpio_clear_irq+0x2b>
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
cltq
mov    $0xb7e0ffe8,%ecx
mov    (%rcx),%rcx
and    %rax,%rcx
mov    $0xb7e0ffe8,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<pnx833x_gpio_clear_irq>:
mov    %edi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
cltq
mov    $0xb7e0ffe8,%edx
or     %rax,(%rdx)
mov    $0xfffffffe,%eax
rol    %cl,%eax
cltq
and    %rax,(%rdx)
ret

LLVM IR (-O0):
define void @pnx833x_gpio_clear_irq(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %1
%4 = load i32, i32* %2
%5 = shl i32 1, %4
%6 = sext i32 %5 to i64
%7 = load volatile i64, i64* inttoptr (i64 3084976104 to i64*)
%8 = or i64 %7, %6
store volatile i64 %8, i64* inttoptr (i64 3084976104 to i64*)
br label %9
9: ; preds = %3
br label %10
10: ; preds = %9
%11 = load i32, i32* %2
%12 = shl i32 1, %11
%13 = xor i32 %12, -1
%14 = sext i32 %13 to i64
%15 = load volatile i64, i64* inttoptr (i64 3084976104 to i64*)
%16 = and i64 %15, %14
store volatile i64 %16, i64* inttoptr (i64 3084976104 to i64*)
br label %17
17: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @pnx833x_gpio_clear_irq(i32 %0) {
%2 = shl nuw i32 1, %0
%3 = sext i32 %2 to i64
%4 = load volatile i64, i64* inttoptr (i64 3084976104 to i64*)
%5 = or i64 %4, %3
store volatile i64 %5, i64* inttoptr (i64 3084976104 to i64*)
%6 = xor i32 %2, -1
%7 = sext i32 %6 to i64
%8 = load volatile i64, i64* inttoptr (i64 3084976104 to i64*)
%9 = and i64 %8, %7
store volatile i64 %9, i64* inttoptr (i64 3084976104 to i64*)
ret void
}
/* Variables and functions */
bool ts_toggle_allocation_recording(bool value) {
  (void)value;
  return false;
}


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

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

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

LLVM IR (-O2):
define i32 @ts_toggle_allocation_recording(i32 %0) {
ret i32 0
}
void Mali_Reset(void) {}


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

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

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

LLVM IR (-O2):
define void @Mali_Reset() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_syntax(char *name) {
  printf("Syntax: %s ip_address port bytes_to_send\n", name);
  printf("        Format ip_address as d1.d2.d3.d4, where dx is integer "
         "0-255\n\n");
}


x86 assembly (clang, -O0):
<print_syntax>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_syntax>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef1(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"Syntax: %s ip_address port bytes_to_send\0A\00"
@.str.1 = [70 x i8] c" Format ip_address as d1.d2.d3.d4, where dx is integer 0-255\0A\0A\00"
define void @print_syntax(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"Syntax: %s ip_address port bytes_to_send\0A\00"
@str = [69 x i8] c" Format ip_address as d1.d2.d3.d4, where dx is integer 0-255\0A\00"
define void @print_syntax(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *malloc(int);
void testOffsetOfRegionFreed3() {
  char *r = malloc(sizeof(char));
  r = r - 10;
  free(r);
}


x86 assembly (clang, -O0):
<testOffsetOfRegionFreed3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xfffffffffffffff6,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testOffsetOfRegionFreed3>:
push   %rax
mov    $0x1,%edi
call   1040 <malloc@plt>
lea    -0xa(%rax),%rdi
pop    %rax
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @testOffsetOfRegionFreed3() {
%1 = alloca i8*
%2 = call i8* @malloc(i32 1)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = getelementptr inbounds i8, i8* %3, i64 -10
store i8* %4, i8** %1
%5 = load i8*, i8** %1
%6 = call i32 @free(i8* %5)
ret void
}

LLVM IR (-O2):
define void @testOffsetOfRegionFreed3() {
%1 = tail call dereferenceable_or_null(1) i8* @malloc(i32 1)
%2 = getelementptr inbounds i8, i8* %1, i64 -10
%3 = tail call i32 @free(i8* %2)
ret void
}
void stat_irq_end(struct irq_desc *desc) {}


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

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

LLVM IR (-O0):
%struct.irq_desc = type opaque
define void @stat_irq_end(%struct.irq_desc* %0) {
%2 = alloca %struct.irq_desc*
store %struct.irq_desc* %0, %struct.irq_desc** %2
ret void
}

LLVM IR (-O2):
%struct.irq_desc = type opaque
define void @stat_irq_end(%struct.irq_desc* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
unsigned char *blake384_file(unsigned char *, int /*<<< orphan*/ *);
unsigned char *hash_file_blake384(unsigned char *out, FILE *fp) {
  return blake384_file(out, fp);
}


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

x86 assembly (clang, -O2):
<hash_file_blake384>:
jmp    1030 <blake384_file@plt>

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

LLVM IR (-O2):
define i8* @hash_file_blake384(i8* %0, i32* %1) {
%3 = tail call i8* @blake384_file(i8* %0, i32* %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ drawLine(int, int, int, int);
int /*<<< orphan*/ drawRect(int, int, int, int);
int main(void) {
  int x = 50;
  int y = 40;
  drawLine(30, 30, 120, 30);
  drawLine(120, 30, 120, 80);
  drawLine(120, 80, 30, 80);
  drawLine(30, 80, 30, 30);
  drawRect(150, 50, 210, 190);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x32,-0x8(%rbp)
movl   $0x28,-0xc(%rbp)
mov    $0x1e,%ecx
mov    $0x78,%edx
mov    %ecx,%edi
mov    %ecx,%esi
call   1030 <drawLine@plt>
mov    $0x78,%edx
mov    $0x1e,%esi
mov    $0x50,%ecx
mov    %edx,%edi
call   1030 <drawLine@plt>
mov    $0x78,%edi
mov    $0x50,%ecx
mov    $0x1e,%edx
mov    %ecx,%esi
call   1030 <drawLine@plt>
mov    $0x1e,%ecx
mov    $0x50,%esi
mov    %ecx,%edi
mov    %ecx,%edx
call   1030 <drawLine@plt>
mov    $0x96,%edi
mov    $0x32,%esi
mov    $0xd2,%edx
mov    $0xbe,%ecx
call   1040 <drawRect@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1e,%edi
mov    $0x1e,%esi
mov    $0x78,%edx
mov    $0x1e,%ecx
call   1030 <drawLine@plt>
mov    $0x78,%edi
mov    $0x1e,%esi
mov    $0x78,%edx
mov    $0x50,%ecx
call   1030 <drawLine@plt>
mov    $0x78,%edi
mov    $0x50,%esi
mov    $0x1e,%edx
mov    $0x50,%ecx
call   1030 <drawLine@plt>
mov    $0x1e,%edi
mov    $0x50,%esi
mov    $0x1e,%edx
mov    $0x1e,%ecx
call   1030 <drawLine@plt>
mov    $0x96,%edi
mov    $0x32,%esi
mov    $0xd2,%edx
mov    $0xbe,%ecx
call   1040 <drawRect@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 50, i32* %2
store i32 40, i32* %3
%4 = call i32 @drawLine(i32 30, i32 30, i32 120, i32 30)
%5 = call i32 @drawLine(i32 120, i32 30, i32 120, i32 80)
%6 = call i32 @drawLine(i32 120, i32 80, i32 30, i32 80)
%7 = call i32 @drawLine(i32 30, i32 80, i32 30, i32 30)
%8 = call i32 @drawRect(i32 150, i32 50, i32 210, i32 190)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @drawLine(i32 30, i32 30, i32 120, i32 30)
%2 = tail call i32 @drawLine(i32 120, i32 30, i32 120, i32 80)
%3 = tail call i32 @drawLine(i32 120, i32 80, i32 30, i32 80)
%4 = tail call i32 @drawLine(i32 30, i32 80, i32 30, i32 30)
%5 = tail call i32 @drawRect(i32 150, i32 50, i32 210, i32 190)
ret i32 0
}