xunge/DecIR huggingface dataset:
void ps_print_graph() {}


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

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

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

LLVM IR (-O2):
define void @ps_print_graph() {
ret void
}
double foo08(double a, double b, double c) { return (a * b - c); }


x86 assembly (clang, -O0):
<foo08>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo08>:
mulsd  %xmm1,%xmm0
subsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @foo08(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = load double, double* %6
%10 = fneg double %9
%11 = call double @llvm.fmuladd.f64(double %7, double %8, double %10)
ret double %11
}

LLVM IR (-O2):
define double @foo08(double %0, double %1, double %2) {
%4 = fneg double %2
%5 = tail call double @llvm.fmuladd.f64(double %0, double %1, double %4)
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  printf("Hello %s!\n", argv[1] ? argv[1] : "World");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     1146 <main+0x36>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1156 <main+0x46>
lea    0xebe(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1156 <main+0x46>
mov    -0x18(%rbp),%rsi
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rax
test   %rax,%rax
lea    0xeec(%rip),%rsi
cmovne %rax,%rsi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Hello %s!\0A\00"
@.str.1 = [6 x i8] c"World\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 i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
br label %15
14: ; preds = %2
br label %15
15: ; preds = %14, %10
%16 = phi i8* [ %13, %10 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %14 ]
%17 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"Hello %s!\0A\00"
@.str.1 = [6 x i8] c"World\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
%6 = select i1 %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %4
%7 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdout;
void handler(int signal) {
  printf("sigcatcher:  caught signal %i\n", signal);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handler>:
push   %rax
mov    %edi,%esi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"sigcatcher: caught signal %i\0A\00"
@stdout = global i32 0
define void @handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @stdout
%6 = call i32 @fflush(i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"sigcatcher: caught signal %i\0A\00"
@stdout = global i32 0
define void @handler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
ret void
}
int sprint_none(buffer, cnt)
char *buffer;
struct s_content *cnt;
{
  strcpy(buffer, "NONE");
}


x86 assembly (clang, -O0):
<sprint_none>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed5(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sprint_none>:
movb   $0x0,0x4(%rdi)
movl   $0x454e4f4e,(%rdi)
ret

LLVM IR (-O0):
%struct.s_content = type opaque
@.str = [5 x i8] c"NONE\00"
define i32 @sprint_none(i8* %0, %struct.s_content* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.s_content*
store i8* %0, i8** %4
store %struct.s_content* %1, %struct.s_content** %5
%6 = load i8*, i8** %4
%7 = call i8* @strcpy(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
%struct.s_content = type opaque
@.str = [5 x i8] c"NONE\00"
define i32 @sprint_none(i8* nocapture writeonly %0, %struct.s_content* nocapture readnone %1) {
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(5) %0, i8* align 1 dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 5, i1 false)
ret i32 undef
}
void __flush_axi_bus_buffer(void) {}


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

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

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

LLVM IR (-O2):
define void @__flush_axi_bus_buffer() {
ret void
}
/* Variables and functions */
unsigned long Rand();
unsigned long Crt_GetRandomInt(unsigned long min, unsigned long max) {
  return min + (((max - min + 1) * Rand()) >> 15);
}


x86 assembly (clang, -O0):
<Crt_GetRandomInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
sub    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1030 <Rand@plt>
mov    -0x20(%rbp),%rcx
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
imul   %rdx,%rcx
shr    $0xf,%rcx
add    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Crt_GetRandomInt>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
sub    %rdi,%rsi
lea    0x1(%rsi),%r14
xor    %eax,%eax
call   1030 <Rand@plt>
imul   %r14,%rax
shr    $0xf,%rax
add    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @Crt_GetRandomInt(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = load i64, i64* %3
%8 = sub i64 %6, %7
%9 = add i64 %8, 1
%10 = call i64 (...) @Rand()
%11 = mul i64 %9, %10
%12 = lshr i64 %11, 15
%13 = add i64 %5, %12
ret i64 %13
}

LLVM IR (-O2):
define i64 @Crt_GetRandomInt(i64 %0, i64 %1) {
%3 = sub i64 1, %0
%4 = add i64 %3, %1
%5 = tail call i64 (...) @Rand()
%6 = mul i64 %5, %4
%7 = lshr i64 %6, 15
%8 = add i64 %7, %0
ret i64 %8
}
/* Variables and functions */
int /*<<< orphan*/ addToTree(char *);
int /*<<< orphan*/ dequeueList();
int /*<<< orphan*/ peekList();
int /*<<< orphan*/ reportError(char);
scalar_t__ strcmp(int /*<<< orphan*/, char *);
int rPare() {
  if (strcmp(peekList(), ")") != 0) {
    reportError(')');
    return 0;
  }
  dequeueList();
  addToTree(")");
  return 1;
}


x86 assembly (clang, -O0):
<rPare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <peekList@plt>
mov    %eax,%edi
lea    0xe98(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     118d <rPare+0x3d>
mov    $0x29,%edi
call   1030 <reportError@plt>
movl   $0x0,-0x4(%rbp)
jmp    11a7 <rPare+0x57>
mov    $0x0,%al
call   1070 <dequeueList@plt>
lea    0xe65(%rip),%rdi
call   1050 <addToTree@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rPare>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <peekList@plt>
lea    0xe9f(%rip),%rsi
mov    %eax,%edi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1179 <rPare+0x29>
mov    $0x29,%edi
call   1030 <reportError@plt>
jmp    1191 <rPare+0x41>
xor    %eax,%eax
call   1070 <dequeueList@plt>
lea    0xe79(%rip),%rdi
call   1050 <addToTree@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c")\00"
define i32 @rPare() {
%1 = alloca i32
%2 = call i32 (...) @peekList()
%3 = call i64 @strcmp(i32 %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @reportError(i8 signext 41)
store i32 0, i32* %1
br label %10
7: ; preds = %0
%8 = call i32 (...) @dequeueList()
%9 = call i32 @addToTree(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
br label %10
10: ; preds = %7, %5
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@.str = [2 x i8] c")\00"
define i32 @rPare() {
%1 = tail call i32 (...) @peekList()
%2 = tail call i64 @strcmp(i32 %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 @reportError(i8 signext 41)
br label %9
6: ; preds = %0
%7 = tail call i32 (...) @dequeueList()
%8 = tail call i32 @addToTree(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %6, %4
%10 = phi i32 [ 0, %4 ], [ 1, %6 ]
ret i32 %10
}
void slrwarn(int i, char *s) {}


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

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

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

LLVM IR (-O2):
define void @slrwarn(i32 %0, i8* nocapture %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
uint8_t mp_load_u8(const char **data) {
  uint8_t val = (*(uint8_t *)*data);
  *data += sizeof(uint8_t);
  return val;
}


x86 assembly (clang, -O0):
<mp_load_u8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x4,%rcx
mov    %rcx,(%rax)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp_load_u8>:
mov    (%rdi),%rcx
mov    (%rcx),%eax
add    $0x4,%rcx
mov    %rcx,(%rdi)
ret

LLVM IR (-O0):
define i32 @mp_load_u8(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
store i8** %0, i8*** %2
%4 = load i8**, i8*** %2
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
store i32 %7, i32* %3
%8 = load i8**, i8*** %2
%9 = load i8*, i8** %8
%10 = getelementptr inbounds i8, i8* %9, i64 4
store i8* %10, i8** %8
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
define i32 @mp_load_u8(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = bitcast i8* %2 to i32*
%4 = load i32, i32* %3
%5 = getelementptr inbounds i8, i8* %2, i64 4
store i8* %5, i8** %0
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ read_word_data(int /*<<< orphan*/, int);
uint16_t get_interrupt_on_bus(uint8_t address) {
  return read_word_data(address, 0x04);
}


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

x86 assembly (clang, -O2):
<get_interrupt_on_bus>:
mov    $0x4,%esi
jmp    1030 <read_word_data@plt>

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

LLVM IR (-O2):
define i32 @get_interrupt_on_bus(i32 %0) {
%2 = tail call i32 @read_word_data(i32 %0, i32 4)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ _clear_error_stack();
int _save_cache_contents();
int save_cache_contents(void) {
  { _clear_error_stack(); };
  return (_save_cache_contents());
}


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

x86 assembly (clang, -O2):
<save_cache_contents>:
push   %rax
xor    %eax,%eax
call   1030 <_clear_error_stack@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <_save_cache_contents@plt>

LLVM IR (-O0):
define i32 @save_cache_contents() {
%1 = call i32 (...) @_clear_error_stack()
%2 = call i32 (...) @_save_cache_contents()
ret i32 %2
}

LLVM IR (-O2):
define i32 @save_cache_contents() {
%1 = tail call i32 (...) @_clear_error_stack()
%2 = tail call i32 (...) @_save_cache_contents()
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
int /*<<< orphan*/ test_bool();
int /*<<< orphan*/ test_float();
void testmain() {
  print("type conversion");
  test_bool();
  test_float();
}


x86 assembly (clang, -O0):
<testmain>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1050 <print@plt>
mov    $0x0,%al
call   1030 <test_bool@plt>
mov    $0x0,%al
call   1040 <test_float@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<testmain>:
push   %rax
lea    0xec8(%rip),%rdi
call   1050 <print@plt>
xor    %eax,%eax
call   1030 <test_bool@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <test_float@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"type conversion\00"
define void @testmain() {
%1 = call i32 @print(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @test_bool()
%3 = call i32 (...) @test_float()
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"type conversion\00"
define void @testmain() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @test_bool()
%3 = tail call i32 (...) @test_float()
ret void
}
int niquery_count_dots(const char *arg) {
  const char *p;
  int count = 0;
  for (p = arg; *p; p++) {
    if (*p == '.')
      count++;
  }
  return count;
}


x86 assembly (clang, -O0):
<niquery_count_dots>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1153 <niquery_count_dots+0x53>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    113d <niquery_count_dots+0x3d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1142 <niquery_count_dots+0x42>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1117 <niquery_count_dots+0x17>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<niquery_count_dots>:
xor    %eax,%eax
jmp    1117 <niquery_count_dots+0x17>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%eax
add    $0x1,%rdi
movzbl (%rdi),%ecx
cmp    $0x2e,%cl
je     1110 <niquery_count_dots+0x10>
test   %cl,%cl
jne    1113 <niquery_count_dots+0x13>
ret

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

LLVM IR (-O2):
define i32 @niquery_count_dots(i8* nocapture %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i8* [ %0, %1 ], [ %10, %8 ]
%4 = phi i32 [ 0, %1 ], [ %9, %8 ]
%5 = load i8, i8* %3
switch i8 %5, label %8 [
i8 0, label %11
i8 46, label %6
]
6: ; preds = %2
%7 = add nsw i32 %4, 1
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ %7, %6 ], [ %4, %2 ]
%10 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
11: ; preds = %2
ret i32 %4
}
void ft_striteri(char *s, void (*f)(unsigned int, char *)) {
  unsigned int u;
  u = 0;
  if (s && f)
    while (*(s + u)) {
      f(u, (s + u));
      u++;
    }
}


x86 assembly (clang, -O0):
<ft_striteri>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1169 <ft_striteri+0x69>
cmpq   $0x0,-0x10(%rbp)
je     1169 <ft_striteri+0x69>
jmp    1132 <ft_striteri+0x32>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
cmpb   $0x0,(%rax,%rcx,1)
je     1164 <ft_striteri+0x64>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%ecx
add    %rcx,%rsi
call   *%rax
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1132 <ft_striteri+0x32>
jmp    1169 <ft_striteri+0x69>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_striteri>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1133 <ft_striteri+0x33>
mov    %rsi,%r14
test   %rsi,%rsi
je     1133 <ft_striteri+0x33>
mov    %rdi,%r15
cmpb   $0x0,(%rdi)
je     1133 <ft_striteri+0x33>
xor    %ebx,%ebx
mov    %r15,%rsi
nop
mov    %ebx,%edi
call   *%r14
add    $0x1,%ebx
lea    (%r15,%rbx,1),%rsi
cmpb   $0x0,(%r15,%rbx,1)
jne    1120 <ft_striteri+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @ft_striteri(i8* %0, void (i32, i8*)* %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne void (i32, i8*)* %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %17
6: ; preds = %2
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 0
br i1 %8, label %17, label %9
9: ; preds = %6, %9
%10 = phi i8* [ %14, %9 ], [ %0, %6 ]
%11 = phi i32 [ %12, %9 ], [ 0, %6 ]
tail call void %1(i32 %11, i8* %10)
%12 = add i32 %11, 1
%13 = zext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %9
17: ; preds = %9, %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ logClose();
void cleanup() { logClose(); }


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

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

LLVM IR (-O0):
define void @cleanup() {
%1 = call i32 (...) @logClose()
ret void
}

LLVM IR (-O2):
define void @cleanup() {
%1 = tail call i32 (...) @logClose()
ret void
}
/* Variables and functions */
char *getlogin();
void test(void) {
  char *loginname;
  loginname = getlogin();
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getlogin@plt>
mov    %rax,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @test() {
%1 = alloca i8*
%2 = call i8* (...) @getlogin()
store i8* %2, i8** %1
ret void
}

LLVM IR (-O2):
define void @test() {
%1 = tail call i8* (...) @getlogin()
ret void
}
int is_down_breakable(int maze[25][25], int i, int j) {
  int check = 0;
  if (i == 25 - 1) {
    check = 0;
  } else if (maze[i][j] != maze[i + 1][j]) {
    check = 1;
  }
  return check;
}


x86 assembly (clang, -O0):
<is_down_breakable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x18,-0xc(%rbp)
jne    112b <is_down_breakable+0x2b>
movl   $0x0,-0x14(%rbp)
jmp    116e <is_down_breakable+0x6e>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x64,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
imul   $0x64,%rdx,%rdx
add    %rdx,%rcx
movslq -0x10(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
je     1169 <is_down_breakable+0x69>
movl   $0x1,-0x14(%rbp)
jmp    116e <is_down_breakable+0x6e>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_down_breakable>:
xor    %eax,%eax
cmp    $0x18,%esi
je     112c <is_down_breakable+0x2c>
movslq %esi,%rax
movslq %edx,%rcx
imul   $0x64,%rax,%rax
add    %rdi,%rax
mov    (%rax,%rcx,4),%edx
add    $0x1,%esi
movslq %esi,%rax
imul   $0x64,%rax,%rsi
add    %rdi,%rsi
xor    %eax,%eax
cmp    (%rsi,%rcx,4),%edx
setne  %al
ret

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

LLVM IR (-O2):
define i32 @is_down_breakable([25 x i32]* nocapture %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, 24
br i1 %4, label %16, label %5
5: ; preds = %3
%6 = sext i32 %1 to i64
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds [25 x i32], [25 x i32]* %0, i64 %6, i64 %7
%9 = load i32, i32* %8
%10 = add nsw i32 %1, 1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [25 x i32], [25 x i32]* %0, i64 %11, i64 %7
%13 = load i32, i32* %12
%14 = icmp ne i32 %9, %13
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %5, %3
%17 = phi i32 [ 0, %3 ], [ %15, %5 ]
ret i32 %17
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int count;
};
struct TYPE_4__ {
  TYPE_1__ xmapping;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void set_XEvent_xmapping_count(void *_p, int _v) {
  ((XEvent *)_p)->xmapping.count = (int)_v;
}


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

x86 assembly (clang, -O2):
<set_XEvent_xmapping_count>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32 }
define void @set_XEvent_xmapping_count(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_4__*
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
store i32 %5, i32* %9
ret void
}

LLVM IR (-O2):
define void @set_XEvent_xmapping_count(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Type definitions */
typedef scalar_t__ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ _DIAGASSERT(int /*<<< orphan*/);
size_t wcslen(const wchar_t *s) {
  const wchar_t *p;
  _DIAGASSERT(s != NULL);
  p = s;
  while (*p)
    p++;
  return p - s;
}


x86 assembly (clang, -O0):
<wcslen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <_DIAGASSERT@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1155 <wcslen+0x45>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1136 <wcslen+0x26>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
sar    $0x3,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcslen>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <_DIAGASSERT@plt>
mov    $0xfffffffffffffff8,%rax
nopl   0x0(%rax)
cmpq   $0x0,0x8(%rbx,%rax,1)
lea    0x8(%rax),%rax
jne    1130 <wcslen+0x20>
sar    $0x3,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i64 @wcslen(i64* %0) {
%2 = icmp ne i64* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @_DIAGASSERT(i32 %3)
br label %5
5: ; preds = %5, %1
%6 = phi i64* [ %0, %1 ], [ %9, %5 ]
%7 = load i64, i64* %6
%8 = icmp eq i64 %7, 0
%9 = getelementptr inbounds i64, i64* %6, i64 1
br i1 %8, label %10, label %5
10: ; preds = %5
%11 = ptrtoint i64* %6 to i64
%12 = ptrtoint i64* %0 to i64
%13 = sub i64 %11, %12
%14 = ashr exact i64 %13, 3
ret i64 %14
}
/* Variables and functions */
char *copyBeforeChar(char, char *);
char *copyUntilTab(char *s) { return copyBeforeChar('\t', s); }


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

x86 assembly (clang, -O2):
<copyUntilTab>:
mov    %rdi,%rsi
mov    $0x9,%edi
jmp    1030 <copyBeforeChar@plt>

LLVM IR (-O0):
define i8* @copyUntilTab(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @copyBeforeChar(i8 signext 9, i8* %3)
ret i8* %4
}

LLVM IR (-O2):
define i8* @copyUntilTab(i8* %0) {
%2 = tail call i8* @copyBeforeChar(i8 signext 9, i8* %0)
ret i8* %2
}
/* Variables and functions */
char getchar();
int /*<<< orphan*/ printf(char *, char);
int main() {
  char c;
  int x;
  c = getchar();
  if (c >= 'a' && c <= 'z') {
    x = 122 - c;
    c = 97 + x;
  }
  printf("%c\n", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     116a <main+0x4a>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jg     116a <main+0x4a>
movsbl -0x5(%rbp),%ecx
mov    $0x7a,%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x61,%eax
mov    %al,-0x5(%rbp)
lea    0xe8f(%rip),%rdi
movsbl -0x5(%rbp),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
lea    -0x61(%rax),%ecx
mov    $0xdb,%dl
sub    %al,%dl
cmp    $0x1a,%cl
movzbl %dl,%ecx
movzbl %al,%eax
cmovb  %ecx,%eax
movsbl %al,%esi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
store i32 0, i32* %1
%4 = call signext i8 (...) @getchar()
store i8 %4, i8* %2
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = icmp sge i32 %6, 97
br i1 %7, label %8, label %19
8: ; preds = %0
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = icmp sle i32 %10, 122
br i1 %11, label %12, label %19
12: ; preds = %8
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = sub nsw i32 122, %14
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = add nsw i32 97, %16
%18 = trunc i32 %17 to i8
store i8 %18, i8* %2
br label %19
19: ; preds = %12, %8, %0
%20 = load i8, i8* %2
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = add i8 %1, -97
%3 = icmp ult i8 %2, 26
%4 = sub i8 -37, %1
%5 = select i1 %3, i8 %4, i8 %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %5)
ret i32 0
}
int test_imm_ABuint16_mem(unsigned short *val) {
  return ((*val) & (0xAB << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_ABuint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 171
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void enreset(void) {}


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

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

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

LLVM IR (-O2):
define void @enreset() {
ret void
}
/* Variables and functions */
int read_mail_box(int, int);
bool read_my_lmb(int index) { return read_mail_box(true, index); }


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

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

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

LLVM IR (-O2):
define i32 @read_my_lmb(i32 %0) {
%2 = tail call i32 @read_mail_box(i32 1, i32 %0)
ret i32 %2
}
int dgtpicom_set_text(char text[], char beep, char ld, char rd) { return 0; }


x86 assembly (clang, -O0):
<dgtpicom_set_text>:
push   %rbp
mov    %rsp,%rbp
mov    %cl,%al
mov    %dl,%cl
mov    %sil,%dl
mov    %rdi,-0x8(%rbp)
mov    %dl,-0x9(%rbp)
mov    %cl,-0xa(%rbp)
mov    %al,-0xb(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @dgtpicom_set_text(i8* %0, i8 signext %1, i8 signext %2, i8 signext %3) {
%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
store i8 %3, i8* %8
ret i32 0
}

LLVM IR (-O2):
define i32 @dgtpicom_set_text(i8* nocapture readnone %0, i8 signext %1, i8 signext %2, i8 signext %3) {
ret i32 0
}
extern double d1d2(double d1, double d2) { return d1 + d2; }


x86 assembly (clang, -O0):
<d1d2>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<d1d2>:
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @d1d2(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fadd double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @d1d2(double %0, double %1) {
%3 = fadd double %0, %1
ret double %3
}
int brace_is_escaped(int nquotes, const char *p, const char *startp) {
  if (nquotes != 0)
    return 1;
  if (p != startp && *(p - 1) == '\\')
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<brace_is_escaped>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1125 <brace_is_escaped+0x25>
movl   $0x1,-0x4(%rbp)
jmp    1157 <brace_is_escaped+0x57>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     1150 <brace_is_escaped+0x50>
mov    -0x10(%rbp),%rax
movsbl -0x1(%rax),%eax
cmp    $0x5c,%eax
jne    1150 <brace_is_escaped+0x50>
movl   $0x1,-0x4(%rbp)
jmp    1157 <brace_is_escaped+0x57>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<brace_is_escaped>:
mov    $0x1,%eax
test   %edi,%edi
je     110a <brace_is_escaped+0xa>
ret
cmp    %rdx,%rsi
je     1115 <brace_is_escaped+0x15>
cmpb   $0x5c,-0x1(%rsi)
je     1109 <brace_is_escaped+0x9>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @brace_is_escaped(i32 %0, i8* %1, i8* readnone %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %5, label %12
5: ; preds = %3
%6 = icmp eq i8* %1, %2
br i1 %6, label %11, label %7
7: ; preds = %5
%8 = getelementptr inbounds i8, i8* %1, i64 -1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 92
br i1 %10, label %12, label %11
11: ; preds = %7, %5
br label %12
12: ; preds = %7, %3, %11
%13 = phi i32 [ 0, %11 ], [ 1, %3 ], [ 1, %7 ]
ret i32 %13
}
int test_imm_F5uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0xF5 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_F5uint64_midword_reg>:
test   $0xf50000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_F5uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 16056320
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void swap(float *a, float *b) {
  float s = *a;
  *a = *b;
  *b = s;
}


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

x86 assembly (clang, -O2):
<swap>:
movss  (%rdi),%xmm0
movss  (%rsi),%xmm1
movss  %xmm1,(%rdi)
movss  %xmm0,(%rsi)
ret

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

LLVM IR (-O2):
define void @swap(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = load float, float* %1
store float %4, float* %0
store float %3, float* %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int getc(int /*<<< orphan*/ *);
long getword(FILE *f) {
  int n;
  unsigned int x;
  n = getc(f);
  if (n < 0)
    return -1;
  x = n;
  n = getc(f);
  if (n < 0)
    return -1;
  return x | (n << 8);
}


x86 assembly (clang, -O0):
<getword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <getc@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    113f <getword+0x2f>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    1179 <getword+0x69>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <getc@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1168 <getword+0x58>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    1179 <getword+0x69>
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,%eax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getword>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1030 <getc@plt>
mov    $0xffffffffffffffff,%r14
test   %eax,%eax
js     113d <getword+0x2d>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <getc@plt>
test   %eax,%eax
js     113d <getword+0x2d>
shl    $0x8,%eax
or     %ebp,%eax
mov    %rax,%r14
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i64 @getword(i32* %0) {
%2 = alloca i64
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
%6 = load i32*, i32** %3
%7 = call i32 @getc(i32* %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i64 -1, i64* %2
br label %24
11: ; preds = %1
%12 = load i32, i32* %4
store i32 %12, i32* %5
%13 = load i32*, i32** %3
%14 = call i32 @getc(i32* %13)
store i32 %14, i32* %4
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %11
store i64 -1, i64* %2
br label %24
18: ; preds = %11
%19 = load i32, i32* %5
%20 = load i32, i32* %4
%21 = shl i32 %20, 8
%22 = or i32 %19, %21
%23 = zext i32 %22 to i64
store i64 %23, i64* %2
br label %24
24: ; preds = %18, %17, %10
%25 = load i64, i64* %2
ret i64 %25
}

LLVM IR (-O2):
define i64 @getword(i32* nocapture %0) {
%2 = tail call i32 @getc(i32* %0)
%3 = icmp slt i32 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = tail call i32 @getc(i32* %0)
%6 = icmp slt i32 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = shl i32 %5, 8
%9 = or i32 %8, %2
%10 = zext i32 %9 to i64
br label %11
11: ; preds = %4, %1, %7
%12 = phi i64 [ %10, %7 ], [ -1, %1 ], [ -1, %4 ]
ret i64 %12
}
/* Type definitions */
struct SN_env {
  int dummy;
};

/* Variables and functions */
struct SN_env *SN_create_env(int /*<<< orphan*/, int, int /*<<< orphan*/);
extern struct SN_env *swedish_UTF_8_create_env(void) {
  return SN_create_env(0, 2, 0);
}


x86 assembly (clang, -O0):
<swedish_UTF_8_create_env>:
push   %rbp
mov    %rsp,%rbp
xor    %edx,%edx
mov    $0x2,%esi
mov    %edx,%edi
call   1030 <SN_create_env@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<swedish_UTF_8_create_env>:
xor    %edi,%edi
mov    $0x2,%esi
xor    %edx,%edx
jmp    1030 <SN_create_env@plt>

LLVM IR (-O0):
%struct.SN_env = type { i32 }
define %struct.SN_env* @swedish_UTF_8_create_env() {
%1 = call %struct.SN_env* @SN_create_env(i32 0, i32 2, i32 0)
ret %struct.SN_env* %1
}

LLVM IR (-O2):
%struct.SN_env = type { i32 }
define %struct.SN_env* @swedish_UTF_8_create_env() {
%1 = tail call %struct.SN_env* @SN_create_env(i32 0, i32 2, i32 0)
ret %struct.SN_env* %1
}
void RSA_get_method(void) {}


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

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

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

LLVM IR (-O2):
define void @RSA_get_method() {
ret void
}
char *RCSid() {
  return RCSid("$Id: specfun.c,v 1.47 2011/10/15 00:03:33 sfeam Exp $");
}


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

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

LLVM IR (-O0):
@.str = [54 x i8] c"$Id: specfun.c,v 1.47 2011/10/15 00:03:33 sfeam Exp $\00"
define i8* @RCSid() {
%1 = call i8* (i8*, ...) bitcast (i8* ()* @RCSid to i8* (i8*, ...)*)(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
define noalias i8* @RCSid() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
void contrivedLeak() {
  char buf[512];
  scanf("%s", buf);
  printf(buf);
  return;
}


x86 assembly (clang, -O0):
<contrivedLeak>:
push   %rbp
mov    %rsp,%rbp
sub    $0x200,%rsp
lea    -0x200(%rbp),%rsi
lea    0xec7(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x200(%rbp),%rdi
call   1030 <printf@plt>
add    $0x200,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<contrivedLeak>:
push   %rbx
sub    $0x200,%rsp
lea    0xed1(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
add    $0x200,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @contrivedLeak() {
%1 = alloca [512 x i8]
%2 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%5 = call i32 @printf(i8* %4)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @contrivedLeak() {
%1 = alloca [512 x i8]
%2 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @printf(i8* %2)
ret void
}
void insw(unsigned short port, void *addr, int cnt) {
  asm volatile("rep; insw" : "+D"(addr), "+c"(cnt) : "d"(port) : "memory");
}


x86 assembly (clang, -O0):
<insw>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%ecx
mov    -0x2(%rbp),%dx
rep insw (%dx),%es:(%rdi)
mov    %rdi,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<insw>:
mov    %edx,%ecx
mov    %edi,%edx
mov    %rsi,%rdi
rep insw (%dx),%es:(%rdi)
ret

LLVM IR (-O0):
define void @insw(i16 zeroext %0, i8* %1, i32 %2) {
%4 = alloca i16
%5 = alloca i8*
%6 = alloca i32
store i16 %0, i16* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %5
%8 = load i32, i32* %6
%9 = load i16, i16* %4
%10 = call { i8*, i32 } asm sideeffect "rep; insw", "={di},={cx},{dx},0,1,~{memory},~{dirflag},~{fpsr},~{flags}"(i16 %9, i8* %7, i32 %8)
%11 = extractvalue { i8*, i32 } %10, 0
%12 = extractvalue { i8*, i32 } %10, 1
store i8* %11, i8** %5
store i32 %12, i32* %6
ret void
}

LLVM IR (-O2):
define void @insw(i16 zeroext %0, i8* %1, i32 %2) {
%4 = tail call { i8*, i32 } asm sideeffect "rep; insw", "={di},={cx},{dx},0,1,~{memory},~{dirflag},~{fpsr},~{flags}"(i16 %0, i8* %1, i32 %2)
ret void
}
/* Variables and functions */
int syscall(int, int /*<<< orphan*/, int /*<<< orphan*/);
int vfork() { return syscall(13, 0, 0); }


x86 assembly (clang, -O0):
<vfork>:
push   %rbp
mov    %rsp,%rbp
mov    $0xd,%edi
xor    %edx,%edx
mov    %edx,%esi
call   1030 <syscall@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<vfork>:
mov    $0xd,%edi
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <syscall@plt>

LLVM IR (-O0):
define i32 @vfork() {
%1 = call i32 @syscall(i32 13, i32 0, i32 0)
ret i32 %1
}

LLVM IR (-O2):
define i32 @vfork() {
%1 = tail call i32 @syscall(i32 13, i32 0, i32 0)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ pthread_exit(void *);
void *thread2_run(void *arg) {
  printf("thread 2 is running\n");
  pthread_exit((void *)2);
}


x86 assembly (clang, -O0):
<thread2_run>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    $0x2,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread2_run>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%edi
pop    %rax
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"thread 2 is running\0A\00"
define i8* @thread2_run(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @pthread_exit(i8* inttoptr (i64 2 to i8*))
%6 = load i8*, i8** %2
ret i8* %6
}

LLVM IR (-O2):
@str = [20 x i8] c"thread 2 is running\00"
define noalias i8* @thread2_run(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @pthread_exit(i8* inttoptr (i64 2 to i8*))
ret i8* undef
}