xunge/DecIR huggingface dataset:
/* Variables and functions */
char *strrchr(char const *, char);
const char *basename(const char *path) {
  const char *p;
  if ((p = strrchr(path, '/')))
    return p + 1;
  return path;
}


x86 assembly (clang, -O0):
<basename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1149 <basename+0x39>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1151 <basename+0x41>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<basename>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @basename(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @strrchr(i8* %5, i8 signext 47)
store i8* %6, i8** %4
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %4
%10 = getelementptr inbounds i8, i8* %9, i64 1
store i8* %10, i8** %2
br label %13
11: ; preds = %1
%12 = load i8*, i8** %3
store i8* %12, i8** %2
br label %13
13: ; preds = %11, %8
%14 = load i8*, i8** %2
ret i8* %14
}

LLVM IR (-O2):
define i8* @basename(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
ret i8* %5
}
void XStoreBuffer() {}


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

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

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

LLVM IR (-O2):
define void @XStoreBuffer() {
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
void sg_nz_put_unaligned_be24(uint32_t val, void *p) {
  if (val) {
    ((uint8_t *)p)[0] = (val >> 16) & 0xff;
    ((uint8_t *)p)[1] = (val >> 8) & 0xff;
    ((uint8_t *)p)[2] = val & 0xff;
  }
}


x86 assembly (clang, -O0):
<sg_nz_put_unaligned_be24>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     114a <sg_nz_put_unaligned_be24+0x4a>
mov    -0x4(%rbp),%ecx
sar    $0x10,%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<sg_nz_put_unaligned_be24>:
test   %edi,%edi
je     111c <sg_nz_put_unaligned_be24+0x1c>
mov    %edi,%eax
mov    %edi,%ecx
shr    $0x10,%ecx
movzbl %cl,%ecx
mov    %ecx,(%rsi)
movzbl %ah,%ecx
mov    %ecx,0x4(%rsi)
movzbl %al,%eax
mov    %eax,0x8(%rsi)
ret

LLVM IR (-O0):
define void @sg_nz_put_unaligned_be24(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 = icmp ne i32 %5, 0
br i1 %6, label %7, label %25
7: ; preds = %2
%8 = load i32, i32* %3
%9 = ashr i32 %8, 16
%10 = and i32 %9, 255
%11 = load i8*, i8** %4
%12 = bitcast i8* %11 to i32*
%13 = getelementptr inbounds i32, i32* %12, i64 0
store i32 %10, i32* %13
%14 = load i32, i32* %3
%15 = ashr i32 %14, 8
%16 = and i32 %15, 255
%17 = load i8*, i8** %4
%18 = bitcast i8* %17 to i32*
%19 = getelementptr inbounds i32, i32* %18, i64 1
store i32 %16, i32* %19
%20 = load i32, i32* %3
%21 = and i32 %20, 255
%22 = load i8*, i8** %4
%23 = bitcast i8* %22 to i32*
%24 = getelementptr inbounds i32, i32* %23, i64 2
store i32 %21, i32* %24
br label %25
25: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
define void @sg_nz_put_unaligned_be24(i32 %0, i8* nocapture writeonly %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %15, label %4
4: ; preds = %2
%5 = lshr i32 %0, 16
%6 = and i32 %5, 255
%7 = bitcast i8* %1 to i32*
store i32 %6, i32* %7
%8 = lshr i32 %0, 8
%9 = and i32 %8, 255
%10 = getelementptr inbounds i8, i8* %1, i64 4
%11 = bitcast i8* %10 to i32*
store i32 %9, i32* %11
%12 = and i32 %0, 255
%13 = getelementptr inbounds i8, i8* %1, i64 8
%14 = bitcast i8* %13 to i32*
store i32 %12, i32* %14
br label %15
15: ; preds = %4, %2
ret void
}
const char *get_bob() { return "bob"; }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"bob\00"
define i8* @get_bob() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ assem_debug(char *);
int /*<<< orphan*/ output_byte(int);
void emit_fabs(void) {
  assem_debug("fabs");
  output_byte(0xd9);
  output_byte(0xe1);
}


x86 assembly (clang, -O0):
<emit_fabs>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <assem_debug@plt>
mov    $0xd9,%edi
call   1040 <output_byte@plt>
mov    $0xe1,%edi
call   1040 <output_byte@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_fabs>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <assem_debug@plt>
mov    $0xd9,%edi
call   1040 <output_byte@plt>
mov    $0xe1,%edi
pop    %rax
jmp    1040 <output_byte@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"fabs\00"
define void @emit_fabs() {
%1 = call i32 @assem_debug(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @output_byte(i32 217)
%3 = call i32 @output_byte(i32 225)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"fabs\00"
define void @emit_fabs() {
%1 = tail call i32 @assem_debug(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @output_byte(i32 217)
%3 = tail call i32 @output_byte(i32 225)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ errx(int /*<<< orphan*/, char *);
size_t Position_to_index(size_t position) {
  if (position == 0) {
    errx(EXIT_FAILURE, "offset bug detected");
  }
  return position - 1;
}


x86 assembly (clang, -O0):
<Position_to_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113c <Position_to_index+0x2c>
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
lea    0xec9(%rip),%rsi
call   1030 <errx@plt>
mov    -0x8(%rbp),%rax
sub    $0x1,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Position_to_index>:
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
jne    112e <Position_to_index+0x1e>
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
lea    0xed7(%rip),%rsi
call   1030 <errx@plt>
add    $0xffffffffffffffff,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [20 x i8] c"offset bug detected\00"
define i64 @Position_to_index(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @errx(i32 %6, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %5, %1
%9 = load i64, i64* %2
%10 = sub i64 %9, 1
ret i64 %10
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [20 x i8] c"offset bug detected\00"
define i64 @Position_to_index(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @errx(i32 %4, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %3, %1
%7 = add i64 %0, -1
ret i64 %7
}
/* Variables and functions */
double const cube(double);
double volumeForRadius(double radius) {
  const double pi = 3.14159265;
  const double coefficient = (4.0 / 3.0);
  return coefficient * pi * cube(radius);
}


x86 assembly (clang, -O0):
<volumeForRadius>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeeb(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xed6(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <cube@plt>
movaps %xmm0,%xmm1
movsd  0xeb4(%rip),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<volumeForRadius>:
push   %rax
call   1030 <cube@plt>
mulsd  0xee2(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @volumeForRadius(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
store double 0x400921FB53C8D4F1, double* %3
store double 0x3FF5555555555555, double* %4
%5 = load double, double* %2
%6 = call double @cube(double %5)
%7 = fmul double 0x4010C15237DB38A0, %6
ret double %7
}

LLVM IR (-O2):
define double @volumeForRadius(double %0) {
%2 = tail call double @cube(double %0)
%3 = fmul double %2, 0x4010C15237DB38A0
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_banner() {
  printf("      .      .______     ______    __       __  \n   .         |   _ "
         " \\   /  __  \\  |  |     |  |      .            \n             |  "
         "|_)  | |  |  |  | |  |     |  |       .\n      .      |   ___/  |  | "
         " |  | |  |     |  |                    . \n             |  |      |  "
         "`--'  | |  `----.|  |    .     \n_____________| _|       \\______/  "
         "|_______||__|_____________________________\n:::::::::Y8b  d88b  d8P  "
         "d88b   . 8888888b.  "
         "o88888888::::::::::::::::::::::\n\"\"\"\"\"\"\"\"\"\"88ij8888ij88' "
         "j8PY8i    888   )88  "
         "Y88<\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n         "
         " \"8888PY8888' ,8P  Y8,   88888888'   Y8b.   .          .\n    .     "
         " Y88P  Y88P  88888888   888  Y8b_____>88b           .           \n . "
         "     .  Y8'  \"8P  d8P    Y8b  888   Y888888888P \n");
}


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

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

LLVM IR (-O0):
@.str = [725 x i8] c" . .______ ______ __ __ \0A . | _ \\ / __ \\ | | | | . \0A | |_) | | | | | | | | | .\0A . | ___/ | | | | | | | | . \0A | | | `--' | | `----.| | . \0A_____________| _| \\______/ |_______||__|_____________________________\0A:::::::::Y8b d88b d8P d88b . 8888888b. o88888888::::::::::::::::::::::\0A\22\22\22\22\22\22\22\22\22\2288ij8888ij88' j8PY8i 888 )88 Y88<\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\0A \228888PY8888' ,8P Y8, 88888888' Y8b. . .\0A . Y88P Y88P 88888888 888 Y8b_____>88b . \0A . . Y8' \228P d8P Y8b 888 Y888888888P \0A\00"
define void @print_banner() {
%1 = call i32 @printf(i8* getelementptr inbounds ([725 x i8], [725 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [724 x i8] c" . .______ ______ __ __ \0A . | _ \\ / __ \\ | | | | . \0A | |_) | | | | | | | | | .\0A . | ___/ | | | | | | | | . \0A | | | `--' | | `----.| | . \0A_____________| _| \\______/ |_______||__|_____________________________\0A:::::::::Y8b d88b d8P d88b . 8888888b. o88888888::::::::::::::::::::::\0A\22\22\22\22\22\22\22\22\22\2288ij8888ij88' j8PY8i 888 )88 Y88<\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\22\0A \228888PY8888' ,8P Y8, 88888888' Y8b. . .\0A . Y88P Y88P 88888888 888 Y8b_____>88b . \0A . . Y8' \228P d8P Y8b 888 Y888888888P \00"
define void @print_banner() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([724 x i8], [724 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *safe_malloc(size_t size) {
  void *ret = malloc(size);
  if (!ret) {
    fprintf(stderr, "Out of virtual memory\n");
    exit(1);
  }
  return ret;
}


x86 assembly (clang, -O0):
<safe_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1173 <safe_malloc+0x43>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_malloc>:
push   %rax
call   1040 <malloc@plt>
test   %rax,%rax
je     113d <safe_malloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"Out of virtual memory\0A\00"
define i8* @safe_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %12, label %8
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"Out of virtual memory\0A\00"
define noalias i8* @safe_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret i8* %2
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned long root;
};
typedef TYPE_1__ XKeyReleasedEvent;

/* Variables and functions */
void set_XKeyReleasedEvent_root(void *_p, unsigned long _v) {
  ((XKeyReleasedEvent *)_p)->root = (unsigned long)_v;
}


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

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

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

LLVM IR (-O2):
define void @set_XKeyReleasedEvent_root(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
int test_imm_07uint32_reg(unsigned int val) {
  return ((val) & (0x07 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_07uint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x7,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_07uint32_reg>:
test   $0x7,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_07uint32_reg(i32 %0) {
%2 = and i32 %0, 7
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void print_tok(char *cmd[], int cmdCount) {
  int i;
  for (i = 0; i < cmdCount; ++i) {
    printf("%s\n", cmd[i]);
  }
}


x86 assembly (clang, -O0):
<print_tok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1158 <print_tok+0x48>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print_tok+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_tok>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1145 <print_tok+0x35>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <print_tok+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @print_tok(i8** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char);
int main() {
  int i;
  char ch;
  for (i = 1; i < 255; i++) {
    ch = (char)i;
    printf("%d     %c\n", i, ch);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0xff,-0x8(%rbp)
jge    115a <main+0x4a>
mov    -0x8(%rbp),%eax
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%esi
lea    0xebd(%rip),%rdi
movsbl -0x9(%rbp),%edx
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
lea    0xee0(%rip),%r14
movsbl %bl,%edx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0xff,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [11 x i8] c"%d %c\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 1, %0 ], [ %5, %1 ]
%3 = trunc i32 %2 to i8
%4 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %2, i8 signext %3)
%5 = add nuw nsw i32 %2, 1
%6 = icmp eq i32 %5, 255
br i1 %6, label %7, label %1
7: ; preds = %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ heap_heapify(int *, int, int);
void heap_build_max(int a[], int n) {
  for (int i = (n - 1 - 1) / 2; i >= 0; --i) {
    heap_heapify(a, n, i);
  }
}


x86 assembly (clang, -O0):
<heap_build_max>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
sub    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     115a <heap_build_max+0x4a>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <heap_heapify@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1133 <heap_build_max+0x23>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<heap_build_max>:
push   %rbp
push   %r14
push   %rbx
test   %esi,%esi
jle    1141 <heap_build_max+0x31>
mov    %esi,%ebx
mov    %rdi,%r14
lea    -0x2(%rbx),%eax
shr    $0x1f,%eax
lea    (%rbx,%rax,1),%ebp
add    $0xfffffffe,%ebp
sar    %ebp
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1030 <heap_heapify@plt>
add    $0xffffffff,%ebp
jb     1130 <heap_build_max+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @heap_build_max(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = add nsw i32 %1, -2
%6 = sdiv i32 %5, 2
br label %8
7: ; preds = %8, %2
ret void
8: ; preds = %4, %8
%9 = phi i32 [ %11, %8 ], [ %6, %4 ]
%10 = tail call i32 @heap_heapify(i32* %0, i32 %1, i32 %9)
%11 = add nsw i32 %9, -1
%12 = icmp eq i32 %9, 0
br i1 %12, label %7, label %8
}
/* Variables and functions */
int /*<<< orphan*/ udsfree(void *);
void uds_dtor(void *elem, void *udata) { udsfree(elem); }


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

x86 assembly (clang, -O2):
<uds_dtor>:
jmp    1030 <udsfree@plt>

LLVM IR (-O0):
define void @uds_dtor(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 = call i32 @udsfree(i8* %5)
ret void
}

LLVM IR (-O2):
define void @uds_dtor(i8* %0, i8* nocapture readnone %1) {
%3 = tail call i32 @udsfree(i8* %0)
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ keycode;
};
typedef TYPE_1__ XKeyEvent;

/* Variables and functions */
unsigned get_XKeyEvent_keycode(void *_p) {
  return (unsigned)((XKeyEvent *)_p)->keycode;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define i32 @get_XKeyEvent_keycode(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i32, i32* %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @get_XKeyEvent_keycode(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
/* Variables and functions */
double M_PI;
double rad2deg(double radianval) {
  double degval;
  degval = radianval * 180.0 / M_PI;
  return (degval);
}


x86 assembly (clang, -O0):
<rad2deg>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mov    0x2ecb(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rad2deg>:
mulsd  0xef8(%rip),%xmm0
mov    0x2ed9(%rip),%rax
divsd  (%rax),%xmm0
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @rad2deg(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fmul double %4, 1.800000e+02
%6 = load double, double* @M_PI
%7 = fdiv double %5, %6
store double %7, double* %3
%8 = load double, double* %3
ret double %8
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @rad2deg(double %0) {
%2 = fmul double %0, 1.800000e+02
%3 = load double, double* @M_PI
%4 = fdiv double %2, %3
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  int length(char *p);
  int len;
  char str[20];
  printf("input string:\t");
  scanf("%s", str);
  len = length(str);
  printf("the length of string is %d.\n", len);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    0xeb7(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x20(%rbp),%rdi
call   1030 <length@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec5(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1030 <length@plt>
lea    0xeae(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"input string:\09\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [29 x i8] c"the length of string is %d.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [20 x i8]
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%8 = call i32 @length(i8* %7)
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"input string:\09\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [29 x i8] c"the length of string is %d.\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i32 @length(i8* %2)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ __console_tx_string(char *);
void print_err(char *str) { __console_tx_string(str); }


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

x86 assembly (clang, -O2):
<print_err>:
jmp    1030 <__console_tx_string@plt>

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

LLVM IR (-O2):
define void @print_err(i8* %0) {
%2 = tail call i32 @__console_tx_string(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LCD_CLR_RESET();
int /*<<< orphan*/ LCD_SET_CLK();
int /*<<< orphan*/ LCD_SET_DATA();
int /*<<< orphan*/ LCD_SET_DIR_OUT();
int /*<<< orphan*/ LCD_SET_RESET();
void LCD_X_Init(void) {
  LCD_CLR_RESET();
  LCD_SET_DIR_OUT();
  ;
  LCD_SET_RESET();
  LCD_SET_CLK();
  LCD_SET_DATA();
  ;
  LCD_SET_RESET();
  ;
}


x86 assembly (clang, -O0):
<LCD_X_Init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1060 <LCD_CLR_RESET@plt>
mov    $0x0,%al
call   1050 <LCD_SET_DIR_OUT@plt>
mov    $0x0,%al
call   1030 <LCD_SET_RESET@plt>
mov    $0x0,%al
call   1070 <LCD_SET_CLK@plt>
mov    $0x0,%al
call   1040 <LCD_SET_DATA@plt>
mov    $0x0,%al
call   1030 <LCD_SET_RESET@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCD_X_Init>:
push   %rax
xor    %eax,%eax
call   1060 <LCD_CLR_RESET@plt>
xor    %eax,%eax
call   1050 <LCD_SET_DIR_OUT@plt>
xor    %eax,%eax
call   1030 <LCD_SET_RESET@plt>
xor    %eax,%eax
call   1070 <LCD_SET_CLK@plt>
xor    %eax,%eax
call   1040 <LCD_SET_DATA@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <LCD_SET_RESET@plt>

LLVM IR (-O0):
define void @LCD_X_Init() {
%1 = call i32 (...) @LCD_CLR_RESET()
%2 = call i32 (...) @LCD_SET_DIR_OUT()
%3 = call i32 (...) @LCD_SET_RESET()
%4 = call i32 (...) @LCD_SET_CLK()
%5 = call i32 (...) @LCD_SET_DATA()
%6 = call i32 (...) @LCD_SET_RESET()
ret void
}

LLVM IR (-O2):
define void @LCD_X_Init() {
%1 = tail call i32 (...) @LCD_CLR_RESET()
%2 = tail call i32 (...) @LCD_SET_DIR_OUT()
%3 = tail call i32 (...) @LCD_SET_RESET()
%4 = tail call i32 (...) @LCD_SET_CLK()
%5 = tail call i32 (...) @LCD_SET_DATA()
%6 = tail call i32 (...) @LCD_SET_RESET()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ permute(int *, int /*<<< orphan*/, int);
int main() {
  int a[] = {1, 2, 3, 4, 5};
  permute(a, 0, 4);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xef6(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xedb(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <permute@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
store i32 0, i32* %1
%3 = bitcast [5 x i32]* %2 to i8*
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%5 = call i32 @permute(i32* %4, i32 0, i32 4)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call i32 @permute(i32* %3, i32 0, i32 4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ set_io_bit(int, int);
void TOSH_SET_UART_TXD0_PIN() { set_io_bit(0x70, 1); }


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

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

LLVM IR (-O0):
define void @TOSH_SET_UART_TXD0_PIN() {
%1 = call i32 @set_io_bit(i32 112, i32 1)
ret void
}

LLVM IR (-O2):
define void @TOSH_SET_UART_TXD0_PIN() {
%1 = tail call i32 @set_io_bit(i32 112, i32 1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int8_t;

/* Variables and functions */
int /*<<< orphan*/ INT8_MAX;
int /*<<< orphan*/ INT8_MIN;
int8_t sabs8(int8_t i) {
  int8_t res;
  if (INT8_MIN == i)
    res = INT8_MAX;
  else
    res = i < 0 ? -i : i;
  return res;
}


x86 assembly (clang, -O0):
<sabs8>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    0x2eda(%rip),%rax
mov    (%rax),%eax
cmp    -0x4(%rbp),%eax
jne    112a <sabs8+0x2a>
mov    0x2eb8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    114d <sabs8+0x4d>
cmpl   $0x0,-0x4(%rbp)
jge    1141 <sabs8+0x41>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1147 <sabs8+0x47>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sabs8>:
mov    0x2ee1(%rip),%rcx
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
cmp    %edi,(%rcx)
jne    111b <sabs8+0x1b>
mov    0x2ebf(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@INT8_MIN = global i32 0
@INT8_MAX = global i32 0
define i32 @sabs8(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* @INT8_MIN
%5 = load i32, i32* %2
%6 = icmp eq i32 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = load i32, i32* @INT8_MAX
store i32 %8, i32* %3
br label %19
9: ; preds = %1
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load i32, i32* %2
%14 = sub nsw i32 0, %13
br label %17
15: ; preds = %9
%16 = load i32, i32* %2
br label %17
17: ; preds = %15, %12
%18 = phi i32 [ %14, %12 ], [ %16, %15 ]
store i32 %18, i32* %3
br label %19
19: ; preds = %17, %7
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@INT8_MIN = global i32 0
@INT8_MAX = global i32 0
define i32 @sabs8(i32 %0) {
%2 = load i32, i32* @INT8_MIN
%3 = icmp eq i32 %2, %0
%4 = load i32, i32* @INT8_MAX
%5 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%6 = select i1 %3, i32 %4, i32 %5
ret i32 %6
}
char *f3(char *t) { return t; }


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

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

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

LLVM IR (-O2):
define i8* @f3(i8* readnone returned %0) {
ret i8* %0
}
/* Variables and functions */
void *malloc(int);
int /*<<< orphan*/ xnomem(void *);
void *xmalloc(int sz) {
  void *c;
  c = malloc(sz);
  xnomem(c);
  return c;
}


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

x86 assembly (clang, -O2):
<xmalloc>:
push   %rbx
call   1030 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <xnomem@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @xmalloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @xnomem(i8* %6)
%8 = load i8*, i8** %3
ret i8* %8
}

LLVM IR (-O2):
define i8* @xmalloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = tail call i32 @xnomem(i8* %2)
ret i8* %2
}
int re_assemble_12(int as12) {
  return (((as12 & 0x800) >> 11) | ((as12 & 0x400) >> (10 - 2)) |
          ((as12 & 0x3ff) << (1 + 2)));
}


x86 assembly (clang, -O0):
<re_assemble_12>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x800,%eax
sar    $0xb,%eax
mov    -0x4(%rbp),%ecx
and    $0x400,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0x3ff,%ecx
shl    $0x3,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<re_assemble_12>:
mov    %edi,%eax
shr    $0xb,%eax
and    $0x1,%eax
mov    %edi,%ecx
shr    $0x8,%ecx
and    $0x4,%ecx
or     %eax,%ecx
and    $0x3ff,%edi
lea    (%rcx,%rdi,8),%eax
ret

LLVM IR (-O0):
define i32 @re_assemble_12(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 2048
%5 = ashr i32 %4, 11
%6 = load i32, i32* %2
%7 = and i32 %6, 1024
%8 = ashr i32 %7, 8
%9 = or i32 %5, %8
%10 = load i32, i32* %2
%11 = and i32 %10, 1023
%12 = shl i32 %11, 3
%13 = or i32 %9, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @re_assemble_12(i32 %0) {
%2 = lshr i32 %0, 11
%3 = and i32 %2, 1
%4 = lshr i32 %0, 8
%5 = and i32 %4, 4
%6 = or i32 %3, %5
%7 = shl i32 %0, 3
%8 = and i32 %7, 8184
%9 = or i32 %6, %8
ret i32 %9
}
/* Type definitions */
typedef unsigned char uint16_t;

/* Variables and functions */
int read(int, unsigned char *, int);
int read_uint16(int fd, uint16_t *x) {
  unsigned char tmp[2];
  int n;
  n = read(fd, tmp, 2);
  if (n != 2)
    return -1;
  *x = tmp[0] | (tmp[1] << 8);
  return 0;
}


x86 assembly (clang, -O0):
<read_uint16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x12(%rbp),%rsi
mov    $0x2,%edx
call   1030 <read@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x2,-0x18(%rbp)
je     1149 <read_uint16+0x39>
movl   $0xffffffff,-0x4(%rbp)
jmp    1165 <read_uint16+0x55>
movzbl -0x12(%rbp),%eax
movzbl -0x11(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_uint16>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0xe(%rsp),%rsi
mov    $0x2,%edx
call   1030 <read@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    $0x2,%ecx
jne    113b <read_uint16+0x2b>
mov    0xe(%rsp),%al
mov    %al,(%rbx)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @read_uint16(i32 %0, i8* nocapture writeonly %1) {
%3 = alloca [2 x i8]
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%5 = call i32 @read(i32 %0, i8* %4, i32 2)
%6 = icmp eq i32 %5, 2
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = load i8, i8* %4
store i8 %8, i8* %1
br label %9
9: ; preds = %2, %7
%10 = phi i32 [ 0, %7 ], [ -1, %2 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ node_get_verbose_nickname_by_id(char const *, char *);
const char *node_describe_longname_by_id(const char *id_digest) {
  static char longname[(1 + 40 + 1 + 19) + 1];
  node_get_verbose_nickname_by_id(id_digest, longname);
  return longname;
}


x86 assembly (clang, -O0):
<node_describe_longname_by_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0x2f19(%rip),%rsi
call   1030 <node_get_verbose_nickname_by_id@plt>
lea    0x2f0d(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<node_describe_longname_by_id>:
push   %rbx
lea    0x2f28(%rip),%rbx
mov    %rbx,%rsi
call   1030 <node_get_verbose_nickname_by_id@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@node_describe_longname_by_id.longname = internal global [62 x i8] zeroinitializer
define i8* @node_describe_longname_by_id(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @node_get_verbose_nickname_by_id(i8* %3, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @node_describe_longname_by_id.longname, i64 0, i64 0))
ret i8* getelementptr inbounds ([62 x i8], [62 x i8]* @node_describe_longname_by_id.longname, i64 0, i64 0)
}

LLVM IR (-O2):
@node_describe_longname_by_id.longname = internal global [62 x i8] zeroinitializer
define i8* @node_describe_longname_by_id(i8* %0) {
%2 = tail call i32 @node_get_verbose_nickname_by_id(i8* %0, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @node_describe_longname_by_id.longname, i64 0, i64 0))
ret i8* getelementptr inbounds ([62 x i8], [62 x i8]* @node_describe_longname_by_id.longname, i64 0, i64 0)
}
/* Variables and functions */
char *__ulltoa_internal__(long, char *, int, int, int);
char *ltoa(long value, char *str, int base) {
  return __ulltoa_internal__((value < 0) ? -value : value, str, base, value < 0,
                             (sizeof(long) == 8) ? 0 : 0xFFFFFFFF);
}


x86 assembly (clang, -O0):
<ltoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    113d <ltoa+0x2d>
xor    %eax,%eax
sub    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1145 <ltoa+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
cmpq   $0x0,-0x8(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%ecx
xor    %r8d,%r8d
call   1030 <__ulltoa_internal__@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ltoa>:
mov    %rdi,%rcx
neg    %rdi
cmovs  %rcx,%rdi
shr    $0x3f,%rcx
xor    %r8d,%r8d
jmp    1030 <__ulltoa_internal__@plt>

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

LLVM IR (-O2):
define i8* @ltoa(i64 %0, i8* %1, i32 %2) {
%4 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
%5 = lshr i64 %0, 63
%6 = trunc i64 %5 to i32
%7 = tail call i8* @__ulltoa_internal__(i64 %4, i8* %1, i32 %2, i32 %6, i32 0)
ret i8* %7
}
int nr_of_digits(int p) {
  if (p < 10) {
    return 1;
  }
  return nr_of_digits(p / 10) + 1;
}


x86 assembly (clang, -O0):
<nr_of_digits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1131 <nr_of_digits+0x21>
movl   $0x1,-0x4(%rbp)
jmp    1149 <nr_of_digits+0x39>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <nr_of_digits@plt>
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nr_of_digits>:
mov    $0x1,%eax
cmp    $0xa,%edi
jl     1134 <nr_of_digits+0x34>
mov    $0x1,%eax
mov    $0xcccccccd,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %edi,%edx
imul   %rcx,%rdx
shr    $0x23,%rdx
add    $0x1,%eax
cmp    $0x63,%edi
mov    %edx,%edi
ja     1120 <nr_of_digits+0x20>
ret

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

LLVM IR (-O2):
define i32 @nr_of_digits(i32 %0) {
%2 = icmp slt i32 %0, 10
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ %0, %1 ]
%5 = phi i32 [ %7, %3 ], [ 0, %1 ]
%6 = udiv i32 %4, 10
%7 = add nuw nsw i32 %5, 1
%8 = icmp ult i32 %4, 100
br i1 %8, label %9, label %3
9: ; preds = %3
%10 = add nuw i32 %5, 2
br label %11
11: ; preds = %9, %1
%12 = phi i32 [ 1, %1 ], [ %10, %9 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ crypto_rand(char *, size_t);
void dns_randfn_(char *b, size_t n) { crypto_rand(b, n); }


x86 assembly (clang, -O0):
<dns_randfn_>:
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 <crypto_rand@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dns_randfn_>:
jmp    1030 <crypto_rand@plt>

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

LLVM IR (-O2):
define void @dns_randfn_(i8* %0, i64 %1) {
%3 = tail call i32 @crypto_rand(i8* %0, i64 %1)
ret void
}
void outb(const unsigned int port, unsigned int value) {
  __asm__ __volatile__("outb %%al, %%dx" : : "a"(value), "d"(port));
}


x86 assembly (clang, -O0):
<outb>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%edx
out    %al,(%dx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<outb>:
mov    %esi,%eax
mov    %edi,%edx
out    %al,(%dx)
ret

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

LLVM IR (-O2):
define void @outb(i32 %0, i32 %1) {
tail call void asm sideeffect "outb %al, %dx", "{ax},{dx},~{dirflag},~{fpsr},~{flags}"(i32 %1, i32 %0)
ret void
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
void cast_Good() {
  char arr[5];
  *(int32_t *)(arr + 1) = 123;
}


x86 assembly (clang, -O0):
<cast_Good>:
push   %rbp
mov    %rsp,%rbp
movl   $0x7b,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @cast_Good() {
%1 = alloca [5 x i8]
%2 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds i8, i8* %2, i64 1
%4 = bitcast i8* %3 to i32*
store i32 123, i32* %4
ret void
}

LLVM IR (-O2):
define void @cast_Good() {
ret void
}
int main() {
  int i;
  int (*f)(void);
  void *__builtin_extract_return_addr(void *addr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(char **);
void free_file_list(char **list) {
  if (list)
    free(list);
}


x86 assembly (clang, -O0):
<free_file_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <free_file_list+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_file_list>:
test   %rdi,%rdi
je     111a <free_file_list+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @free_file_list(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = icmp ne i8** %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8**, i8*** %2
%7 = call i32 @free(i8** %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @free_file_list(i8** %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8** %0)
br label %5
5: ; preds = %3, %1
ret void
}